Skip to content
New issue

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

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

Already on GitHub? # to your account

Problem on macOS with gfortran #32

Open
gha3mi opened this issue Jul 31, 2023 · 5 comments
Open

Problem on macOS with gfortran #32

gha3mi opened this issue Jul 31, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@gha3mi
Copy link
Contributor

gha3mi commented Jul 31, 2023

Thanks for the project.

There is a problem with the mac operating system. It appears that it only works with gfortran version 10.

When running a simple fpm test on mac using gfortran, I encountered this error:

 dyld[2196]: Library not loaded: '/usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib'
  Referenced from: '/Users/runner/work/_temp/fpm'
  Reason: tried: '/usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)
/Users/runner/work/_temp/378df7c3-1bf9-413a-8a60-858cb91f887e.sh: line 1:  2196 Abort trap: 6           fpm test
Error: Process completed with exit code 134.

To temporarily solve the problem, I used the following steps:

    - name: Setup Fortran on Windows
      if: contains( matrix.os, 'windows')
      uses: awvwgk/setup-fortran@v1
      with:
        compiler: ${{ matrix.toolchain.compiler }}
        version: ${{ matrix.toolchain.version }}

    - name: Setup Fortran on MacOS
      if: contains( matrix.os, 'macos')
      run: |
        brew reinstall gcc@12
        ln -s /usr/local/lib/gcc/current/libgfortran.5.dylib /usr/local/lib/
        ln -s /usr/local/lib/gcc/current/libquadmath.0.dylib /usr/local/lib/
        ln -s /usr/local/Cellar/gcc/13.1.0/bin/gfortran /usr/local/bin/gfortran
        # ln -s /usr/local/lib/gcc/current/bin/gfortran /usr/local/bin/gfortran
@wpbonelli
Copy link
Contributor

cf #7, #31 reproducing in ci tests is likely the first step toward solution

@gha3mi
Copy link
Contributor Author

gha3mi commented Aug 1, 2023

To find locations on a Mac, I used the find command:

find /usr/local -name "libgfortran"
find /usr/local -name "libquadmath"
find /usr/local -name "gfortran"

Maybe the above solution can be generalized (I didn't test it):

  brew reinstall (or install) gcc@${{ matrix.toolchain.version }}
  ln -s /usr/local/lib/gcc/current/libgfortran.5.dylib /usr/local/lib/
  ln -s /usr/local/lib/gcc/current/libquadmath.0.dylib /usr/local/lib/
  ln -s /usr/local/Cellar/gcc/13.1.0/bin/gfortran /usr/local/bin/gfortran
  # or
  # ln -s /usr/local/Cellar/gcc/${{ matrix.toolchain.version }}/bin/gfortran /usr/local/bin/gfortran
  # or
  # ln -s /usr/local/lib/gcc/current/bin/gfortran /usr/local/bin/gfortran
  # or

@wpbonelli wpbonelli added the bug Something isn't working label Oct 16, 2023
@jalvesz
Copy link

jalvesz commented Jan 15, 2024

Same problem here, the tool chain installs gcc13 but it tries to look for gcc10 so it fails

dyld[[9](https://github.com/jalvesz/fast_math/actions/runs/7522194607/job/20473898887#step:5:10)87]: Library not loaded: '/usr/local/opt/gcc@[10](https://github.com/jalvesz/fast_math/actions/runs/7522194607/job/20473898887#step:5:11)/lib/gcc/10/libgfortran.5.dylib'
  Referenced from: '/Users/runner/work/_temp/fpm'
  Reason: tried: '/usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)
/Users/runner/work/_temp/5303a5b3-22dd-4062-9184-c4aeef2db72e.sh: line 1:   987 Abort trap: 6           fpm test --flag "-cpp -O3 -march=native"

@minhqdao
Copy link
Contributor

Still having the problem:

dyld[4361]: Library not loaded: /usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib
  Referenced from: <9C2D5DA8-E509-36A4-AB7E-D8D39205CC1F> /Users/runner/work/_temp/fpm
  Reason: tried: '/usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib' (no such file), '/usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)
/Users/runner/work/_temp/03e4926e-d593-4b01-848f-c502aedb9a9c.sh: line 1:  4361 Abort trap: 6           fpm test
Error: Process completed with exit code 134.

Tried running both gcc-13 or intel-classic and it happened in both instances.

@wpbonelli
Copy link
Contributor

libgfortran shouldn't be used at all for an intel fortran build, right? seems like confirmation this is an fpm issue?

xref gha3mi/test-setup-fortran#1 where @gha3mi made some progress tracking it down

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants