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

fpm fails to build on macOS with Conda #543

Closed
certik opened this issue Aug 22, 2021 · 5 comments
Closed

fpm fails to build on macOS with Conda #543

certik opened this issue Aug 22, 2021 · 5 comments

Comments

@certik
Copy link
Member

certik commented Aug 22, 2021

I use the usual conda create -n fpm fpm gfortran clang and then go to the fpm git repository and:

$ fpm build
 + mkdir -p build/dependencies
Initialized empty Git repository in /Users/certik/repos/fortran-lang/fpm/build/dependencies/toml-f/.git/
remote: Enumerating objects: 115, done.
remote: Counting objects: 100% (115/115), done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 115 (delta 27), reused 47 (delta 8), pack-reused 0
Receiving objects: 100% (115/115), 105.17 KiB | 158.00 KiB/s, done.
Resolving deltas: 100% (27/27), done.
From https://github.com/toml-f/toml-f
 * branch            2f5eaba864ff630ba0c3791126a3f811b6e437f3 -> FETCH_HEAD
Initialized empty Git repository in /Users/certik/repos/fortran-lang/fpm/build/dependencies/M_CLI2/.git/
remote: Enumerating objects: 191, done.
remote: Counting objects: 100% (191/191), done.
remote: Compressing objects: 100% (110/110), done.
remote: Total 191 (delta 93), reused 156 (delta 80), pack-reused 0
Receiving objects: 100% (191/191), 1.08 MiB | 166.00 KiB/s, done.
Resolving deltas: 100% (93/93), done.
From https://github.com/urbanjost/M_CLI2
 * branch            ea6bbffc1c2fb0885e994d37ccf0029c99b19f24 -> FETCH_HEAD
 + mkdir -p build/gfortran_2A42023B310FA28D/fpm
 + gfortran -c ././src/filesystem_utilities.c -o build/gfortran_2A42023B310FA28D/fpm/src_filesystem_utilities.c.o
gfortran: fatal error: cannot execute ‘cc1’: execvp: No such file or directory
compilation terminated.
 <ERROR> Compilation failed for object "src_filesystem_utilities.c.o"
STOP 1

The failure comes from the fact that gfortran is being used to compile a C file. If you use the default cc compiler, it would compile just fine:

$ cc -c ./src/filesystem_utilities.c -o build/gfortran_2A42023B310FA28D/fpm/src_filesystem_utilities.c.o

Since I now can't compile fpm in the first place, it's not easy to fix for me.

@ghost
Copy link

ghost commented Aug 23, 2021

This works in Windows: set FPM_C_COMPILER=gcc - an equivalent command in macOS may help.

@certik
Copy link
Member Author

certik commented Aug 23, 2021

That works! I did:

FPM_C_COMPILER=clang fpm build

And this now builds fpm on my macOS. Thank you @brocolis.

@certik
Copy link
Member Author

certik commented Aug 23, 2021

I am going to keep this issue open until either:

  • This just works out of the box
  • Or there is a clear error message with this hint to use FPM_C_COMPILER=clang.

I think fpm should now that gfortran can't compile C files on macOS (for whatever reason).

@awvwgk
Copy link
Member

awvwgk commented Aug 23, 2021

Can you provide the output of conda list? This is incredible helpful for troubleshooting conda related issues.

I think you might be hitting conda-forge/gfortran_osx-64-feedstock#11, which has been lingered in the GCC toolchain for OSX for quite a while now and has only been fixed recently.

@awvwgk
Copy link
Member

awvwgk commented Aug 26, 2021

This should be solved with #527 now.

@awvwgk awvwgk closed this as completed Aug 26, 2021
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