Linking failed on RaspberryPi

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking failed on RaspberryPi

Xiangrong Fang
Hi All,

I try to compile my program on Pi, with the official FPC 2.6.4 for arm linux, but get the following error:

/usr/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/usr/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'

Is there anything missing from my FPC installation? 

TIA for any hint.



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Jonas Maebe-2
On 04/09/15 03:15, Xiangrong Fang wrote:

> I try to compile my program on Pi, with the official FPC 2.6.4 for arm
> linux,

Official from where: from your Raspberry Pi repository, or downloaded
from our website? In the latter case: there are approximately a thousand
different variants of ARM Linux (*), and your Raspberry Pi is using a
different one than the one for which our FPC 2.6.4 was compiled. If you
are using the one from your Raspberry Pi repository, it should work.

If you want more information, everything you may ever want to know about
what could go wrong with compiling for Raspberry Pi has been discussed
in http://lists.freepascal.org/fpc-pascal/2015-August/thread.html#44987

You can also try FPC 3.0 rc1 for Raspberry Pi, as mentioned in
http://lists.freepascal.org/fpc-pascal/2015-September/thread.html#45162


Jonas

(*) this may be a slight exaggeration
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Peter
In reply to this post by Xiangrong Fang
On 04/09/15 02:15, Xiangrong Fang wrote:
> .....
> Is there anything missing from my FPC installation?
>
> TIA for any hint.
>


To build FPC programs on linux one generally needs a variant of
libc-dev, which is not part of FPC itself.
The package you need might be libc6-dev, or some other combination of
'libc' and 'dev'.

Please post the solution if/when you find it for the benefit of others.
This same question seems to keep poping up on this list.

Regards,
Peter
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Mark Morgan Lloyd-5
Peter wrote:

> On 04/09/15 02:15, Xiangrong Fang wrote:
>> .....
>> Is there anything missing from my FPC installation?
>>
>> TIA for any hint.
>
> To build FPC programs on linux one generally needs a variant of
> libc-dev, which is not part of FPC itself.
> The package you need might be libc6-dev, or some other combination of
> 'libc' and 'dev'.
>
> Please post the solution if/when you find it for the benefit of others.
> This same question seems to keep poping up on this list.

You mean like I did [checks] on the 31st?
http://lists.freepascal.org/pipermail/fpc-pascal/2015-August/045157.html

And that was without any particular additions, other than what came with
Raspbian 2014 as standard; Raspbian 2015 doesn't need most of those
options (i.e. either miss out the -FL and -Fl options, or follow
Martin's procedure).

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Peter
On 14/09/15 21:09, Mark Morgan Lloyd wrote:

> Peter wrote:
>> On 04/09/15 02:15, Xiangrong Fang wrote:
>>> .....
>>> Is there anything missing from my FPC installation?
>>> TIA for any hint.
>>
>> To build FPC programs on linux one generally needs a variant of
>> libc-dev, which is not part of FPC itself.
>> The package you need might be libc6-dev, or some other combination of
>> 'libc' and 'dev'.
>>
>> Please post the solution if/when you find it for the benefit of others.
>> This same question seems to keep poping up on this list.
>
> You mean like I did [checks] on the 31st?
> http://lists.freepascal.org/pipermail/fpc-pascal/2015-August/045157.html
>
> And that was without any particular additions, other than what came with
> Raspbian 2014 as standard; Raspbian 2015 doesn't need most of those
> options (i.e. either miss out the -FL and -Fl options, or follow
> Martin's procedure).
>


The symbols the OP is missing are defined in crti.o
Without further information from him, its impossible to know whether the
problem is that
1) crti.o is not installed (its libc..dev not FPC)
2) The -Fl option does not use the right path for the system in use.

I would suggest the following;
try the command
ls /usr/lib/**/crti.o

If it works, use the given path for -Fl (as per the links already given
in this thread.
If it does not work, install the libc package that contains crti.o, and
repeat the test.


Regards,
PB

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Xiangrong Fang
I downloaded arm linux distribution from freeepascal website (sourceforge).  So, I should get it work by fixing crti as suggested by PB, or I shall get the compiler from Pi website as suggested by Jonas?




2015-09-15 19:11 GMT+08:00 Peter <[hidden email]>:
On 14/09/15 21:09, Mark Morgan Lloyd wrote:
> Peter wrote:
>> On 04/09/15 02:15, Xiangrong Fang wrote:
>>> .....
>>> Is there anything missing from my FPC installation?
>>> TIA for any hint.
>>
>> To build FPC programs on linux one generally needs a variant of
>> libc-dev, which is not part of FPC itself.
>> The package you need might be libc6-dev, or some other combination of
>> 'libc' and 'dev'.
>>
>> Please post the solution if/when you find it for the benefit of others.
>> This same question seems to keep poping up on this list.
>
> You mean like I did [checks] on the 31st?
> http://lists.freepascal.org/pipermail/fpc-pascal/2015-August/045157.html
>
> And that was without any particular additions, other than what came with
> Raspbian 2014 as standard; Raspbian 2015 doesn't need most of those
> options (i.e. either miss out the -FL and -Fl options, or follow
> Martin's procedure).
>


The symbols the OP is missing are defined in crti.o
Without further information from him, its impossible to know whether the
problem is that
1) crti.o is not installed (its libc..dev not FPC)
2) The -Fl option does not use the right path for the system in use.

