Skip to content

Can't find -lgfortran while installing OpenBLAS from source #604

Closed

Description

@AmNotGod

Hey, I want to use OpenBLAS to accelerate my deep learning program. However, there is something wrong when I tried to install OpenBLAS from source.


cblas_zher2 PASSED THE TESTS OF ERROR-EXITS

cblas_zher2 PASSED THE COMPUTATIONAL TESTS ( 577 CALLS)
cblas_zher2 PASSED THE COMPUTATIONAL TESTS ( 577 CALLS)

cblas_zhpr2 PASSED THE TESTS OF ERROR-EXITS

cblas_zhpr2 PASSED THE COMPUTATIONAL TESTS ( 577 CALLS)
cblas_zhpr2 PASSED THE COMPUTATIONAL TESTS ( 577 CALLS)

END OF TESTS
make[1]:正在离开目录 /home/amax/temp/OpenBLAS-0.2.14/ctest' make[1]: 正在进入目录/home/amax/temp/OpenBLAS-0.2.14/exports'
perl ./gensymbol linktest x86_64 _ 0 0 0 0 0 0 "" "" > linktest.c
gcc -O2 -Wall -m64 -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=24 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME="_" -DCHAR_CNAME="" -DNO_AFFINITY -I.. -shared -o ../libopenblas_sandybridgep-r0.2.14.so
-Wl,--whole-archive ../libopenblas_sandybridgep-r0.2.14.a -Wl,--no-whole-archive
-Wl,-soname,libopenblas.so.0 -lm -lpthread -lgfortran -lm -lpthread -lgfortran
/usr/bin/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
make[1]: *** [../libopenblas_sandybridgep-r0.2.14.so] 错误 1
make[1]:正在离开目录 `/home/amax/temp/OpenBLAS-0.2.14/exports'
make: *** [shared] 错误 2
amax@amaxa311:/temp/OpenBLAS-0.2.14$ gcc
gcc: fatal error: no input files
compilation terminated.
amax@amaxa311:
/temp/OpenBLAS-0.2.14$ gcc --version
gcc (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


The gcc version on my computer is 4.64 and I am really sure that gfortran has been installed.


/usr/bin/gfortran
/usr/bin/gfortran-4.8
/usr/bin/x86_64-linux-gnu-gfortran
/usr/bin/x86_64-linux-gnu-gfortran-4.8
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.spec
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortranbegin.a
/usr/lib/python2.7/dist-packages/numpy/distutils/mingw/gfortran_vs2003_hack.c
/usr/lib/python3/dist-packages/numpy/distutils/mingw/gfortran_vs2003_hack.c
/usr/lib/scons/SCons/Tool/gfortran.py
/usr/lib/scons/SCons/Tool/gfortran.pyc
/usr/lib/x86_64-linux-gnu/libgfortran.so.3
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0


Any help will be appliciated!

Activity

  1. xianyi commented on Jul 23, 2015

    @xianyi
    Collaborator

    @AmNotGod , I think you don't need LAPACK functions. Thus, please make NO_LAPACK=1 without link -lgfortran.

  2. AmNotGod commented on Jul 24, 2015

    @AmNotGod
    Author

    It is really helpful. I have solved my problem, thank you so much!

  3. tcfuji commented on Feb 17, 2016

    @tcfuji

    Ran into this problem too. Should NO_LAPACK=1 be the default?

  4. martin-frbg commented on Feb 20, 2016

    @martin-frbg
    Collaborator

    @tcfuji: If you run into this problem, there is something wrong with your fortran compiler environment (probably missing a seperate gfortran-devel or libgfortran-dev package). NO_LAPACK makes sense as a workaround when it is clear that the only project you need openblas for does not require any of the lapack functions (the only components you would need a working fortran compiler for).

  5. nardis-miles commented on Oct 4, 2025

    @nardis-miles

    For those who do need Lapack, Just a rejoinder. I finally got OpenBLAS to build today, 10/04/2025, by changing two rules in Makefile.rule to
    CC = gcc-12
    FC = gfortran-12
    It seems that it's cc that couldn't find libgfortran.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions