32-bit libg2c
I'm trying to compile and link a third-part C/Fortran program in 32-bit mode on a 64-bit machine. I get the following error from the linker:
Code:
/usr/bin/ld: cannot find -lg2c Code:
> locate libg2c If so, then I need to install a 32-bit version of libg2c, but I don't know how. I did a "yum list | grep g2c" but that didn't find anything. How can I install a 32-bit version of libg2c? |
You are right in assuming that you need the 32 bit version of lib32g2c. I do not have an rpm based system, but I can tell you that libg2c is part of gcc's fortran (gcc-g77) package, so you would have to install the 32 bit version of that package.
--Brennan |
"yum list | grep g2c" → → A precise command is :
# yum provides */libg2c* compat-libf2c-34-3.4.6-4.i386 /usr/lib/libg2c.so.0 (=>libg2c.so.0.0.0) compat-gcc-34-g77-3.4.6-4.i386 /usr/lib/gcc/i386-redhat-linux/3.4.6/libg2c.so /usr/lib/gcc/i386-redhat-linux/3.4.6/libg2c.a Either can be used ( or both ). The 32-bit g77 will know, how to find its own libg2c.so , but for other applications a link in /usr/lib/ is required. Like this : cd /usr/lib/ # ln -s libg2c.so.0.0.0 libg2c.so Or # ln -s gcc/i386-redhat-linux/3.4.6/libg2c.so ..... The above examples are from a 32-bit OS. EL5. ..... |
Quote:
Anyway, I installed compat-libf2c-34-3.4.6-4.i386, then did an "updatedb", made sure it's location is in my LD_LIBRARY_PATHm, and "locate libg2c" does find several libg2c files: Code:
> locate libg2c Code:
/usr/bin/ld: cannot find -lg2c |
One more note, I didn't mention that the linker also complains
Code:
/usr/bin/ld: skipping incompatible /usr/lib/libg2c.so when searching for -lg2c Code:
> file /usr/lib/libg2c.so Code:
ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped |
I think I figured out the problem. Although each object file was compiled in 32-bit mode, the Makefiles did not specify an -m32 flag for the linker, so the linker was linking in 64-mode and that's why the 32-bit /usr/lib/libg2c.so was incompatible. At least that's the best explanation I can think of.
|
Yes, to link 32 bit programs, you will also need
a 32 bit linker ( ld ). And I don't know, how to do that on RHEL / CentOS. Probably binutils-devel-2.17.50.0.6-12.el5.i386 > binutils-devel.i386, which is available in the x86_64 repo. ..... P.S. : "Not stripped" is just a standard information. Shared libraries are not stripped. Binaries are. http://www.ncsa.illinois.edu/UserInf...mds5/strip.htm ..... |
All times are GMT -5. The time now is 12:47 PM. |