64bit Ubuntu libraries, linking problem

Nik N niknot at gmail.com
Mon Jul 20 23:20:03 UTC 2009


Hi there;
I am moving some development activities from 32-bit to 64-bit
Ubuntu 8.04.

A static library, libmystuff.a is created in a usual way, for instance:

cd ${HOME}/libdir
gcc -c  /.../lib_sourcedir/func*.c
ar -ruv libmystuff.a func*.o
ranlib libmystuff.a

A library such as that would be included in the program someprog.c
build like this:

gcc -L${HOME}/libdir -lmystuff someprog.c

This works in 32-bit Hardy (and many, many Linux distros before it), but
fails in 64-bit Hardy with something like:
...
someprog.c:(.text+0x3c): undefined reference to `funcxyz'
...
However, if the same library file is given explicitly, such as:
gcc someprog.c ${HOME}/libdir/libmystuff.a
the linking (and the program) works (as it does on 32-bit
development platform). Note: there is no cross-compiling
going on here: 32 bit dev platform is used to build 32-bit
library and executable, and the same for 64-bit.

Any suggestions?
TIA, Nik N.




More information about the ubuntu-users mailing list