Linker Skips Incompatible Libraries for Unknown Reason

Hi, I have set up a personal computing environment on an online server in which I have no root control, and within it set up gcc 8.4, openmpi, OpenBlas, and Scalapack.

Using this environment to compile in parallel, I get up to this mpif90 command:

mpif90 -O3 -I… -I/home/cs502/local/include -DFLUSH -DNOFOX -DMPI -c …/blas.F90

After that there is another mpif90 command that links a whole series of object files (I’ve added this extra information as I’m unsure if it’s relevant). Then after this command it all appears to go wrong and prints this to the screen:

/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libgfortran.so when searching for -lgfortran
/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libgfortran.a when searching for -lgfortran
/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libgcc_s.so.1 when searching for libgcc_s.so.1
/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libquadmath.so when searching for -lquadmath
/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libquadmath.a when searching for -lquadmath
/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libgcc_s.so.1 when searching for libgcc_s.so.1
/usr/bin/ld: skipping incompatible /home/cs502/local/lib/libgcc_s.so.1 when searching for libgcc_s.so.1

Followed by a whole series of undefined reference errors such as:

m_simplex.o: In function __m_simplex_MOD_start':* *m_simplex.F90:(.text+0x185): undefined reference to dcopy_’
m_simplex.o: In function __m_simplex_MOD_setstp':* *m_simplex.F90:(.text+0x369): undefined reference to dscal_’
m_simplex.F90:(.text+0x45c): undefined reference to dasum_'* *m_simplex.F90:(.text+0x472): undefined reference to dasum_’
m_simplex.o: In function __m_simplex_MOD_calcc':* *m_simplex.F90:(.text+0xfd2): undefined reference to dcopy_’
m_simplex.F90:(.text+0x1015): undefined reference to daxpy_'* *m_simplex.F90:(.text+0x1050): undefined reference to dscal_’
m_simplex.o: In function __m_simplex_MOD_simplx':* *m_simplex.F90:(.text+0x1b0a): undefined reference to dcopy_’
m_simplex.F90:(.text+0x1d22): undefined reference to dcopy_'* *m_simplex.F90:(.text+0x1d75): undefined reference to dcopy_’
m_simplex.o: In function __m_simplex_MOD_subplx':* *m_simplex.F90:(.text+0x2282): undefined reference to dcopy_’
m_simplex.F90:(.text+0x22ab): undefined reference to dcopy_'* *m_simplex.o:m_simplex.F90:(.text+0x266e): more undefined references to dcopy_’ follow
m_conjgr.o: In function __m_conjgr_MOD_conjgr':* *m_conjgr.F90:(.text+0x209): undefined reference to ddot_’
m_conjgr.F90:(.text+0x28c): undefined reference to ddot_'* *m_conjgr.F90:(.text+0x3b3): undefined reference to ddot_’
m_conjgr.F90:(.text+0x54c): undefined reference to ddot_'* *m_conjgr.F90:(.text+0x56d): undefined reference to ddot_’

I presume this is related to the fact it couldn’t find a compatible library. However, on searching I haven’t found anything which points to what the issue might be! Is there anything within this output which makes it clear what the issue with my environment is?

Also in case it helps, the entire program compiles just fine in serial. When trying to run though I get this error:

/gulp: error while loading shared libraries: libgfortran.so.5: wrong ELF class: ELFCLASS32

Thanks for any help!

Hi Connor.
Without knowing the specifics of your system and having access to it, it’s hard to know exactly what the specific solution is, but here are some pointers:

  1. The messages about “skipping” seem to be advisory as there are multiple versions of gfortran in your load path and so the compiler is trying to find the right version (and mentions all the failures along the way). I think you should be able to ignore these.
  2. The “undefined reference” errors mean that you need to set the system-specific information that allows the compilation of GULP to find the appropriate versions of the maths libraries. If you look for the following in mkgulp:

# Provide the location and name of Scalapack, Blacs, Pblas, Lapack and Blas libraries.
# On the Mac the following is sufficient when using Macports:
#–USER–Start
echo 'SLIBS=-L/opt/local/lib -lscalapack ’ >> makefile
echo 'MLIBS= ’ >> makefile
#–USER–End

You need to change the path after the -L flag to set the directory where the maths libraries are. Could be /usr/local/lib but this depends on the specifics of your machine. You then need to specify the library name. So if the library is libscalapack.a or libscalapack.so then you add -lscalapack (i.e. remove the lib and extension and prefix with -l). You need to make sure that you include the libraries for Scalapack, Blacs, PBlas, Lapack and Blas. These may not all be in separate libraries (for example on the Mac linking scalapack is sufficient), but you might need to add all of them separately. If something is “undefined” then look do an on-line search to find out what library it is part of and then add this library to mkgulp until you have resolved all the dependencies.

Hope that helps, Julian

1 Like

Hi Julian.

Thanks very much! That worked perfectly, I added a -L path to the open blas library in the SLIBS as you suggested and it compiled just fine, and also runs just fine!

Hopefully the last question I’ll ever have to ask about compiling on a server! :rofl: Thanks very much for your patience, and advice! Greatly appreciated.

Have a great day!

Connor

Hi Connor. No worries - glad that it’s all working, Julian