Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined reference to '_gfortran_concat_string' #460

Closed
johnmoore4 opened this issue Oct 31, 2014 · 5 comments
Closed

Undefined reference to '_gfortran_concat_string' #460

johnmoore4 opened this issue Oct 31, 2014 · 5 comments
Labels

Comments

@johnmoore4
Copy link

Hi developers,

I am trying to link my binary statically (i.e. with the -static flag in gcc) to OpenBLAS, but I get the following error (among others):

/home/john/local/OpenBLAS/install/lib/libopenblas.a(sgesvd.o): In function sgesvd_': sgesvd.f:(.text+0x35f): undefined reference to_gfortran_concat_string'

I'm compiling with the following linking flags:
"-static-libgfortran -static-libgcc -static-libstdc++ -lpthread -Wl,--whole-archive -libverbs -Wl,--no-whole-archive -ldl"

I've tried everything I can think of, and hav been stuck on this issue for days. If I simply remove -static-libgfortran and replace it with -lgfortran, everything works fine. So, it seems like the dynamic version of libgfortran is linked to some other libraries.

I have verified that I have the static version of the libraries listed in the above linking command, so that shouldn't be the issue. Also, this only seems to effect the LAPACK routines, not BLAS.

Do you have any idea what might be going on or suggestions for me to try?

I'm compiling with gcc 4.8.1 un Ubuntu 14.04, if that helps.

Thank you for your time!

@xianyi xianyi changed the title Undefined reference to Undefined reference to Oct 31, 2014
@johnmoore4 johnmoore4 changed the title Undefined reference to Undefined reference to '_gfortran_concat_string' Oct 31, 2014
@tkelman
Copy link
Contributor

tkelman commented Oct 31, 2014

@johnmoore4 the -static-libgfortran flag hasn't worked properly for a while, because libgfortran depends on libquadmath since gcc somewhere around 4.5. Try spelling out the full paths to libgfortran.a and libquadmath.a.

@johnmoore4
Copy link
Author

I've tried explicitly linking to the static libraries, and still the same issue. After looking into it a bit more, I found that I had several versions of the gcc/gfortran libraries installed. Therefore, when I used the -lgfortran flag without the -static flag, the compiler was linking to an older version of the static library (i.e. gcc 4.3) which appears to work with openblas.

However, the newer versions of gfortran (4.5+) do not seem to be compatible with OpenBLAS due to deprecated references to _gfortran_concat_string. Can someone else confirm this?

@xianyi
Copy link
Collaborator

xianyi commented Nov 2, 2014

@johnmoore4 ,
Why not just use -static as following gcc -static -O3 -o test test.c /your_path/OpenBLAS/libopenblas.a -lgfortran -lpthread -lm ?

@xianyi
Copy link
Collaborator

xianyi commented Nov 2, 2014

I link the test with /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a, which works fine.

gcc -o test  test.c /your_path/OpenBLAS/libopenblas.a /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a -static-libgcc -static-libstdc++  -lpthread -Wl,--no-whole-archive -ldl -lm

@zh794390558
Copy link

maybe gcc/gfortrian version not match openblas needed? gcc-8 is work for may case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants