Installation fails: /usr/bin/ld: cannot find -lgfortran

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)

Installation fails: /usr/bin/ld: cannot find -lgfortran

Postby Klausb » Sat Oct 07, 2017 5:31 pm


I have been trying to install magma on Ubuntu 16.04 with cuda-9.0, gcc/g++ 6.3 and gfortran

The problem is, the installation fails due to: /usr/bin/ld: cannot find -lgfortran

-lgfortran usually refers to the shared library which is not in /usr/bin, there's the gfortran binary is a link in /usr/lib/gcc/x86_64-linux-gnu/5 is a link in /usr/lib/x86_64-linux-gnu is the actual shared library in /usr/lib/x86_64-linux-gnu

I added -L$/usr/lib/gcc/x86_64-linux-gnu/5 in

Code: Select all
LIBDIR    = -L$(CUDADIR)/lib64 \
            -L$(MKLROOT)/lib/intel64 \

AND even copied to /usr/bin

But nothing had an effect.


Code: Select all
magmablas/dsyrk_vbatched.o magmablas/cherk_vbatched.o magmablas/csyr2k_vbatched.o magmablas/csyrk_vbatched.o magmablas/strmm_vbatched.o magmablas/dtrmm_vbatched.o magmablas/ctrmm_vbatched.o magmablas/strsm_vbatched.o magmablas/dtrsm_vbatched.o magmablas/ctrsm_vbatched.o magmablas/spotf2_kernels_var.o magmablas/dpotf2_kernels_var.o magmablas/cpotf2_kernels_var.o \
   -L./lib -L/usr/local/cuda-9.0/lib64 -L/opt/intel/mkl/lib/intel64 -Lusr/lib/x86_64-linux-gnu -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lstdc++ -lm -lgfortran -lcublas -lcusparse -lcudart -lcudadevrt
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
Makefile:605: die Regel für Ziel „lib/“ scheiterte
make: *** [lib/] Fehler 1

How should I add the library path for to so the compiler finds it during compilation?

Posts: 19
Joined: Thu Oct 05, 2017 3:04 pm

Solved: Installation fails: /usr/bin/ld: cannot find -lgfort

Postby Klausb » Sun Oct 08, 2017 6:22 am

just for the record, the problem was caused by a mismatch of gcc/g++ <> gfortran compiler versions, updating gfortran is the fix
Posts: 19
Joined: Thu Oct 05, 2017 3:04 pm

Return to User discussion

Who is online

Users browsing this forum: No registered users and 3 guests