Error linking libmpichf90.a

While compiling some code, I get the following error message when it tried to link libmpichf90.a.

/usr/bin/ld: skipping incompatible /opt/mpich/p4-pgi/lib/libmpichf90.a when searching for -lmpichf90
/usr/bin/ld: cannot find -lmpichf90

Any ideas/suggestions would be welcome.

Hi jgardner,

Can you please verify which OS and PGI compier your using and what type of architecture your using?

I’m guessing your compiling a 64-bit binary but linking with a mpichf90 library built for a 32-bit Pentium 4 system. In this case, you’ll either need to recompile your MPICH library or compile your source in 32-bits (i.e. “-tp piv”).

Hope this helps,
Mat

OS: x86_64 Linux
PGI: Workstation 6.1
Architecture: AMD Opteron

I can’t say what the libmpichf90.a was originally built for as it came preinstalled.

It’s possible the p4 refers to a Pentium IV, but I think it’s because the mpich was built with the with-device=ch_p4 option. I would have to double check with the supplier who provided the machine to be sure.

Your right. The “p4” most likely refers to ch_p4 not Pentium 4. However, this type of error typically occurs when your trying to link a 32-bit library with a 64-bit application. Use the following command to determine what type of objects are in the library.

objdump -a /opt/mpich/p4-pgi/lib/libmpichf90.a
  • Mat

From the objdump;

In archive /opt/mpich/p4-pgi/lib/libmpichf90.a:

mpi_constants.o: file format elf64-x86-64
rw-r–r-- 0/0 1552 May 16 15:50 2006 mpi_constants.o


mpi1.o: file format elf64-x86-64
rw-r–r-- 0/0 1568 May 16 15:50 2006 mpi1.o


mpi2.o: file format elf64-x86-64
rw-r–r-- 0/0 1568 May 16 15:50 2006 mpi2.o


mpi1__ch_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10384 May 16 15:50 2006 mpi1__ch_s.o


mpi1__ch_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5496 May 16 15:50 2006 mpi1__ch_sv.o


mpi1__ch_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15280 May 16 15:50 2006 mpi1__ch_v2.o


mpi1__ch_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10384 May 16 15:50 2006 mpi1__ch_v.o


mpi1__ch_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5496 May 16 15:50 2006 mpi1__ch_vs.o


mpi1__co4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__co4_s.o


mpi1__co4_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__co4_sv.o


mpi1__co4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:50 2006 mpi1__co4_v2.o


mpi1__co4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__co4_v.o


mpi1__co4_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__co4_vs.o


mpi1__co8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__co8_s.o


mpi1__co8_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__co8_sv.o


mpi1__co8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 16104 May 16 15:50 2006 mpi1__co8_v2.o


mpi1__co8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__co8_v.o


mpi1__co8_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__co8_vs.o


mpi1__in1_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__in1_s.o


mpi1__in1_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__in1_sv.o


mpi1__in1_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 14768 May 16 15:50 2006 mpi1__in1_v2.o


mpi1__in1_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__in1_v.o


mpi1__in1_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__in1_vs.o


mpi1__in2_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__in2_s.o


mpi1__in2_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__in2_sv.o


mpi1__in2_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:50 2006 mpi1__in2_v2.o


mpi1__in2_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:50 2006 mpi1__in2_v.o


mpi1__in2_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:50 2006 mpi1__in2_vs.o


mpi1__in4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__in4_s.o


mpi1__in4_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__in4_sv.o


mpi1__in4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:51 2006 mpi1__in4_v2.o


mpi1__in4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__in4_v.o


mpi1__in4_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__in4_vs.o


mpi1__in8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__in8_s.o


mpi1__in8_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__in8_sv.o


mpi1__in8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:51 2006 mpi1__in8_v2.o


mpi1__in8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__in8_v.o


mpi1__in8_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__in8_vs.o


mpi1__lo1_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo1_s.o


mpi1__lo1_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo1_sv.o


mpi1__lo1_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 14768 May 16 15:51 2006 mpi1__lo1_v2.o


mpi1__lo1_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo1_v.o


mpi1__lo1_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo1_vs.o


mpi1__lo2_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo2_s.o


mpi1__lo2_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo2_sv.o


mpi1__lo2_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:51 2006 mpi1__lo2_v2.o


mpi1__lo2_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo2_v.o


mpi1__lo2_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo2_vs.o


mpi1__lo4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo4_s.o


mpi1__lo4_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo4_sv.o


mpi1__lo4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:51 2006 mpi1__lo4_v2.o


mpi1__lo4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo4_v.o


mpi1__lo4_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo4_vs.o


mpi1__lo8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo8_s.o


mpi1__lo8_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo8_sv.o


mpi1__lo8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15984 May 16 15:51 2006 mpi1__lo8_v2.o


mpi1__lo8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 10024 May 16 15:51 2006 mpi1__lo8_v.o


mpi1__lo8_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5296 May 16 15:51 2006 mpi1__lo8_vs.o


mpi1__re4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9920 May 16 15:51 2006 mpi1__re4_s.o


mpi1__re4_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5248 May 16 15:51 2006 mpi1__re4_sv.o


mpi1__re4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15920 May 16 15:51 2006 mpi1__re4_v2.o


mpi1__re4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9920 May 16 15:51 2006 mpi1__re4_v.o


mpi1__re4_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5248 May 16 15:51 2006 mpi1__re4_vs.o


mpi1__re8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9920 May 16 15:51 2006 mpi1__re8_s.o


mpi1__re8_sv.o: file format elf64-x86-64
rw-r–r-- 0/0 5248 May 16 15:51 2006 mpi1__re8_sv.o


mpi1__re8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 15920 May 16 15:51 2006 mpi1__re8_v2.o


mpi1__re8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9920 May 16 15:51 2006 mpi1__re8_v.o


mpi1__re8_vs.o: file format elf64-x86-64
rw-r–r-- 0/0 5248 May 16 15:51 2006 mpi1__re8_vs.o


mpi2__ch_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9776 May 16 15:51 2006 mpi2__ch_s.o


mpi2__ch_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 22200 May 16 15:51 2006 mpi2__ch_v2.o


mpi2__ch_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9776 May 16 15:51 2006 mpi2__ch_v.o


mpi2__co4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__co4_s.o


mpi2__co4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__co4_v2.o


mpi2__co4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__co4_v.o


mpi2__co8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__co8_s.o


mpi2__co8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23432 May 16 15:51 2006 mpi2__co8_v2.o


mpi2__co8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__co8_v.o


mpi2__in1_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in1_s.o


mpi2__in1_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 21232 May 16 15:51 2006 mpi2__in1_v2.o


mpi2__in1_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in1_v.o


mpi2__in2_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in2_s.o


mpi2__in2_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__in2_v2.o


mpi2__in2_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in2_v.o


mpi2__in4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in4_s.o


mpi2__in4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__in4_v2.o


mpi2__in4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in4_v.o


mpi2__in8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in8_s.o


mpi2__in8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__in8_v2.o


mpi2__in8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__in8_v.o


mpi2__lo1_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo1_s.o


mpi2__lo1_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 21232 May 16 15:51 2006 mpi2__lo1_v2.o


mpi2__lo1_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo1_v.o


mpi2__lo2_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo2_s.o


mpi2__lo2_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__lo2_v2.o


mpi2__lo2_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo2_v.o


mpi2__lo4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo4_s.o


mpi2__lo4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__lo4_v2.o


mpi2__lo4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo4_v.o


mpi2__lo8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo8_s.o


mpi2__lo8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 23056 May 16 15:51 2006 mpi2__lo8_v2.o


mpi2__lo8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9264 May 16 15:51 2006 mpi2__lo8_v.o


mpi2__re4_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9168 May 16 15:51 2006 mpi2__re4_s.o


mpi2__re4_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 22960 May 16 15:51 2006 mpi2__re4_v2.o


mpi2__re4_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9168 May 16 15:51 2006 mpi2__re4_v.o


mpi2__re8_s.o: file format elf64-x86-64
rw-r–r-- 0/0 9168 May 16 15:51 2006 mpi2__re8_s.o


mpi2__re8_v2.o: file format elf64-x86-64
rw-r–r-- 0/0 22960 May 16 15:51 2006 mpi2__re8_v2.o


mpi2__re8_v.o: file format elf64-x86-64
rw-r–r-- 0/0 9168 May 16 15:51 2006 mpi2__re8_v.o


mpi.o: file format elf64-x86-64
rw-r–r-- 0/0 5944 May 16 15:51 2006 mpi.o

Looks like I’m wrong since the library is definately 64-bit. Maybe your compiling in 32-bits? What compile and link options are you using? What’s the output of “pgf90 -V” and “which pgf90”?

  • Mat

l[jgardner@master ~]$ pgf90 -V

pgf90 6.1-5 64-bit target on x86-64 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2006, STMicroelectronics, Inc. All Rights Reserved.

