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

Problem with gfortran linking on macOS 10.15.7 #2524

Closed
1 task done
kpj opened this issue Jan 22, 2021 · 5 comments
Closed
1 task done

Problem with gfortran linking on macOS 10.15.7 #2524

kpj opened this issue Jan 22, 2021 · 5 comments
Assignees
Labels
investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: macOS

Comments

@kpj
Copy link

kpj commented Jan 22, 2021

Description
I am using this setup:

Current runner version: '2.276.0'
Operating System
  Mac OS X
  10.15.7
  19H15
Virtual Environment
  Environment: macos-10.15
  Version: 20201212.1

My goal is to compile software which relies on gfortran.
Following #1280, I added this step to my workflow:

- name: Provide gfortran
  if: runner.os == 'macOS'
  run: |
    sudo ln -s /usr/local/bin/gfortran-9 /usr/local/bin/gfortran
    gfortran --version

However, compilation of other software now fails with ld: library not found for -lgfortran (affected run).

Area for Triage:
Apple

Question, Bug, or Feature?:
Bug

Virtual environments affected

  • macOS 10.15

Expected behavior
Installation of software which requires fortran should be possible.

Actual behavior
Installation of software which requires fortran crashes with

ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Repro steps
Affected run: https://github.com/kpj/dce/runs/1748442835

@al-cheb al-cheb added OS: macOS investigate Collect additional information, like space on disk, other tool incompatibilities etc. and removed needs triage labels Jan 22, 2021
@dsame dsame self-assigned this Jan 25, 2021
@dsame
Copy link
Contributor

dsame commented Jan 26, 2021

The quick workaround:

@kpj In order your build to success you have to create one more link

sudo ln -s /usr/local/Cellar/gcc@9/9.3.0_1/lib/gcc/9 /usr/local/gfortran/lib

@al-cheb @AlenaSviridenko @maxim-lobanov - it is not clear that caused the problem - either the build system used by the workflow picked up the incorrect path to fortran libraries (most probably) or there's something wrong with the gcc installation (almost no chance)

In order to fix the issue i suggest to improve the documentation mentioning the one more link has to be created. The other solutions require the additional triage

@kpj
Copy link
Author

kpj commented Jan 26, 2021

@dsame Thanks a lot! Why did you use _1 in 9.3.0_1? The readme only shows 9.3.0.

Unfortunately, your suggestion crashes with ln: /usr/local/gfortran/lib: No such file or directory (link).

If I wanted to use fortran-10, would the correct setup be something like this?

- name: Provide gfortran
  if: runner.os == 'macOS'
  run: |
    sudo ln -s /usr/local/bin/gfortran-10 /usr/local/bin/gfortran
    sudo ln -s /usr/local/Cellar/gcc@10/10.2.0/lib/gcc/10 /usr/local/gfortran/lib
    gfortran --version

@dsame
Copy link
Contributor

dsame commented Jan 27, 2021

@kpj

We use brew to install gcc and its components on macos images, so the exact paths are managed by the brew team

README shows the installed version of gfortran, but the exact directory where it is installed is 9.3.0_1
In order to get the paths you need to link please add ls /usr/local/Cellar/gcc@[version] to your pipeline

Before the creating of the link /usr/local/gfortran/lib you have to create the directory /usr/local/gfortran

For full working pipeline i created this build https://github.com/dsame/actions-demo/runs/1774695708?check_suite_focus=true , please use it as a reference

@al-cheb @AlenaSviridenko @maxim-lobanov the build https://github.com/dsame/actions-demo/runs/1774695708?check_suite_focus=true shows there's no need any extra links to build both fortran77 and fortran99 and therefore the original issue is caused by the 3rd party build system and we do not need to update the docs

@kpj please confirm the original issue is solved with

    - name: Provide gfortran9 
      run: |
        sudo ln -s /usr/local/bin/gfortran-9 /usr/local/bin/gfortran 
        sudo mkdir /usr/local/gfortran
        sudo ln -s /usr/local/Cellar/gcc@9/9.3.0_1/lib/gcc/9 /usr/local/gfortran/lib
        gfortran --version

@dsame
Copy link
Contributor

dsame commented Feb 2, 2021

Hi! I am closing this issue due to no response in a week. Please, feel free to contact us in case of any questions

@dsame dsame closed this as completed Feb 2, 2021
@kpj
Copy link
Author

kpj commented Feb 2, 2021

@dsame Sorry for not responding earlier. The issue is that the (binary) dependencies of my project were updated and the fortran compiler is not required until another dependency changes. So unfortunately, I cannot confirm whether the fix works or not.

I added it successfully to my workflow nonetheless, so it will probably work out. Should other issues arise later, I'll create another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: macOS
Projects
None yet
Development

No branches or pull requests

3 participants