Jeroen Demeyer on Thu, 31 May 2007 13:03:53 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: libpari and static linking

Jeroen Demeyer wrote:
Hello list,

I wrote a C++ program which uses libPARI for factoring integers (the function Z_factor()). However, it only compiles with dynamic linking. When I link -static, I get the following errors:

factor.o: In function `factornumber(number_t const&)':
factor.cpp:(.text+0x10c): undefined reference to `avma'
factor.cpp:(.text+0x16c): undefined reference to `bot'
[more errors like this...]

I found out how to fix the problem:
apparently the -lpari linker option must be given AFTER all object files, so I need to do

g++ -static myobj1.o myobj2.o myobj3.o -omyprogram -lpari -lgmp

With -lpari -lgmp at the end. I found this out using trial and error, I cannot explain why.