Skip to content

Commit

Permalink
Fix duplicate symbols and include common symbols on macOS (NOAA-EMC#321)
Browse files Browse the repository at this point in the history
On macOS common symbols aren't included by default, so pass -c to ranlib on macOS.

native_endianness is compiled twice in exe_src and lib_src which results in duplicate symbols.
  • Loading branch information
kgerheiser authored May 20, 2021
1 parent b40f56c commit 7f267d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ if(OPENMP)
find_package(OpenMP REQUIRED COMPONENTS Fortran)
endif()

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>")
endif()

find_package(bacio REQUIRED)
find_package(crtm REQUIRED)
find_package(g2 REQUIRED)
Expand Down
1 change: 0 additions & 1 deletion sorc/ncep_post.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ list(APPEND EXE_SRC
getVariable.f
getlvls.f
intio_tags.f
native_endianness.f
retrieve_index.f
wrf_io_flags.f
wrf_io_flags.h)
Expand Down

0 comments on commit 7f267d8

Please sign in to comment.