Skip to content

Commit

Permalink
updated build_macos_gnu.lua to have LDFLAGS loaded inside the modulefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Natalie Perlin authored and Natalie Perlin committed Jan 16, 2025
1 parent 73cf0d6 commit f12a609
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
23 changes: 16 additions & 7 deletions modulefiles/build_macos_gnu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ if mode() == "load" then
execute{cmd="ulimit -S -s unlimited", modeA={"load"}}
end


prepend_path("MODULEPATH", "/Users/username/spack-stack/spack-stack-1.8.0/envs/ufs-srw-env/install/modulefiles/Core")
-- Replace the stackpath below by the path of the local spack-stack environment build:
local stackpath = "/Users/username/spack-stack/spack-stack-1.8.0/envs/ufs-srw-env"
local modulepath = stackpath .. "/install/modulefiles/Core"
prepend_path("MODULEPATH", modulepath)

stack_gnu_ver=os.getenv("stack_apple_clang_ver") or "15.0.0"
load(pathJoin("stack-apple-clang", stack_gnu_ver))
Expand Down Expand Up @@ -40,9 +42,16 @@ setenv("CMAKE_Fortran_COMPILER_ID", "GNU")

setenv("CFLAGS","-Wno-implicit-function-declaration ")

if mode() == "load" then
LmodMsgRaw([===[
Please export these env. variables after the module is successfully loaded:
> export LDFLAGS+=" -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib "
]===])

local libjpeg_ROOT = os.getenv("libjpeg_turbo_ROOT")
local jasper_ROOT = os.getenv("jasper_ROOT")
local libpng_ROOT = os.getenv("libpng_ROOT")
local ldflags0 = os.getenv("LDFLAGS") or ""

if jasper_ROOT and libpng_ROOT and libjpeg_ROOT then
local ldflags1 = " -L" .. libjpeg_ROOT .. "/lib -ljpeg -Wl,-rpath," .. libjpeg_ROOT .. "/lib"
local ldflags2 = " -L" .. jasper_ROOT .. "/lib -ljasper -Wl,-rpath," .. jasper_ROOT .. "/lib"
local ldflags3 = " -L" .. libpng_ROOT .. "/lib -lpng -Wl,-rpath," .. libpng_ROOT .. "/lib"
local ldflags = ldflags0 .. ldflags1 .. ldflags2 .. ldflags3
setenv("LDFLAGS", ldflags)
end
4 changes: 2 additions & 2 deletions ush/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ task_get_extrn_ics:
EXTRN_MDL_NAME_ICS: FV3GFS
FV3GFS_FILE_FMT_ICS: grib2
USE_USER_STAGED_EXTRN_FILES: true
EXTRN_MDL_SOURCE_BASEDIR_ICS: "/Users/username/UFS_SRW_data/input_model_data/FV3GFS/grib2/2019061518"
EXTRN_MDL_SOURCE_BASEDIR_ICS: "/Users/username/DATA/UFS/input_model_data/FV3GFS/grib2/2019061518"
task_get_extrn_lbcs:
EXTRN_MDL_NAME_LBCS: FV3GFS
LBC_SPEC_INTVL_HRS: 6
FV3GFS_FILE_FMT_LBCS: grib2
USE_USER_STAGED_EXTRN_FILES: true
EXTRN_MDL_SOURCE_BASEDIR_LBCS: "/Users/username/UFS_SRW_data/input_model_data/FV3GFS/grib2/2019061518"
EXTRN_MDL_SOURCE_BASEDIR_LBCS: "/Users/username/DATA/UFS/input_model_data/FV3GFS/grib2/2019061518"
task_run_fcst:
QUILTING: true
LAYOUT_X: 3
Expand Down

0 comments on commit f12a609

Please sign in to comment.