1

I am trying to compile a Fortran program using gfortran. However, upon compilation, I get the following output:

rpower@kaladin:~/Downloads/testfort$ gfortran program.f90 -o program
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/libquadmath.so when searching for -lquadmath

I have not experienced this error before. The compilation call generates an executable which when passed to ldd gives:

rpower@kaladin:~/Downloads/testfort$ ldd ./program
    linux-vdso.so.1 (0x00007ffc815e6000)
    libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f621bb5f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f621b937000)
    libquadmath.so.0 => not found
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f621b850000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f621b830000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f621be57000)

So it is unable to find a suitable library. However, I found that I do, in fact, have the library in question

rpower@kaladin:~/Downloads/testfort$ file /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, with debug_info, not stripped

But as you can see, it is a 32 bit ELF which is why when I try to run the program, I get

rpower@kaladin:~/Downloads/testfort$ ./program
./program: error while loading shared libraries: libquadmath.so.0: wrong ELF class: ELFCLASS32

I like to think that I'm a reasonably competent linux user, but I'm very confused here. The libquadmath library is brought down with just the standard gfortran installation and I'm very confused why it would be a 32-bit ELF. Any guidance here would be much appreciated. I cannot find a way to install a 64 bit version...

2
  • Maybe try reinstalling libquadmath? sudo apt install --reinstall libquadmath0
    – Terrance
    Sep 27, 2022 at 1:40
  • @Terrance That worked, thank you! I'm confused as to how that first one was installed. I'm not doing anything fancy haha Sep 27, 2022 at 1:44

1 Answer 1

1

Well, I'm glad this is fixed, but feel kind of dumb. Terrance solve the problem. I reinstalled the library with

sudo apt install --reinstall libquadmath0

And now, we successfully compile and it links against the now 64 bit version of the library. I am perplexed as how I got that 32 bit one in the first place.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .