Hadi_Lovelorn wrote: 2024-08-07 13:14
I purged libgmp10-dev from Debian 12 Bookworm and then installed GMP 6.3.0 from source with debug options :
Code: Select all
./configure --disable-shared --enable-assert --enable-alloca=debug --host=none CFLAGS=-g
I want to compile my program as :
Code: Select all
gcc -o -g ~/program ~/program.c -lgmp -L/usr/local/lib/libgmp.a
but GCC gives error :
Code: Select all
/usr/bin/ld: /home/lovelorn/program: stderr: invalid version 2 (max 0)
/usr/bin/ld: /home/lovelorn/program: error adding symbols: bad value
collect2: error: ld returned 1 exit status
The errors are printed by the linker (ld).
It is only possible to guess why without the working full source code of your program called "program.c" (and the same for the library).
Just a wild guess: you probably did something strange when building libgmp.a.
Why don't you use the libgmp.a available in the Debian repositories?
Code: Select all
$ apt-file search libgmp.a
libgmp-dev: /usr/lib/x86_64-linux-gnu/libgmp.a
Debugging symbols are available for Debian packages in a dedicated repository and they can be installed using apt, e.g.:
Code: Select all
# Bookworm debug symbols
deb http://deb.debian.org/debian-debug/ bookworm-debug main contrib
Therefore, there's no need to build a custom library to get debug symbols.
Anyway, you probably don't need to debug the library, since you need to find bugs in your program first (to find general errors and errors in using the library functions).
Assuming, of course, that the gmp library is the right choice for your purpose.