NOAA-EMC / UPP

Other
33 stars 95 forks source link

Linker errors against UPP library with Intel on macOS #416

Open climbfuji opened 2 years ago

climbfuji commented 2 years ago

This issue relates to https://github.com/ufs-community/ufs-weather-model/issues/925 - when using Intel on macOS, the common symbols are not automatically linked into the library, which leads to linker errors for the ufs-weather-model.

The solution is to add -c to the linker command when Intel is used on macOS, as proposed by @kgerheiser here: https://github.com/ufs-community/ufs-weather-model/issues/309

See also how it is implemented in the ufs-weather-model: https://github.com/ufs-community/ufs-weather-model/blob/805421ded18ce025be789c33e19bfcac2020f339/cmake/Intel.cmake#L56

kgerheiser commented 2 years ago

Hmm, I already added it a few months ago:

https://github.com/NOAA-EMC/UPP/blob/d903e3ecced8e3e6d78e3089b3371733348153fd/CMakeLists.txt#L43

I believe the issue is the presence of C code, but we use CMAKE_Fortran_ARCHIVE_FINISH, which causes it to not be called. It should be CMAKE_C_ARCHIVE_FINISH (or both).

Edit: the lone .c file isn't even compiled, so I'm not sure what's going on.

WenMeng-NOAA commented 2 years ago

@climbfuji and @kgerheiser With UPP being a submodule of FV3, does this linker issue still exist on macOS? If yes, do you have any solutions? Thanks!