I would suggest the following;
try the command
ls /usr/lib/**/crti.o

If it works, use the given path for -Fl (as per the links already given
in this thread.
If it does not work, install the libc package that contains crti.o, and
repeat the test.


Regards,
PB

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Jonas Maebe-2
On 15/09/15 13:28, Xiangrong Fang wrote:
> I downloaded arm linux distribution from freeepascal website
> (sourceforge).  So, I should get it work by fixing crti as suggested by
> PB, or I shall get the compiler from Pi website as suggested by Jonas?

You don't get it from the Pi website, but by using the package manager
of your linux distribution (apt).

The version from the FPC website is not appropriate for your Linux
distribution, as it is for ARMEL and you have ARMHF.


Jonas

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Peter
In reply to this post by Xiangrong Fang
It would be useful to see the output of these two commands

grep Fl /etc/fpc.cfg
ls /usr/lib/**/crti.o


Jonas knows a lot more about FPC than I do!

Regards,
PB
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Jonas Maebe-2
On 15/09/15 14:06, Peter wrote:
> It would be useful to see the output of these two commands
>
> grep Fl /etc/fpc.cfg
> ls/usr/lib/**/crti.o
>
>
> Jonas knows a lot more about FPC than I do!

The version on the FPC website is an ARMEL version, so it will look for
the ARMEL version of crti.o (in /usr/lib/arm-linux-gnueabi).


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Xiangrong Fang
In reply to this post by Peter
Hi Peter,

xrfang@pi ~ $ grep FI /etc/fpc.cfg
# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
# -d is the same as #DEFINE
#DEFINE NEEDCROSSBINUTILS

xrfang@pi ~ $ ls /usr/lib/**/crti.o
/usr/lib/arm-linux-gnueabihf/crti.o

Thanks!




2015-09-15 20:06 GMT+08:00 Peter <[hidden email]>:
It would be useful to see the output of these two commands

grep Fl /etc/fpc.cfg
ls /usr/lib/**/crti.o


Jonas knows a lot more about FPC than I do!

Regards,
PB


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Xiangrong Fang
In reply to this post by Jonas Maebe-2
I asked on the list before.  The version shipped with Pi is 2.6.0, and is said to be very buggy, I need version 2.6.4, so I downloaded from official site.



2015-09-15 19:52 GMT+08:00 Jonas Maebe <[hidden email]>:
On 15/09/15 13:28, Xiangrong Fang wrote:
I downloaded arm linux distribution from freeepascal website
(sourceforge).  So, I should get it work by fixing crti as suggested by
PB, or I shall get the compiler from Pi website as suggested by Jonas?

You don't get it from the Pi website, but by using the package manager of your linux distribution (apt).

The version from the FPC website is not appropriate for your Linux distribution, as it is for ARMEL and you have ARMHF.


Jonas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Xiangrong Fang
Another problem is, as I downloaded the wrong version and ran its install.sh (as root), how can I uninstall it?

Thanks!



2015-09-16 9:29 GMT+08:00 Xiangrong Fang <[hidden email]>:
I asked on the list before.  The version shipped with Pi is 2.6.0, and is said to be very buggy, I need version 2.6.4, so I downloaded from official site.



2015-09-15 19:52 GMT+08:00 Jonas Maebe <[hidden email]>:
On 15/09/15 13:28, Xiangrong Fang wrote:
I downloaded arm linux distribution from freeepascal website
(sourceforge).  So, I should get it work by fixing crti as suggested by
PB, or I shall get the compiler from Pi website as suggested by Jonas?

You don't get it from the Pi website, but by using the package manager of your linux distribution (apt).

The version from the FPC website is not appropriate for your Linux distribution, as it is for ARMEL and you have ARMHF.


Jonas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Mark Morgan Lloyd-5
In reply to this post by Peter
Peter wrote:
> It would be useful to see the output of these two commands
>
> grep Fl /etc/fpc.cfg
> ls /usr/lib/**/crti.o
>
>
> Jonas knows a lot more about FPC than I do!

Jonas pointed out to me when I went through this a couple of weeks ago
that fpc.cfg isn't used while FPC is being built.

See the earlier thread.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Linking failed on RaspberryPi

Peter
In reply to this post by Xiangrong Fang
On 16/09/15 02:28, Xiangrong Fang wrote:
> Hi Peter,
>
> xrfang@pi ~ $ ls /usr/lib/**/crti.o
> /usr/lib/arm-linux-gnueabihf/crti.o
>
> Thanks!

Then you could try compiling your program with the switch
-Fl /usr/lib/arm-linux-gnueabihf

{Note its a lower case l not an upper case I (as per your grep!) after
the -F}

You MIGHT get a bit farther. However, the real problem though, as Jonas
explained, is you have an ARMEL compiler but an ARMHF system.

You need to download, or build yourself, an ARMHF compiler.
Please follow the links in Jonas's first post here.
http://lists.freepascal.org/fpc-pascal/2015-September/045230.html

Regards,
PB
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal