I have been trying to build a simple “hello world” fortran program using the -tp p7 option but the executable does not run a just gives a “segmentation fault”. I receive a lot of messages from /usr/bin/ld which skips some libraries as “incompatible” and for some other /usr/bin/ld: warning: i386:x86-64 architecture of input file…is incompatible with i386 output" . On the other hand a c program using “gcc -m32” runs just fine.This is obviously related to the libraries but I have no clue about how to resolve it. Any help will be wellcome,
Can you please post a example of the error compiled with the “-v” flag as well as any other flags that you use? For example “pgf90 -v -tp p7 hello.f”. Also, what OS are you using and which compiler version do you have?
I am using the latest Debian release with kernel 2.6.18 on a dual core dual processor machine and I need to move some executable to our 32 bit machines.
Here are the results of the compilation. Some prompts are localized in spanish but are probable understable enough without much translation, so just two examples:
saltando el /usr/lib/librt.a incompatible mientras se buscaba
means something like
jumping (overlooking?) …incompatible while looking something like…
aviso: la arquitectura i386:x86-64 del fichero de entrada `/usr/lib/crtn.o’ es incompatible con la salida i386
warning: i386:x86-64 architecture of input file…is incompatible with i386 output
/usr/bin/ld /usr/lib/crt1.o /usr/lib/crti.o /opt/pgi/linux86/7.0-4/lib/trace_init.o /usr/lib/gcc/x86_64-linux-gnu/4.1.2/32/crtbegin.o /opt/pgi/linux86/7.0-4/lib/pgfmain.o -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /opt/pgi/linux86/7.0-4/lib/pgi.ld -L/opt/pgi/linux86/7.0-4/lib -L/usr/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/32 -rpath /opt/pgi/linux86/7.0-4/lib /tmp/pgf77DhWhxn9p8kNf.o -lpgftnrtl -lpgsse1 -lpgsse2 -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.1.2/32/crtend.o /usr/lib/crtn.o
/usr/bin/ld: saltando el /usr/lib/librt.so incompatible mientras se buscaba -lrt
/usr/bin/ld: saltando el /usr/lib/librt.a incompatible mientras se buscaba -lrt
/usr/bin/ld: saltando el /usr/bin/…/lib/librt.so incompatible mientras se buscaba -lrt
/usr/bin/ld: saltando el /usr/bin/…/lib/librt.a incompatible mientras se buscaba -lrt
/usr/bin/ld: saltando el /usr/lib/libpthread.so incompatible mientras se buscaba -lpthread
/usr/bin/ld: saltando el /usr/lib/libpthread.a incompatible mientras se buscaba -lpthread
/usr/bin/ld: saltando el /usr/bin/…/lib/libpthread.so incompatible mientras se buscaba -lpthread
/usr/bin/ld: saltando el /usr/bin/…/lib/libpthread.a incompatible mientras se buscaba -lpthread
/usr/bin/ld: saltando el /usr/lib/libm.so incompatible mientras se buscaba -lm
/usr/bin/ld: saltando el /usr/lib/libm.a incompatible mientras se buscaba -lm
/usr/bin/ld: saltando el /usr/bin/…/lib/libm.so incompatible mientras se buscaba -lm
/usr/bin/ld: saltando el /usr/bin/…/lib/libm.a incompatible mientras se buscaba -lm
/usr/bin/ld: saltando el /usr/lib/libc.so incompatible mientras se buscaba -lc
/usr/bin/ld: saltando el /usr/lib/libc.a incompatible mientras se buscaba -lc
/usr/bin/ld: saltando el /usr/bin/…/lib/libc.so incompatible mientras se buscaba -lc
/usr/bin/ld: saltando el /usr/bin/…/lib/libc.a incompatible mientras se buscaba -lc
/usr/bin/ld: aviso: la arquitectura i386:x86-64 del fichero de entrada /usr/lib/crt1.o' es incompatible con la salida i386 /usr/bin/ld: aviso: la arquitectura i386:x86-64 del fichero de entrada /usr/lib/crti.o’ es incompatible con la salida i386
/usr/bin/ld: aviso: la arquitectura i386:x86-64 del fichero de entrada `/usr/lib/crtn.o’ es incompatible con la salida i386
Unlinking /tmp/pgf771hWhFb1Qm7py.s
Unlinking /tmp/pgf77DhWhxn9p8kNf.o
We expect that the directory “/usr/lib” contains only 32-bit libraries and the directory “/usr/lib64” containing 64-bit libraries. On your system, it seems that there are 64-bit libraries in “/usr/lib” so I wondering if your 32-bit libraries are in “/usr/lib/32”.
What is the output of “gcc -v -m32 hello.c” where hello.c can be any C source? Also, please post the contents of the file “/opt/pgi/linux86/7.0-4/bin/localrc”.
Here is the gcc compilation. The resulting executable runs fine both in the i686 and the x86_64 computers.
\
gcc -v -m32 hello.c
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: …/src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/cc1 -quiet -v -imultilib 32 hello.c -quiet -dumpbase hello.c -m32 -mtune=k8 -auxbase hello -version -o /tmp/cclGl5kW.s
ignoring nonexistent directory “/usr/local/include/i486-linux-gnu”
ignoring nonexistent directory “/usr/lib/gcc/x86_64-linux-gnu/4.1.2/…/…/…/…/x86_64-linux-gnu/include” include “…” search starts here: include <…> search starts here:
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/include
/usr/include/i486-linux-gnu
/usr/include
End of search list.
GNU C version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) (x86_64-linux-gnu)
compiled by GNU C version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0907c2444d7f564600fdf68452ce9f76
as -V -Qy --32 -o /tmp/ccT29RGm.o /tmp/cclGl5kW.s
GNU ensamblador versión 2.17 (x86_64-linux-gnu) utilizando BFD versión 2.17 Debian GNU/Linux
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.1.2/…/…/…/…/lib32/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.1.2/…/…/…/…/lib32/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.1.2/32/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/32 -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/32 -L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/…/…/…/…/lib32 -L/lib/…/lib32 -L/usr/lib/…/lib32 /tmp/ccT29RGm.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.1.2/32/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.1.2/…/…/…/…/lib32/crtn.o
The content of localrc is as follows
less /opt/pgi/linux86/7.0-4/bin/localrc
set LFC=-lg2c;
set LDSO=/lib/ld-linux.so.2;
set GCCDIR=/usr/lib/gcc/x86_64-linux-gnu/4.1.2/32;
set GCCINC=/usr/lib/gcc/x86_64-linux-gnu/4.1.2/include;
set G77DIR=/usr/lib/gcc/x86_64-linux-gnu/3.4.6//32;
set OEM_INFO=32-bit target on x86-64 Linux;
set LOCALRC=YES;
set THROW=__THROW=;
set EXTENSION=extension=;
set LC=$if(-Bstatic,-lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc, -lgcc -lc -lgcc);
set DEFLIBDIR=/usr/lib;
set DEFSTDOBJDIR=/usr/lib;
set EXTRAASARGS=–32;
Thanks a lot . The hellow.f runs now fine both in the original x86_64 computer and when moved to a i686 machine (once the portability libraries have been installed of course).
My next step is to move to a something bigger compilation (gaussian…)I’m crossing my fingers…
Thanks a lot for your help.