I install torch 7 on ubuntu 16.04 following the official site instructions, but it fails when compiling the OpenBLAS. Can anyone help to fix this problem?
make[1]: Leaving directory '/tmp/OpenBLAS/ctest'
make[1]: Entering directory '/tmp/OpenBLAS/exports'
perl ./gensymbol linktest x86_64 _ 0 0 0 0 0 0 "" "" 1 > linktest.c
gcc -O2 -DMAX_STACK_ALLOC=2048 -fopenmp -Wall -m64 -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=16 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -DNO_AFFINITY -I.. -shared -o ../libopenblas_haswellp-r0.2.20.dev.so \
-Wl,--whole-archive ../libopenblas_haswellp-r0.2.20.dev.a -Wl,--no-whole-archive \
-Wl,-soname,libopenblas.so.0 -lm -lpthread -lgfortran -lm -lpthread -lgfortran
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
Makefile:133: recipe for target '../libopenblas_haswellp-r0.2.20.dev.so' failed
make[1]: * [../libopenblas_haswellp-r0.2.20.dev.so] Error 1
make[1]: Leaving directory '/tmp/OpenBLAS/exports'
Makefile:85: recipe for target 'shared' failed
make: * [shared] Error 2
Error. OpenBLAS could not be compiled
/usr/bin/ld: cannot find -lgfortran
Looks like your Ubuntu is missing a gfortran-dev package, or perhaps your gcc and gfortran are different
release versions, confusing the build system about where to find the libraries. What version numbers do
"gcc --version" and "gfortran --version" return ?
See https://github.com/JuliaLang/julia/issues/6150 for a similar question (but ignore the part of the discussion where it drifts off into problems with "llvm"), and #954 where the problem was indeed a mismatch of gcc and gfortran versions.
@martin-frbg thanks for your suggestions. I followed #954 and installed gfrtran-4.9 through sudo apt-get install gfortran-4.9 since my "gcc --version" returns 4.9.3, then it's OK.
Can you close the issue?
I suggest to add compilers version consistency check inside the Makefile.
What is the best version match for Xcode + gfortran?
Most helpful comment
@martin-frbg thanks for your suggestions. I followed #954 and installed
gfrtran-4.9throughsudo apt-get install gfortran-4.9since my "gcc --version" returns 4.9.3, then it's OK.