mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-29 06:35:28 -04:00
Toolchain: Towards static linking
This commit is contained in:
parent
6dcb27d01a
commit
e2bdc4aeb6
11 changed files with 43 additions and 15 deletions
|
|
@ -98,7 +98,10 @@ FCFLAGS="$G_CFLAGS \$(FCDEBFLAGS) \$(WFLAGS) \$(DFLAGS)"
|
|||
CFLAGS="$G_CFLAGS -std=c11 -Wall -Wextra -Werror \$(DFLAGS)"
|
||||
|
||||
# Linker flags
|
||||
LDFLAGS="\$(FCFLAGS) ${CP_LDFLAGS}"
|
||||
# About --whole-archive see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52590
|
||||
STATIC_FLAGS="-static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive"
|
||||
# Get unfortunately ignored: -static-libgcc -static-libstdc++ -static-libgfortran
|
||||
LDFLAGS="IF_STATIC(${STATIC_FLAGS}|) \$(FCFLAGS) ${CP_LDFLAGS}"
|
||||
|
||||
# Library flags
|
||||
# add standard libs
|
||||
|
|
@ -194,12 +197,14 @@ EOF
|
|||
rm -f ${INSTALLDIR}/arch/local*
|
||||
# normal production arch files
|
||||
gen_arch_file "local.ssmp"
|
||||
gen_arch_file "local_static.ssmp" STATIC
|
||||
gen_arch_file "local.sdbg" DEBUG
|
||||
arch_vers="ssmp sdbg"
|
||||
|
||||
if [ "$MPI_MODE" != no ]; then
|
||||
gen_arch_file "local.psmp" MPI
|
||||
gen_arch_file "local.pdbg" MPI DEBUG
|
||||
gen_arch_file "local_static.psmp" MPI STATIC
|
||||
gen_arch_file "local_warn.psmp" MPI WARNALL
|
||||
gen_arch_file "local_coverage.pdbg" MPI COVERAGE
|
||||
arch_vers="${arch_vers} psmp pdbg"
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ if __name__ == "__main__":
|
|||
"CUDA": False,
|
||||
"WARNALL": False,
|
||||
"DEBUG": False,
|
||||
"STATIC": False,
|
||||
"VALGRIND": False,
|
||||
"COVERAGE": False,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,15 @@ case "$with_gcc" in
|
|||
GCCROOT=${PWD}
|
||||
mkdir obj
|
||||
cd obj
|
||||
# TODO: Maybe use --disable-libquadmath-support to improve static linking:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46539
|
||||
#
|
||||
# TODO: Maybe use --disable-gnu-unique-object to improve static linking:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60348#c13
|
||||
# https://stackoverflow.com/questions/11931420
|
||||
#
|
||||
# TODO: Unfortunately, we can not simply use --disable-shared, because
|
||||
# it would break OpenBLAS build and probably others too.
|
||||
${GCCROOT}/configure --prefix="${pkg_install_dir}" \
|
||||
--libdir="${pkg_install_dir}/lib" \
|
||||
--enable-languages=c,c++,fortran \
|
||||
|
|
|
|||
|
|
@ -52,7 +52,16 @@ case "$with_mpich" in
|
|||
# workaround for compilation with GCC-10, until properly fixed:
|
||||
# https://github.com/pmodels/mpich/issues/4300
|
||||
("${FC}" --version | grep -Eq 'GNU.+\s10\.') && compat_flag="-fallow-argument-mismatch" || compat_flag=""
|
||||
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" MPICC="" FFLAGS="${FCFLAGS} ${compat_flag}" FCFLAGS="${FCFLAGS} ${compat_flag}" --without-x --enable-gl=no > configure.log 2>&1
|
||||
./configure \
|
||||
--prefix="${pkg_install_dir}" \
|
||||
--libdir="${pkg_install_dir}/lib" \
|
||||
MPICC="" \
|
||||
FFLAGS="${FCFLAGS} ${compat_flag}" \
|
||||
FCFLAGS="${FCFLAGS} ${compat_flag}" \
|
||||
--without-x \
|
||||
--enable-gl=no \
|
||||
--disable-shared \
|
||||
> configure.log 2>&1
|
||||
make -j $(get_nprocs) > make.log 2>&1
|
||||
make install > install.log 2>&1
|
||||
cd ..
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ case "$with_openblas" in
|
|||
#
|
||||
# wrt NUM_THREADS=64: this is what the most common Linux distros seem to choose atm
|
||||
# for a good compromise between memory usage and scalability
|
||||
#
|
||||
# Unfortunately, NO_SHARED=1 breaks ScaLAPACK build.
|
||||
(
|
||||
make -j $(get_nprocs) \
|
||||
MAKE_NB_JOBS=0 \
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ case "$with_fftw" in
|
|||
[ -d fftw-${fftw_ver} ] && rm -rf fftw-${fftw_ver}
|
||||
tar -xzf ${fftw_pkg}
|
||||
cd fftw-${fftw_ver}
|
||||
FFTW_FLAGS="--enable-openmp --enable-shared --enable-static"
|
||||
FFTW_FLAGS="--enable-openmp --disable-shared --enable-static"
|
||||
# fftw has mpi support but not compiled by default. so compile it if we build with mpi.
|
||||
# it will create a second library to link with if needed
|
||||
[ "$MPI_MODE" != "no" ] && FFTW_FLAGS="--enable-mpi ${FFTW_FLAGS}"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ case "$with_gsl" in
|
|||
cd gsl-${gsl_ver}
|
||||
./configure --prefix="${pkg_install_dir}" \
|
||||
--libdir="${pkg_install_dir}/lib" \
|
||||
--enable-shared \
|
||||
--disable-shared \
|
||||
--enable-static > configure.log 2>&1
|
||||
make -j $(get_nprocs) > make.log 2>&1
|
||||
make -j $(get_nprocs) install > install.log 2>&1
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ case "$with_plumed" in
|
|||
CXXFLAGS="${CXXFLAGS//-g/-g0} ${GSL_CFLAGS}" \
|
||||
LDFLAGS="${LDFLAGS} ${GSL_LDFLAGS}" \
|
||||
LIBS="${libs}" \
|
||||
--disable-shared \
|
||||
--prefix=${pkg_install_dir} \
|
||||
--libdir="${pkg_install_dir}/lib" > configure.log 2>&1
|
||||
make VERBOSE=1 -j $(get_nprocs) > make.log 2>&1
|
||||
|
|
@ -96,9 +97,9 @@ EOF
|
|||
cat << EOF >> "${BUILDDIR}/setup_plumed"
|
||||
export PLUMED_LDFLAGS="${PLUMED_LDFLAGS}"
|
||||
export PLUMED_LIBS="${PLUMED_LIBS}"
|
||||
export CP_DFLAGS="\${CP_DFLAGS} -D__PLUMED2"
|
||||
export CP_LDFLAGS="\${CP_LDFLAGS} ${PLUMED_LDFLAGS}"
|
||||
export CP_LIBS="${PLUMED_LIBS} \${CP_LIBS}"
|
||||
export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__PLUMED2|)"
|
||||
export CP_LDFLAGS="\${CP_LDFLAGS} IF_MPI(${PLUMED_LDFLAGS}|)"
|
||||
export CP_LIBS="IF_MPI(${PLUMED_LIBS}|) \${CP_LIBS}"
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ case "$with_hdf5" in
|
|||
./configure \
|
||||
--prefix="${pkg_install_dir}" \
|
||||
--libdir="${pkg_install_dir}/lib" \
|
||||
--enable-shared \
|
||||
--disable-shared \
|
||||
> configure.log 2>&1
|
||||
make -j $(get_nprocs) > make.log 2>&1
|
||||
make -j $(get_nprocs) install > install.log 2>&1
|
||||
|
|
|
|||
|
|
@ -48,13 +48,12 @@ case "$with_spglib" in
|
|||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_SHARED_LIBS=NO \
|
||||
.. > configure.log 2>&1
|
||||
make -j $(get_nprocs) > make.log 2>&1
|
||||
make -j $(get_nprocs) symspg > make.log 2>&1
|
||||
make install >> make.log 2>&1
|
||||
mkdir ${pkg_install_dir}/include/spglib
|
||||
cp ${pkg_install_dir}/include/{,spglib/}spglib.h
|
||||
cd ..
|
||||
# Despite -DBUILD_SHARED_LIBS=NO the shared library gets build and installed.
|
||||
rm "${pkg_install_dir}"/lib/*.so*
|
||||
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -47,9 +47,10 @@ case "$with_spfft" in
|
|||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_CXX_COMPILER="${MPICXX}" \
|
||||
-DSPFFT_OMP=ON \
|
||||
-DSPFFT_MPI=ON \
|
||||
-DSPFFT_STATIC=ON \
|
||||
-DSPFFT_INSTALL=ON \
|
||||
.. > cmake.log 2>&1
|
||||
make -j $(get_nprocs) > make.log 2>&1
|
||||
|
|
@ -63,9 +64,10 @@ case "$with_spfft" in
|
|||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_CXX_COMPILER="${MPICXX}" \
|
||||
-DSPFFT_OMP=ON \
|
||||
-DSPFFT_MPI=ON \
|
||||
-DSPFFT_STATIC=ON \
|
||||
-DSPFFT_INSTALL=ON \
|
||||
-DSPFFT_GPU_BACKEND=CUDA \
|
||||
.. > cmake.log 2>&1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue