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

Patch for adding -c to ranlib flags must not be applied when using llvm-ranlib #188

Closed
climbfuji opened this issue Feb 8, 2022 · 0 comments · Fixed by #189
Closed

Patch for adding -c to ranlib flags must not be applied when using llvm-ranlib #188

climbfuji opened this issue Feb 8, 2022 · 0 comments · Fixed by #189

Comments

@climbfuji
Copy link
Contributor

climbfuji commented Feb 8, 2022

Trying to build develop or release 11.5.0 on macOS with LLVM clang + gfortran:

     846    /usr/local/opt/llvm/bin/llvm-ranlib -c libbufr_4_DA.a
  >> 847    /usr/local/opt/llvm/bin/llvm-ranlib: error: Invalid option: '-c'
  >> 848    make[2]: *** [src/libbufr_4_DA.a] Error 1
     849    make[2]: *** Deleting file `src/libbufr_4_DA.a'
  >> 850    make[1]: *** [src/CMakeFiles/bufr_4_DA.dir/all] Error 2
  >> 851    make: *** [all] Error 2

In CMakeLists.txt:

if(APPLE)
  # The linker on macOS does not include `common symbols` by default
  # Passing the -c flag includes them and fixes an error with undefined symbols
  set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> -c <TARGET>")
  set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -c <TARGET>")
endif()

I tested this with different clang versions. The native Apple clang requires the -c flag, otherwise the linker step fails with undefined symbols. The LLVM clang ranlib (llvm-ranlib) doesn't understand the -c flag and doesn't need it.

@climbfuji climbfuji changed the title Patch for adding -c to ranlib flags must only be applied when using Intel on Apple systems Patch for adding -c to ranlib flags must not be applied when using llvm-ranlib Feb 8, 2022
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

Successfully merging a pull request may close this issue.

1 participant