Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

Search order for libraries, how to influence; using GMP

6 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tom Verhoeff

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

E-MAIL: T.Verhoeff @ TUE.NL | Dept. of Math. & Comp. Science PHONE: +31 40 247 41 25 | Technische Universiteit Eindhoven FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven http://www.win.tue.nl/~wstomv/ | The Netherlands
Michael Van Canneyt
to Tom Verhoeff: I am trying to use the GNU Multi-Precision (GMP) library with FreePascal under Linux. I…
Tom Verhoeff wrote 50 lines
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?

The compiler adds them by default, see systems/t_linux.pas. You can't remove them except by editing link.res (or changing the compiler).

Michael.

Darius Blaszijk
to Tom Verhoeff: I am trying to use the GNU Multi-Precision (GMP) library with FreePascal under Linux. I…

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

Darius

Tom Verhoeff wrote 55 lines
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
Daniël Mantione
to Michael Van Canneyt: The compiler adds them by default, see systems/t_linux.pas. You can't remove them except…

Op Tue, 12 Jun 2007, schreef Michael Van Canneyt:

> Where do the first three come from? Can those be (re)moved? The compiler adds them by default, see systems/t_linux.pas. You can't remove them except by editing link.res (or changing the compiler).

... and there is no need. The message about the skipped file is harmless, just make sure the compiler finds the correct one.

Daniël

Tom Verhoeff
to Darius Blaszijk: BTW: JediMath has a 100% pascal implementation for arbitrary length arithmatic. Checkout…
Darius Blaszijk wrote
BTW: JediMath has a 100% pascal implementation for arbitrary length arithmatic. Checkout JmLargeFloat.

Thanks. But this does not seem to implement arbitrary-precision integers and rationals (fractions). The GMP does.

Tom

E-MAIL: T.Verhoeff @ TUE.NL | Dept. of Math. & Comp. Science PHONE: +31 40 247 41 25 | Technische Universiteit Eindhoven FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven http://www.win.tue.nl/~wstomv/ | The Netherlands