[fpc-devel] Re: -k linker path limit?
L505
fpc505 at z505.com
Sun May 14 09:43:34 CEST 2006
Just posting some more information: here is the verbose output when using the -va option:
Searching file c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe... found
Using util c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe
hello.pas(16,1) Error: Can't call the linker, switching to external linking
Error: c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ppc386.exe returned an erro
r exitcode (normal if you did not specify a source file to be compiled)
It does find the linker.. but the long -k path (about 48-100 characters long) some how
causes issues and reports back that it can't call the linker! Hmm..
When I pass a -k path which is about 5-44 characters long (nice and short) it reports a
correctly and works fine:
Searching file c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe... found
Using util c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe
c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ld.exe: c:\abc\abc\test\test\test\
test\ld-linux.so.2: No such file: No such file or directory
hello.pas(16,1) Error: Error while linking
Error: c:\pascal\FPC-2.0.2-CrossLinux\bin\i386-win32\ppc386.exe returned an erro
r exitcode (normal if you did not specify a source file to be compiled)
Because the path is not found, which is 100% right. It's just a made up "dummy" directory
to see if errors are working properly.
It seems to be in the 48-100 character path length range which causes issues, but I can't
get a definite number like 48 or 47, since I've noticed fluctuations, or maybe my eyes are
sore from counting characters on the screen today too much.
BTW - if anyone is interested in cross compiling I recommend making a copy of fpc.exe and
renaming it to fpc-lin.exe, moving it to a new directory and just switching your compiler
path to c:\fpc-cross\bin\fpc-lin.exe when you want to cross compile. This saves you having
to re-copy the as, ld, ar files each time you want to revert back to normal compiling.
Because AFAIK, using a cross compiler AS/AR/LD utility requires you copy the old
files back, each time you want to switch from normal compiles to cross-compiles.
Keep two directories for fpc:
1. A regular fpc compiler directory containing fpc.exe
2. A cross compiler directory containing fpc-lin.exe.
Remember to add the directory fpc-lin.exe is in to your system environment (edit your
ControlPanel/System/AdvancedTab/ PATH)
Renaming one of the fpc files to fpc-lin ensures that when you call fpc-lin it pulls in
the right directory for cross compiling. And if you use lazarus, each time you cross
compile you just switch your compiler path to that new cross compiling directory.
If this is not as an elegant of a solution that someone else has found - let me know. If
it is an elegant solution, then it should probably be noted that the IDE's like fp-ide and
lazarus IDE should have an option for a "cross compiler" directory in addition to the
regular FPC directory.
For the reference, I'll be reporting some notes about cross compiling here too:
http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=Compiling-Linux-Elf-on-Windows
More information about the fpc-devel
mailing list