[fpc-devel] Cross-compiling and warnings from linker

Sergey Organov sorganov at gmail.com
Fri Nov 12 20:33:14 CET 2021


Jonas Maebe via fpc-devel
<fpc-devel-PD4FTy7X32k2wBtHl531yWD2FQJk+8+b at public.gmane.org> writes:

> On 2021-11-12 10:20, Pierre Muller via fpc-devel wrote:
>> Le 10/11/2021 à 21:19, Sergey Organov via fpc-devel a écrit :
>>> Hello,
>>> Using cross-compiler from x86-linux to arm-linux, I keep getting a lot
>>> of warnings at the linking stage of my programs, in the form:
>>> /opt/[...]/arm-linux-gnueabihf-ld: warning: library search path 
>>> "/usr/lib/eject/" is unsafe for cross-compilation
>>> /opt/[...]/arm-linux-gnueabihf-ld: warning: warning: library search
>>> path "/usr/lib/console-setup/" is unsafe for cross-compilation
>>> [...]
>>> for virtually every sub-directory in /usr/lib. FPC 3.2.0 and 3.2.2 
>>> both
>>> have this issue.
>>> This makes me suspect FPC cross produces instructions for the linker 
>>> to
>>> search for files in wrong directories, where host libraries reside, that
>>> could lead to unpredictable results, and then tons of the warnings are
>>> really annoying.
>>> What's the way to fix this?
>>   Try to use -Xd compiler option
>> ~/bin$ fpc -h | grep -- -Xd
>>       -Xd        Do not search default library path (sometimes
>> required for cross-compiling when not using -XR)
>
> Or better: use -XR/path/to/cross-root. -Xd is a hack that predates the
> introduction of -XR.

Thanks, I believe I already do use -XR, here is entire compilation line:

/opt/cross/br/arm/armv7a/6.2.0.v6/usr/lib/fpc/3.2.0/ppcrossarm -O3 -CX -XX -Xs -veibq -vw-n-h- -MDelphiUnicode -Sg -Sc  
-XS -Tlinux -dCPU_ARM -Parm -CaEABIHF -XR/opt/cross/br/arm/armv7a/6.2.0.v6/usr/arm-javad-linux-gnueabihf/sysroot        
-XP/opt/cross/br/arm/armv7a/6.2.0.v6/usr/bin/arm-javad-linux-gnueabihf-                                                 
-k-T/opt/cross/br/arm/armv7a/6.2.0.v6/usr/lib/ldscripts/armelf_linux_eabi.x                                             
-Fu/opt/cross/br/arm/armv7a/6.2.0.v6/usr/lib/fpc/3.2.0/units/arm-linux/*                                                
-Fl/opt/cross/br/arm/armv7a/6.2.0.v6/usr/arm-javad-linux-gnueabihf/sysroot/usr/lib/ -Fu./src                            
-Fu./generics.collections-master/src -Fu./lazutils -dJXT_PRCNTG -dJXTDB -dJXT_LNX -dJXT_RTPK -dCONSOLE                  
-dSQLITE_LOAD_DYNAMICALLY -dCGGTTS -FU./build/arm-linux/obj/mkCGGTTS -o./build/arm-linux/bin/mkCGGTTS                   
./src/mkCGGTTS.pas

and still I get all those warnings. Something's wrong with my command-line options?

Thanks,
-- Sergey Organov


More information about the fpc-devel mailing list