[fpc-pascal] Linking Problems while cross compiling for arm

Dariusz Mazur darekm at emadar.com
Tue Dec 8 15:06:29 CET 2009


Hartmut Eilers pisze:
> Hallo List,
>
> thanks for your first and fast response. According to the suggestions
> from Marco and Jonas I try it this way:
>
> ubuntu at kubuntu904:~/OpenLabTools/DeviceServer$
> /usr/local/bin/ppcrossarm -CfFPA  -dUSB92 -CaARMEB -CpARMV5 -darm
> -dFPC_ARMEL  -gl -Fu../webserver -Fu../PhysMach
> -Fu../divLibs/pwu-1.6.0.2-src/main/
> -FL/usr/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib/ld-uClibc.so.0
> -Fl/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib/
> -XParm-unknown-linux-uclibc- -Xd
> -Xr/usr/local/xtools/arm-unknown-linux-uclibc/
> -XR/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/sys-root/lib/
> DeviceServer.pas
> Free Pascal Compiler version 2.4.0rc1 [2009/12/07] for arm
> Copyright (c) 1993-2009 by Florian Klaempfl
> Target OS: Linux for ARM
> Compiling DeviceServer.pas
> DeviceServer.pas(538,10) Warning: Function result does not seem to be set
> Assembling deviceserver
> Linking DeviceServer
> /usr/local/xtools/arm-unknown-linux-uclibc/bin/arm-unknown-linux-uclibc-ld:
> cannot find -ldl
> DeviceServer.pas(609,2) Error: Error while linking
> DeviceServer.pas(609,2) Fatal: There were 1 errors compiling module, stopping
> Fatal: Compilation aborted
>
> If I run the above command with strace I see:
> access("/usr/local/lib/fpc/2.4.0/units/arm-linux/rtl/ucprt0.o", F_OK)
> = 0
>
> so I assume that the compiler is aware of compiling for a uclibc system.
> therefor I tried to pass the lib path to the linker:
>
> ubuntu at kubuntu904:~/OpenLabTools/DeviceServer$
> /usr/local/bin/ppcrossarm -CfFPA  -dUSB92 -CaARMEB -CpARMV5 -darm
> -dFPC_ARMEL  -gl -Fu../webserver -Fu../PhysMach
> -Fu../divLibs/pwu-1.6.0.2-src/main/
> -FL/usr/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib/ld-uClibc.so.0
> -Fl/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib/
> -XParm-unknown-linux-uclibc- -Xd
> -Xr/usr/local/xtools/arm-unknown-linux-uclibc/
> -XR/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/
> -k"-L/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib"
>   
try
  omit -XP
  
-Xr/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/ lib
or

-XParm-unknown-linux-uclibc- 
-Xr/usr/local/xtools/arm-unknown-linux-uclibc/lib
-XR/usr/local/xtools/arm-unknown-linux-uclibc/

or
-XP/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/bin
-Xr/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib
-XR/usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/

my params:
-XP/home/darek2008/fpcarm/arm-linux-uclibc/bin/
-Xr/home/darek2008/fpcarm/arm-linux-uclibc/lib
-XR/home/darek2008/fpcarm/arm-linux-uclibc/
-darm
-CfSOFT
-CaEABI
-Tlinux



> DeviceServer.pas
> Free Pascal Compiler version 2.4.0rc1 [2009/12/07] for arm
> Copyright (c) 1993-2009 by Florian Klaempfl
> Target OS: Linux for ARM
> Compiling DeviceServer.pas
> DeviceServer.pas(538,10) Warning: Function result does not seem to be set
> Assembling deviceserver
> Linking DeviceServer
> /usr/local/xtools/arm-unknown-linux-uclibc/bin/arm-unknown-linux-uclibc-ld:
> cannot find -ldl
>   
after  compile with -Cn param
make linking by hand

.../bin/ld --verbose link.res
add softlink libdl.so to libdl.so.0


> DeviceServer.pas(609,2) Error: Error while linking
> DeviceServer.pas(609,2) Fatal: There were 1 errors compiling module, stopping
> Fatal: Compilation aborted
>
> ubuntu at kubuntu904:~/OpenLabTools/DeviceServer$ ls
> /usr/local/xtools/arm-unknown-linux-uclibc/arm-unknown-linux-uclibc/lib
> ldscripts            libgomp.a         libmudflap.la
> libnsl.so.0           libssp_nonshared.la  libsupc++.a
> ld-uClibc-0.9.30.so  libgomp.la        libmudflap.so
> libpthread-0.9.30.so  libssp.so            libsupc++.la
> ld-uClibc.so.0       libgomp.so        libmudflap.so.0
> libpthread.so.0       libssp.so.0          libthread_db-0.9.30.so
> libcrypt-0.9.30.so   libgomp.so.1      libmudflap.so.0.0.0
> libresolv-0.9.30.so   libssp.so.0.0.0      libthread_db.so.1
> libcrypt.so.0        libgomp.so.1.0.0  libmudflapth.a
> libresolv.so.0        libstdc++.a          libuClibc-0.9.30.so
> libc.so.0            libgomp.spec      libmudflapth.la
> librt-0.9.30.so       libstdc++.la         libutil-0.9.30.so
> libdl-0.9.30.so      libiberty.a       libmudflapth.so
> librt.so.0            libstdc++_pic.a      libutil.so.0
> libdl.so.0           libm-0.9.30.so    libmudflapth.so.0      libssp.a
>   
add softlink libdl.so to libdl.so.0


>              libstdc++.so
> libgcc_s.so          libm.so.0         libmudflapth.so.0.0.0
> libssp.la             libstdc++.so.6
> libgcc_s.so.1        libmudflap.a      libnsl-0.9.30.so
> libssp_nonshared.a    libstdc++.so.6.0.10
>
> >From my point of view the -k"-L..." is the correct path and libdl is
> located there.
>
> Can anybody enlighten me in this ?
> After one weekend fiddeling with all this I'm very confused.
> Thanks for your help
>
> Hartmut
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>   


-- 
  Darek







More information about the fpc-pascal mailing list