Skip to content

Commit 69058e4

Browse files
committed
Merge branch 'hotfix_buildsys' into 'main'
Added checks in libra_build.sh to set the CC, CXX, FC and F77 env. variables See merge request ardg/libra!154
2 parents 36212fe + f6fdaa4 commit 69058e4

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

scripts/libra_build.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ if [[ -v SPACK_ROOT ]]; then
136136
# $SPACK_ENV gets defined in an activated env.
137137
SPACK_ENV_ROOT=$SPACK_ENV/.spack-env/view/
138138

139+
# If CUDA is installed in SPACK env., setup a symlink to libcuda.so.1 stub.
140+
CUDA_LIB=`spack location -i cuda`
141+
if [ -z "$CUDA_LIB" ]; then
142+
echo "###Info:"
143+
echo "###Info: CUDA libs not installed in $SPACK_ENV_ROOT. Assuming a system installation.";
144+
echo "###Info:"
145+
else
146+
ln -s $SPACK_ENV_ROOT/lib64/stubs/libcuda.so $SPACK_ENV_ROOT/lib64/libcuda.so.1
147+
fi
148+
139149
#---------------------------------------------------------
140150
echo "Checking required packages in SPACK ($SPACK_ROOT)"...
141151
#
@@ -183,11 +193,21 @@ fi
183193
# GCC 11.4 with CUDA 11.x works.
184194
# Not clear what other combinations work/not work.
185195
#
186-
export CXX=/usr/bin/g++
187-
export CC=/usr/bin/gcc
188-
export FC=/usr/bin/gfortran
196+
197+
# Define compiler variables if they aren't already defined
198+
if [ -z "${CXX}" ]; then
199+
export CXX=/usr/bin/g++
200+
fi
201+
if [ -z "${CC}" ]; then
202+
export CC=/usr/bin/gcc
203+
fi
204+
if [ -z "${FC}" ]; then
205+
export FC=/usr/bin/gfortran
206+
fi
189207
# GNU configure script uses the env variable F77 (for building FFTW package)
190-
export F77=${FC}
208+
if [ -z "${F77}" ]; then
209+
export F77=${FCC}
210+
fi
191211

192212
#
193213
# Use -DLIBRA_ENABLE_CUDA_BACKEND=OFF for CPU-only build.

0 commit comments

Comments
 (0)