[jgardner@master ~]$ which pgf90
/opt/pgi/linux86-64/6.1/bin/pgf90


I really appreciate all the help.

What compile and link options are you using? In particular, I’m looking for the “-tp” option which indicates the target architecture. I’m wondering if you have inadvertently compiled in 32-bits using “-tp p6”, “-tp k8-32”, or other 32-bit architecture flag. You can also use “objdump -a” on your application’s objects to see if they are 32 or 64-bits.

If this isn’t it, then I’ll need to do some research since the only time I’ve ever seen this error is when I’ve tried to link 32 and 64-bit objects together.

  • Mat

The “-tp” option was “-tp athlonxp”.

I removed that and it compiled and linked properly. Thanks a ton for your help.

I suffer the similar problem when I tried to use the mpif90 which is compiled by pgf95 to compile some f90 program.
Ths system feedback as following:

/home/hychuang/opt/mpich/pgi_sevrve/lib/libmpichf90.a(mpi2__ch_s.o)(.text+0x3f): In function mpi2__character_s_mpi_file_iread_t_': : undefined reference to mpi_file_iread_’

I checked my pgf95 version with pgf95 -V
The system feedback as : pgf95 6.2-5 64-bit target on x86-64 Linux

I checked pgf95 with command which pgf95
I got : ~/opt/pgi_sevrve/linux86-64/6.2/bin/pgf95

I used the command coredump -a on file libmpichf90.a and I got the message like Jgardner refered

But I don’t understand how to do the action that Jgardner mentioned.
Could anyone help me to solve it ?
I’ll very appreciate any suggestion.

Hi hyc,

jgardner’s issue was that he had compiled his MPICH library in 64-bits but was trying to link it with a 32-bit object. In your case, the linker can not find the symbol “mpi_file_iread_”. This symbol should be in the “libmpich.a” library so try the following:

  1. Check that “/home/hychuang/opt/mpich/pgi_sevrve/lib/libmpich.a” exists and that it’s being added to the link line after libmpichf90.a. You can add “-v” (verbose) to the link line to see the exact options given to the linker.

  2. If “libmpich.a” exists, determine if the symbol is in the library using the command: “nm libmpich.a | grep mpi_file_iread”. If nothing is printed, then you need to build ROMIO. Otherwise, note the number of underscores after the symbol name.

  3. If the number of underscores is zero or two, then you need to reconfigure and rebuild your MPICH library using the configure option “-fortnames=FORTRANUNDRESCORE”.

Hope this helps,
Mat

Hi~, mkcolg

It’s a great help of your reply, and I reconfigurated my MPICH with command as follow:
./configure --prefix=/home/hychuang/opt/mpich/pgi -cc=“gcc” -cflags="-O"
-fc=“pgf77 -Mx,119,0x200000” -fflags="-O" -f90=“pgf90 -Mx,119,0x200000” -f90flags="-O" --with-romio -fortnames=FORTRANUNDRESCORE

Than I tried the command “nm libmpich.a | grep mpi_file_iread”, and I got the feedback as follow:
0000000000000000 W mpi_file_iread_
0000000000000000 T pmpi_file_iread_
0000000000000000 W mpi_file_iread_at_
0000000000000000 T pmpi_file_iread_at_
0000000000000000 W mpi_file_iread_shared_
0000000000000000 T pmpi_file_iread_shared_

And I can’t compile mpi program with mpif90 which is compiled by pgf90.

Should I try another MPI version? or I did something wrong?

Thanks a lot for your kindly help.

Hi hyc,

Looks like I made a typo. It should be “-fortnames=FORTRANUNDERSCORE” not “-fortnames=FORTRANUNDRESCORE”.

However, the library is being compiled correctly. The problem is that your using the xbit “-Mx,129,0x2000000” which is documented as “-Msecond_underscore”. This flag appends a second underscore to fortran symbol names in order to match g77’s behavior. Try removing this flag, reconfigure and recompile.

  • Mat

Hi, Mat

Sorry, it seems have some problem.
I tried to executed the binary files compiled with PGI and MPICH.1.2.7,
some of them worked, but some of them give me the error message as following:
[0] MPI Abort by user Aborting program !
Initpm: Error in MPI_comm_rank -4294967296
[0] Aborting program!
p0_6250: p4_error: : 1

Could you give me any suggestion again?
I really appreciate your great help.

Of hand, I don’t know what could be wrong. Do you have access to an MPI debugger such as PGDBG or totalview?

  • Mat