semi-newbie | provs linking 32-bit lib on x86_64

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

 



Apologies if this ends up being double-posted. Tried submitting from another account, but it doesn't seem to have been pushed out...

--------------------------

I'm having some problems compiling/linking a 32-bit application on my Opteron (x86_64) box that is currently running Fedora 11 (with both 64- and 32-bit dev libs installed). Compilation works perfectly for the 64-bit version, but not the 32-bit. System runs gcc 4.4.1. Code is actually FORTRAN (using gfortran as compiler), but that isn't the issue. I also note that it all worked fine under Fedora 9 - I could built 32- and 64-bit apps without a problem.

Here is the compilation sequence (which again works perfectly for 64-bit).

1. compile Linpack library. Here is the makefile

COMPILER = gfortran
COPTIONS = -c -m32 -O2
Linpack.a:
$(COMPILER) $(COPTIONS) *.f
ar q Linpack.a *.o


make runs fine. No errors for either 64- or 32-bit.

2. cp Linpack.a ../libLinpack.a (i.e., rename and copy it into root directory containing the main program, which needs to be linked against Linpack).


3. rm *.o, *.mod files, then run make. Here is the basic elements of the makefile

COMPILER = gfortran
LINKER = gfortran
COPTIONS = -c -m32 -fimplicit-none -fbounds-check -O2
OBJECTS = mark.o btest.o cvtcas.o headng.o \
<bunch of other *.o files deleted to save space>
mms1: mms1.f $(OBJECTS) MODELC STATUS
$(LINKER) *.o -o mms1 -L/home/me/Desktop/linMMS1/src-gfortran-6.x -lLinpack
mms1.o: mms1.f HEADST MODELC STATUS
$(COMPILER) $(COPTIONS) mms1.f
hyperdist.mod: hyperdist.f
$(COMPILER) $(COPTIONS) hyperdist.f
<sutff deleted>

Compilation of the 40-50 individual *.f files proceeds without error. The problem arises at the linker step. I get the following error messages:

gfortran *.o -o mms1 -L/home/me/Desktop/linMMS1/src-gfortran-6.x -lLinpack
/usr/bin/ld: skipping incompatible /home/me/Desktop/linMMS1/src-gfortran-6.x/libLinpack.a when searching for -lLinpack
/usr/bin/ld: cannot find -lLinpack
collect2: ld returned 1 exit status
make: *** [mms1] Error 1

Well, the library libLinpack.a is definitely there, and was compiled with -m32, so I'm not sure at all what the problem is - especically, why it is incompatible. As noted, this problem only happens when I try 32-bit compilation. I tried adding -m32 to the linker call ($(LINKER) -m32 *.o -o mms1 -L/home/me/Desktop/linMMS1/src-gfortran-6.x -lLinpack), but that didn't change a thing. But, it did generate a new error message:

gfortran -m32 *.o -o mms1 -L/home/me/Desktop/linMMS1/src-gfortran-6.x -lLinpack
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
make: *** [mms1] Error 1

Suggestions? Points to the obvious?

Thanks!

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux