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

Anaconda and Ubuntu 20.04: libgfortran.so.4 not found #27

Open
ylikx opened this issue Jun 28, 2020 · 1 comment
Open

Anaconda and Ubuntu 20.04: libgfortran.so.4 not found #27

ylikx opened this issue Jun 28, 2020 · 1 comment

Comments

@ylikx
Copy link
Owner

ylikx commented Jun 28, 2020

The problem

Using Ubuntu's gfortran 9 together with Anaconda can lead to the following error:

./a.out: error while loading shared libraries: libgfortran.so.4: cannot open shared object file: No such file or directory

This is because gfortran 9 wrongly links with the libgfortran installed in the conda environment, which is libgfortran.so.4 instead of libgfortran.so.5 that is used by gfortran 9.

Possible solutions

  1. Use Anaconda's gfortran (version 7): install with conda install gfortran_linux-64. Anaconda's compiler tools use some non-standard names for the compiler executables: you have to use x86_64-conda_cos6-linux-gnu-gfortran instead of gfortran. Use the -fno-lto option in the linking step, otherwise the linking step hangs.
  2. OR: install Ubuntu's gfortran-7 with sudo apt install gfortran-7 and use that.
  3. OR: use gfortran 9 and statically link libgfortran with the option -static-libgfortran in the linking step.
  4. OR: use gfortran 9 and temporarily rename conda's <path to anaconda>/lib/libgfortran.so to something else (similar to suggestion in igraph failing to compile due to missing libgfortran.so.4 (Arch based Linux) igraph/rigraph#275 (comment))

Probably not a good idea: Installing gfortran-7 or libgfortran4 and using gfortran 9 also seems to solve the problem for simple examples. However then the older libgfortran.so.4 is used instead of libgfortran.so.5

@naity2
Copy link

naity2 commented Mar 6, 2023

Thank you!

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

No branches or pull requests

2 participants