Dear LQ Folks,
gcc's linker appears to be picking up 64 bit libraries in spite of specifying a 32 bit architecture. I am compiling a small program with a call to a libX11 function (see bottom). Compiling with gcc 4.1.1/ld 2.17.50.06-2.fc6, I am seeing the following:
> gcc -m32 -o testit testit.c -lX11
/usr/bin/ld: skipping incompatible /usr/lib64/libX11.so when searching for -lX11
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
It appears that in spite of the -m32 flag to gcc the 64 bit library is being picked up. The 32 bit libraries are installed and linking manually works fine:
> gcc -m32 -o testit testit.c /usr/lib/libX11.so.6
>
Using the -print-file-name option of gcc indicates that libX11.so.6 should be taken from the 32 bit library directories:
> gcc -print-file-name=libX11.so.6 -m32 -o testit testit.c -lX11
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../lib/libX11.so.6
Accounting for the parent directory links, the above file maps to /usr/lib/libX11.so.6 which is the library that I successfully manually linked above. Any ideas on what the problem might be?
Thanks for any help that anyone might offer,
Marie
testit.c ------------------------------------------
/* tesit.c taken from Chris Siebermann's blog
* http://utcc.utoronto.ca/~cks/space/b...singSoSymlinks
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main(void) {
(void) XCreateWindow(0,0,0,0,0,0,0,0,0,0,0,0);
return 0;
}