From 9040fe2be7146638ced75f36a513b665828db844 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Thu, 26 Mar 2020 15:03:17 -0400 Subject: [PATCH] conda: Macros: add '-L' argument to the linker command (#418) On Linux, compiling CICE in serial mode under the conda environment currently fails as the linker does not find the NetCDF libraries. Compiling in parallel mode does work as the MPI compilation wrappers seem to pass the necessary flag to the linker under the hood. Explicitely tell the linker the location of the libraries using the `SLIBS` variable in the Macros file. To be on the safe side, also do it on macOS. --- configuration/scripts/machines/Macros.conda_linux | 2 +- configuration/scripts/machines/Macros.conda_macos | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/scripts/machines/Macros.conda_linux b/configuration/scripts/machines/Macros.conda_linux index 59a6632d8..32c5ae012 100644 --- a/configuration/scripts/machines/Macros.conda_linux +++ b/configuration/scripts/machines/Macros.conda_linux @@ -40,7 +40,7 @@ LD:= $(FC) MODDIR += -I$(CONDA_PREFIX)/include # Libraries to be passed to the linker -SLIBS := -lnetcdf -lnetcdff +SLIBS := -L$(CONDA_PREFIX)/lib -lnetcdf -lnetcdff # Necessary flag to compile with OpenMP support ifeq ($(ICE_THREADED), true) diff --git a/configuration/scripts/machines/Macros.conda_macos b/configuration/scripts/machines/Macros.conda_macos index beff37b6c..52bdd469d 100644 --- a/configuration/scripts/machines/Macros.conda_macos +++ b/configuration/scripts/machines/Macros.conda_macos @@ -43,7 +43,7 @@ MODDIR += -I$(CONDA_PREFIX)/include CFLAGS_HOST = -isysroot$(shell xcrun --show-sdk-path) # Libraries to be passed to the linker -SLIBS := -lnetcdf -lnetcdff +SLIBS := -L$(CONDA_PREFIX)/lib -lnetcdf -lnetcdff # Necessary flag to compile with OpenMP support ifeq ($(ICE_THREADED), true)