Problem with libraries and ld in 64 bit machine

I am trying to compile a simple helloworld fortran program with pgi 10.8 on a gentoo 64 bit machine and trying to compile a 64bit binary (pgf90 -m64 hello.f) I get the following error message:

/usr/bin/ld: skipping incompatible /usr/lib32/librt.so when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib32/librt.a when searching for -lrt
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib32/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib32/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib32/libc.a when searching for -lc
/usr/bin/ld: i386 architecture of input file /usr/lib32/crt1.o' is incompatible with i386:x86-64 output /usr/bin/ld: i386 architecture of input file /usr/lib32/crti.o’ is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `/usr/lib32/crtn.o’ is incompatible with i386:x86-64 output
/usr/bin/ld: final link failed: Invalid operation

glibc version: 2.11.2
gcc version: 4.4.3
localrc:
set LFC=-lgfortran;
set LDSO=/lib64/ld-linux-x86-64.so.2;
set GCCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3;
set GCCINC=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include;
set G77DIR=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/;
set OEM_INFO=64-bit target on x86-64 Linux $INFOTPVAL;
set LOCALRC=YES;
set THROW=__THROW=;
set EXTENSION=extension=;
set LC=$if(-Bstatic,-lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc, -lgcc -lc -lgcc);

GLIBC version 2.11.2

GCC version 4.4.3

set GCCVERSION=40403;
set DEFLIBDIR=/usr/lib32;
set DEFSTDOBJDIR=/usr/lib32;
export PGI=/usr/local/pgi;

makelocalrc executed by root Wed Sep 8 12:31:08



Any ideas what might be wrong? Thanks for any help

OK, I was able to figure out what the problem was. This was very tricky.

  1. I installed pgi2010(v10.8) with installation script. No complains or messages at any step.

  2. I modified /usr/local/pgi/linux86-64/10.8/bin/localrc

from (as was set by the installation script)
set DEFLIBDIR=/usr/lib32;
set DEFSTDOBJDIR=/usr/lib32;

to

set DEFLIBDIR=/usr/lib;
set DEFSTDOBJDIR=/usr/lib;

Now pgf90 works fine for the helloworld program. It compiles producing both 64 bit and 32 bit code(pgf90 -m32)

Hi illhuicac,

We don’t test installations on Gentoo but there’s obviously something unique that’s causing the installer find the wrong library directory. I’ve added a technical problem report (TPR#17221) for the issue. We should be able to install Gentoo here and determine the problem.

Which version of Gentoo are you using?

Thanks,
Mat

Just had the same issue here, x86_64 machine. Suggested fix worked.