Skip to content

Commit

Permalink
clean up how rpath and -L are added to LDFLAGS so that each entry is …
Browse files Browse the repository at this point in the history
…separate -- prevents errors installing on Mac arm64 because multiple rpath values aren't read using :. Also use MET_PROJLIB
  • Loading branch information
georgemccabe committed Dec 4, 2023
1 parent 36621d0 commit abd06eb
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions internal/scripts/installation/compile_MET_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,10 @@ if [ -z ${MET_PROJ} ]; then
export MET_PROJ=${LIB_DIR}
fi

if [ -z ${MET_PROJLIB} ]; then
export MET_PROJLIB=${MET_PROJ}/lib64
fi

export MET_PYTHON_BIN_EXE=${MET_PYTHON_BIN_EXE:=${MET_PYTHON}/bin/python3}
export MET_PYTHON_LD
export MET_PYTHON_CC
Expand All @@ -822,9 +826,21 @@ fi
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
# ${parameter:+word}
# If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${LIB_DIR}/lib:${MET_PROJ:+:$MET_PROJ/lib64}:${LIB_DIR}/lib${MET_NETCDF:+:$MET_NETCDF/lib}${MET_HDF5:+:$MET_HDF5/lib}${MET_BUFRLIB:+:$MET_BUFRLIB}${MET_GRIB2CLIB:+:$MET_GRIB2CLIB}${MET_PYTHON_LIB:+:$MET_PYTHON_LIB}${MET_GSL:+:$MET_GSL/lib}${ADDTL_DIR:+:$ADDTL_DIR}"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${LIB_JASPER:+$LIB_JASPER}${LIB_LIBPNG:+:$LIB_PNG}${LIB_Z:+$LIB_Z}"
export LDFLAGS="${LDFLAGS} ${LIB_JASPER:+-L$LIB_JASPER} ${LIB_LIBPNG:+-L$LIB_LIBPNG} ${MET_HDF5:+-L$MET_HDF5/lib} ${ADDTL_DIR:+-L$ADDTL_DIR}"

# add LIB_DIR/lib to rpath and -L
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${LIB_DIR}/lib -L${LIB_DIR}/lib"

# if variables are set, add <VALUE>/lib to rpath and -L
for x in $MET_NETCDF $MET_HDF5 $MET_GSL; do
export LDFLAGS="${LDFLAGS} ${x:+-Wl,-rpath,$x/lib -L$x/lib}"
# #if [[ "$STR" == *"$SUB"* ]];
done

# if variables are set, add <VALUE> to rpath and -L
for x in $MET_BUFRLIB $MET_GRIB2CLIB $MET_PYTHON_LIB $LIB_JASPER $LIB_LIBPNG $LIB_TIFF $LIB_Z $MET_PROJLIB $ADDTL_DIR; do
export LDFLAGS="${LDFLAGS} ${x:+-Wl,-rpath,$x -L$x}"
done

export LIBS="${LIBS} -lhdf5_hl -lhdf5 -lz -ltiff"
export MET_FONT_DIR=${TEST_BASE}/fonts

Expand Down

0 comments on commit abd06eb

Please sign in to comment.