[fpc-pascal] Search order for libraries, how to influence; using GMP

Darius Blaszijk dhkblaszyk at zeelandnet.nl
Tue Jun 12 23:16:23 CEST 2007


BTW: JediMath has a 100% pascal implementation for arbitrary length 
arithmatic. Checkout JmLargeFloat.

Darius

Tom Verhoeff wrote:
> I am trying to use the GNU Multi-Precision (GMP) library with
> FreePascal under Linux.
>
> I have a Pascal interface for GMP (originally for Kylix; translated
> from C header file).
>
> The header file libgmp.pas and my using program testgmp.pas compile fine.
>
> But linking fails.  The message is
>
> /usr/bin/ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o
> /usr/bin/ld: cannot find /usr/lib/crti.o
>
> This might be caused by the fact that I use a 64-bit machine with
> a 32-bit version of FPC.
>
> For that reason, I added the command-line option:
>
> 	-Fl/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/32
>
> Without this option, I get the message
>
> /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/crtbegin.o when searching for /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/crtbegin.o
> /usr/bin/ld: cannot find /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/crtbegin.o
>
> With the option, it does find the appropriate crtbegin.o.
>
> Therefore, I also added the command-line option
>
> 	-Fl/usr/lib32
>
> But this does not help, since /usr/lib is searched first and there if
> finds the incompatible (64-bit?) version of crti.o, and fails.
>
> How can I force the linker to look in /usr/lib32 before /usr/lib ?
>
> When inspecting link.res, it starts out
>
> SEARCH_DIR(/lib/)
> SEARCH_DIR(/usr/lib/)
> SEARCH_DIR(/usr/X11R6/lib/)
> SEARCH_DIR(/usr/lib32/)
> SEARCH_DIR(/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/32/)
> SEARCH_DIR(/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/)
>
> Apparently, the first three are forced 'out of nowhere', then there are
> the two options from the command line, and then the one from /etc/fpc.cfg,
> followed by a long list of directories named /usr/lib/fpc/* .
>
> Where do the first three come from?  Can those be (re)moved?
>
> Thanks,
>
> 	Tom
>   



More information about the fpc-pascal mailing list