[fpc-pascal] FPC cross compilation error: cannot find -lgcc

Bruce Tulloch pascal at causal.com
Fri May 24 09:12:02 CEST 2013


Hi Stephano,

I have been having a number of problems that look similar to this in
several ways.

I'm trying to chase down what's going wrong and I'll let you know what
I discover.

First up I noticed in your log that the linker reports:

/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/linux/../unix/cthreads.pp:1032:
warning: Using 'dlopen' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking

AFAIK it should not be statically linked. Here's how I ran into the
same problem:

http://lists.freepascal.org/lists/fpc-pascal/2013-May/038242.html

There may be a clue in your log:

/home/me/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc fpmake.pp -n
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit/units_bs/i386-linux
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux -Xd
-Xt -gl

shows the -Xt switch is selected. I don't think it should be but Jonas
would need to chime on on this. I'm looking into this apropos my
builds of the RTL for cross targets.

I also found that libgcc is not pulled into the link in some cases. In
my case it depends on something in the crossroot (against which one's
linking) at least in my case:

http://lists.freepascal.org/lists/fpc-pascal/2013-May/038242.html

Again, I don't know what's happening here but I want to find out.

I've also discovered that the switch -XR used to to prefix search
paths when cross compiling is problematic in some cases:

http://lists.freepascal.org/lists/fpc-pascal/2013-May/038223.html

I hope this helps. Bruce.

On Sun, May 5, 2013 at 5:59 AM, patspiper <patspiper at gmail.com> wrote:
> On 12/04/13 00:11, patspiper wrote:
>>
>> On 12/04/13 00:08, patspiper wrote:
>>>
>>> On 11/04/13 23:25, Marco van de Voort wrote:
>>>>
>>>> In our previous episode, patspiper said:
>>>>>
>>>>> Cross compilation from Ubuntu 32 bit to Win32, WIn64, and Linux 64
>>>>> works
>>>>> well with FPC 2.6.0.
>>>>>
>>>>> With FPC 2.7.1, any cross compilation yields a 'cannot find -lgcc'
>>>>> error.
>>>>
>>>> Linking what file generates that error when crosscompiling to win32 or
>>>> win64?
>>>
>>> Below is the relevant part of the log for Win32 with FPC2.7.1
>>> (fpmake.pp):
>>>
>>> make -C packages smart
>>> make[2]: Entering directory
>>> `/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages'
>>> make -C fpmkunit bootstrap
>>> make[3]: Entering directory
>>> `/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit'
>>> /bin/mkdir -p units_bs/i386-linux
>>> /home/me/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc src/fpmkunit.pp
>>> -n -Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/paszlib
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fcl-process
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/hash
>>> -FUunits_bs/i386-linux -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src
>>> -Fi../fcl-process/src/unix -Fu../fcl-process/src -Fi../fcl-process/src/linux
>>> -Fi../fcl-process/src/dummy -Xd -Xt -gl
>>> make[3]: Leaving directory
>>> `/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit'
>>> /home/me/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc fpmake.pp -n
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit/units_bs/i386-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux -Xd -Xt
>>> -gl
>>> /usr/bin/ld: warning: link.res contains output sections; did you forget
>>> -T?
>>>
>>> /home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux/cthreads.o:
>>> In function `CTHREADS_$$_init':
>>>
>>> /home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/linux/../unix/cthreads.pp:1032:
>>> warning: Using 'dlopen' in statically linked applications requires at
>>> runtime the shared libraries from the glibc version used for linking
>>> /usr/bin/ld: cannot find -lgcc
>>> fpmake.pp(33,1) Error: Error while linking
>>> fpmake.pp(33,1) Fatal: There were 1 errors compiling module, stopping
>>> Fatal: Compilation aborted
>>> make[2]: *** [fpmake] Error 1
>>> make[2]: Leaving directory
>>> `/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages'
>>> make[1]: *** [packages_smart] Error 2
>>>
>>> Linux 64 with FPC2.6.3 fails while linking fpdoc.pp:
>>> /home/me/Programs/fpc/fpsrc/exported/2.6.3/compiler/ppcrossx64 -Px86_64
>>> -XPx86_64-linux- -Xr
>>> -Fl/home/me/Programs/fpc/crossbinutils/lib//x86_64-linux -Ur -Xs -O2 -n -S2h
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/rtl/units/x86_64-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/fcl-base/units/x86_64-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/iconvenc/units/x86_64-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/fcl-xml/units/x86_64-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/fcl-passrc/units/x86_64-linux
>>> -Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/chm/units/x86_64-linux
>>> -FD/home/me/Programs/fpc/crossbinutils/bin -FE. -FUunits/x86_64-linux -Cg
>>> -Flinclude -Fl/etc/ld.so.conf.d/*.conf -Xd -Xt -gl -dx86_64 -dRELEASE
>>> fpdoc.pp
>>> /home/me/Programs/fpc/crossbinutils/bin/x86_64-linux-ld: warning:
>>> ./link.res contains output sections; did you forget -T?
>>> /home/me/Programs/fpc/crossbinutils/bin/x86_64-linux-ld: cannot find
>>> -lgcc
>>> /home/me/Programs/fpc/crossbinutils/bin/x86_64-linux-ld: cannot find -lc
>>
>>
>> Just to clarify: It is the building of the cross compiler that fails.
>
> Bump
>
> Note: I have submitted 2 related bug reports:
> http://bugs.freepascal.org/view.php?id=24262
> http://bugs.freepascal.org/view.php?id=24372
>
>
> Stephano
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list