Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 46 additions & 25 deletions containers/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fi
# Install packages
apt-get -yqq update
apt-get -yqq install cpp${GCC} gcc${GCC} g++${GCC} gfortran${GCC}
apt-get -yqq install clang${CLANG} clang-tidy${CLANG} clang-format${CLANG} libclang${CLANG}-dev libc++${CLANG}-dev
apt-get -yqq install clang${CLANG} clang-tidy${CLANG} clang-format${CLANG} libclang${CLANG}-dev libc++${CLANG}-dev libedit-dev llvm${CLANG}-dev
if [ "${CLANG#-}" -ge 20 ]; then apt-get -yqq install flang${CLANG}; fi
apt-get -yqq autoremove
# Remove symlinks loop observed in nvidia/cuda devel images
Expand Down Expand Up @@ -261,7 +261,6 @@ declare -A target=(
target=${target[${TARGETPLATFORM}]}
spack config --scope spack add "packages:all:require:[target=${target}]"
spack config --scope spack add "packages:all:target:[${target}]"
spack config blame packages
mkdir -p $HOME/.spack/ # workaround for Spack not creating config directory automatically in some versions (see https://github.com/spack/spack/issues/51564)
spack config --scope user add "config:suppress_gpg_warnings:true"
spack config --scope user add "config:build_jobs:${jobs}"
Expand All @@ -270,29 +269,6 @@ spack config --scope user add "config:source_cache:/var/cache/spack"
spack config --scope user add "config:install_tree:root:/opt/software"
spack config --scope user add "config:ccache:true"
spack config blame config
spack compiler find --scope spack
# Ensure GCC externals have LTO‑safe binutils configured.
#
# 1. LTO issue being worked around:
# When GCC is built/used with LTO support, archive creation for objects
# that may contain LTO bytecode must use the plugin‑aware wrappers
# (gcc-ar/gcc-ranlib) instead of the system "ar"/"ranlib". If plain "ar"
# is used, link steps can fail with LTO plugin errors or produce archives
# that cannot be linked correctly.
#
# 2. Why GCC_AR must be set in Spack's external configuration:
# Spack discovers the system GCC as an "external" compiler and records it
# in packages.yaml/compilers.yaml. However, Spack does not automatically
# export GCC_AR to all build environments for that external GCC. By
# adding extra_attributes.environment.set.GCC_AR here, we force Spack to
# set GCC_AR=gcc-ar whenever it uses this external GCC, so that LTO builds
# consistently invoke the correct archive tool.
# Note: this uses the python-based yq. Future base image upgrades may cause syntax change.
yq -iy '.packages.gcc.externals[].extra_attributes += {"environment": {"set": {"GCC_AR": "gcc-ar"}}}' ${SPACK_ROOT}/etc/spack/packages.yaml
# Ensure LLVM externals satisfy iwyu variant requirements (targets=all)
yq -iy '.packages.llvm.externals[].spec += " targets=all"' ${SPACK_ROOT}/etc/spack/packages.yaml
spack config blame compilers
spack config blame packages
EOF

## Bootstrap
Expand All @@ -306,13 +282,58 @@ EOF
## - allow llvm to be buildable for py-numba > py-llvmlite
RUN <<EOF
set -e
spack compiler find --scope spack
spack external find --scope spack llvm
spack external find --scope spack --not-buildable gcc
spack external find --scope spack --not-buildable --path /usr/local/cuda/bin cuda
# Clang 20+ is not in CUDA's supported compiler list; amend the external spec so that
# the +allow-unsupported-compilers variant disables the build-system conflict check.
# Note: this uses the python-based yq. Future base image upgrades may cause syntax change.
yq -iy 'if .packages.cuda.externals then .packages.cuda.externals[].spec += " +allow-unsupported-compilers" else . end' ${SPACK_ROOT}/etc/spack/packages.yaml
# Ensure discovered GCC externals have LTO-safe binutils configured.
#
# 1. LTO issue being worked around:
# When GCC is built/used with LTO support, archive creation for objects
# that may contain LTO bytecode must use the plugin-aware wrappers
# (gcc-ar/gcc-ranlib) instead of the system "ar"/"ranlib". If plain "ar"
# is used, link steps can fail with LTO plugin errors or produce archives
# that cannot be linked correctly.
#
# 2. Why GCC_AR must be set in Spack's external configuration:
# Spack records the system GCC as an external in packages.yaml, but does not
# automatically export GCC_AR for builds that use it. Adding
# extra_attributes.environment.set.GCC_AR here ensures LTO-enabled builds
# consistently invoke the correct archive tool.
# Note: this uses the python-based yq. Future base image upgrades may cause syntax change.
yq -iy '.packages.gcc.externals[] |= (
.extra_attributes += {
"environment": {
"set": {
"GCC_AR": "gcc-ar"
}
}
}
)' ${SPACK_ROOT}/etc/spack/packages.yaml
# Ensure discovered LLVM externals satisfy iwyu requirements and export the
# CMake hints ROOT/cling expects when using the system LLVM.
export LLVM_PREFIX=$(llvm-config --prefix)
export LLVM_BIN=$(llvm-config --bindir)
yq -iy '.packages.llvm.externals[] |= (
.spec += " targets=all" |
.extra_attributes += {
"environment": {
"set": {
"LLVM_DIR": "\(env.LLVM_PREFIX)/lib/cmake/llvm",
"LLVM_TOOLS_BINARY_DIR": env.LLVM_BIN,
"LLVM_TABLEGEN": "\(env.LLVM_BIN)/llvm-tblgen",
"LLVM_TABLEGEN_EXE": "\(env.LLVM_BIN)/llvm-tblgen"
},
"prepend_path": {
"CMAKE_PREFIX_PATH": env.LLVM_PREFIX
}
}
}
)' ${SPACK_ROOT}/etc/spack/packages.yaml
spack config blame packages
EOF

Expand Down
2 changes: 1 addition & 1 deletion spack-environment/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ packages:
root:
require:
- '@6.40.02'
- cxxstd=20 +fftw +fortran +gdml +http -ipo +mlp +python +root7 +tmva +tmva-sofie +x +xrootd +ssl
- cxxstd=20 ~builtin_llvm +fftw +fortran +gdml +http -ipo +mlp +python +root7 +tmva +tmva-sofie +x +xrootd +ssl
- any_of: [+opengl +webgui, -opengl -webgui]
Comment thread
wdconinc marked this conversation as resolved.
sherpa:
require:
Expand Down
2 changes: 2 additions & 0 deletions spack-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ caf013be0ee1594fdbba8feb07ffecc88474a2b0
acac89d6bb7079412e711a50a3f06681132a2723
438abd1e09f0cea9cb0ccc7e0326adcd0408196b
4dc856a13e9066ca3249a593d351af8cda521fa3
e41e172d579e30881556873fe32f8408f6647800
---
## Optional hash table with comma-separated file list
## For these commits, the cherry-pick will be restricted to the listed files only.
Expand All @@ -49,3 +50,4 @@ read -r -d '' SPACKPACKAGES_CHERRYPICKS_FILES <<- \
## acac89d6bb7079412e711a50a3f06681132a2723: cuda: append --allow-unsupported-compiler to CUDAFLAGS for dependent_spec
## 438abd1e09f0cea9cb0ccc7e0326adcd0408196b: herwig3: add CT14(?n)lo pdfsets as build-time resources
## 4dc856a13e9066ca3249a593d351af8cda521fa3: root: add v6.40.00, v6.40.02
## e41e172d579e30881556873fe32f8408f6647800: root: allow ~builtin_llvm with 6.40 and newer
Loading