Problem linking 32-bit lapack on linux 64-bit with intel fortran compiler

Problem linking 32-bit lapack on linux 64-bit with intel fortran compiler

Post by Fric Delan » Sat, 09 May 2009 16:07:27


Hi everybody,

I'm currently trying to compile lapack from source on jaunty 64 bits,
but linking fails on first link with GNU ld.

I followed lapack installation instructions so adapted my make.inc
like the following:
Compilation options:
FORTRAN = ifort -implicitnone
OPTS = -O2
DRVOPTS = $(OPTS)
NOOPT = -g
LOADER = ld
LOADOPTS = --format=elf32-i386 -melf_i386
TIMER = INT_CPU_TIME
(BLASLIB was also adapted, but the compile process doesn't even go
that far)

The first call to ld fails:
( cd INSTALL; make; ./testlsame; ./testslamch; \
./testdlamch; ./testsecond; ./testdsecnd; ./testversion )
make[1]: Entering directory `/home/fred/lapack-3.2.1/INSTALL'
ifort -implicitnone -O2 -c lsame.f -o lsame.o
ifort -implicitnone -O2 -c lsametst.f -o lsametst.o
ld --format=elf32-i386 -melf_i386 -o testlsame lsame.o lsametst.o
ld: warning: cannot find entry symbol _start; defaulting to
0000000008048094

Objects files are both ELF 32-bit LSB relocatable, Intel 80386,
version 1 (GNU/Linux), not stripped

Running ld with --verbose seems to indicate the 32 bits compatibility
libs are used:
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
"elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/x86_64-linux-gnu/lib32"); SEARCH_DIR("/usr/i386-linux-
gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32");
SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i386-linux-gnu/lib");
SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/
lib");

System used:
standard Ubuntu Jaunty x86_64 GNU/Linux
kernel 2.6.28-11
binutils 2.19.1
gcc 4.3.3
libc 2.9.4
Intel Fortran Compiler 9.1
lapack 3.2.1

Can someone please help ? This is driving me mad...

Thanks in advance.

Fric
 
 
 

Problem linking 32-bit lapack on linux 64-bit with intel fortran compiler

Post by Omah » Sun, 10 May 2009 19:19:41

On May 8, 2:07 am, Fric Delanoy < XXXX@XXXXX.COM >


Unless you know quite well what you are doing, using ld _directly_ is
going to create problems. The program entry _start is usually located
in some object files named *crt*.o, and these files are usually quite
specific to the Fortran compiler you use. Often, the _start entry does
some housekeeping and then calls _main, which may call _MAIN, etc. If
these sub-entry points are not called in the proper order, your a.out
will probably crash.

It is best to use the Fortran compiler driver for linking, as it knows
which crt files to link, which libraries to use and in what order.