From 10fd69ec74e784f9013520b8d942fbcb36b41472 Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:28:04 -0700 Subject: [PATCH 01/34] new package: gsibec (#40137) --- .../repos/builtin/packages/gsibec/package.py | 46 +++++++++++++++++++ .../builtin/packages/jedi-cmake/package.py | 24 ++++++++++ 2 files changed, 70 insertions(+) create mode 100644 var/spack/repos/builtin/packages/gsibec/package.py create mode 100644 var/spack/repos/builtin/packages/jedi-cmake/package.py diff --git a/var/spack/repos/builtin/packages/gsibec/package.py b/var/spack/repos/builtin/packages/gsibec/package.py new file mode 100644 index 00000000000..7c68d3eee37 --- /dev/null +++ b/var/spack/repos/builtin/packages/gsibec/package.py @@ -0,0 +1,46 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Gsibec(CMakePackage): + """GSIbec: Extracts the background error covariance (BEC) model + capabilities from the Gridpoint Statistical Interpolation (GSI) + atmospheric analysis system into a library of its own.""" + + homepage = "https://github.com/GEOS-ESM/gsibec" + git = "https://github.com/GEOS-ESM/gsibec.git" + url = "https://github.com/GEOS-ESM/gsibec/archive/refs/tags/1.0.2.tar.gz" + + maintainers("mathomp4", "danholdaway") + + version("develop", branch="develop") + version("1.1.3", sha256="9cac000562250487c16608e8245d97457cc1663b1793b3833be5a76ebccb4b47") + version("1.1.2", sha256="8bdcdf1663e6071b6ad9e893a76307abc70a6de744fb75a13986e70242993ada") + version("1.0.7", sha256="53912f1f19d46f4941b377803cc2fce89a2b50d2ece7562f8fd65215a8908158") + version("1.0.6", sha256="10e2561685156bcfba35c7799732c77f9c05bd180888506a339540777db833dd") + version("1.0.5", sha256="ac0cecc59e38da7eefb5a8f27975b33752fa61a4abd3bdbbfb55578ea59d95b3") + version("1.0.4", sha256="6460e221f2a45640adab016336c070fbe3e7c4b6fc55257945bf5cdb38d5d3e2") + version("1.0.3", sha256="f104daf55705c5093a3d984073f082017bc9166f51ded36c7f7bb8adf233c916") + version("1.0.2", sha256="7dc02f1f499e0d9f2843440f517d6c8e5d10ea084cbb2567ec198ba06816bc8b") + + depends_on("mpi", type=("build", "run")) + depends_on("netcdf-c +mpi", type=("build", "run")) + depends_on("netcdf-fortran", type=("build", "run")) + + depends_on("lapack", type=("build", "run")) + + depends_on("ecbuild", type=("build")) + depends_on("jedi-cmake", type=("build")) + depends_on("sp", type=("build")) + + def cmake_args(self): + args = [] + + mkl_providers = ["intel-mkl", "intel-oneapi-mkl", "intel-parallel-studio"] + args.append(self.define("ENABLE_MKL", spec["lapack"].name in mkl_providers)) + + return args diff --git a/var/spack/repos/builtin/packages/jedi-cmake/package.py b/var/spack/repos/builtin/packages/jedi-cmake/package.py new file mode 100644 index 00000000000..84759fb5061 --- /dev/null +++ b/var/spack/repos/builtin/packages/jedi-cmake/package.py @@ -0,0 +1,24 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class JediCmake(CMakePackage): + """CMake/ecbuild toolchains to facilitate portability on different systems.""" + + homepage = "https://github.com/JCSDA/jedi-cmake" + git = "https://github.com/JCSDA/jedi-cmake.git" + + maintainers("climbfuji") + + version("master", branch="master", no_cache=True) + version("develop", branch="develop", no_cache=True) + version( + "1.4.0", commit="36fc99bdff5d3d8835480b37a3dcc75e5f8da256", preferred=True, submodules=True + ) + version("1.3.0", commit="729a9b2ec97a7e93cbc58213493f28ca11f08754") + + depends_on("cmake @3.10:", type=("build")) From 2a66a6713262087ed2fb0fe26acfcf690c6a6081 Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:19:25 -0500 Subject: [PATCH 02/34] subread: removing mtune arg to compiler (#40197) --- var/spack/repos/builtin/packages/subread/package.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/subread/package.py b/var/spack/repos/builtin/packages/subread/package.py index efff79a4f88..ae63d69d02f 100644 --- a/var/spack/repos/builtin/packages/subread/package.py +++ b/var/spack/repos/builtin/packages/subread/package.py @@ -14,6 +14,7 @@ class Subread(MakefilePackage): homepage = "https://subread.sourceforge.net/" url = "https://sourceforge.net/projects/subread/files/subread-1.5.2/subread-1.5.2-source.tar.gz/download" + maintainers("snehring") version("2.0.6", sha256="f0fdda6b98634d2946028948c220253e10a0f27c7fa5f24913b65b3ac6cbb045") version("2.0.4", sha256="c54b37ed83b34318d8f119b5c02fb9d0a65c811195bcc9e1745df6daf74ca2db") @@ -31,12 +32,11 @@ def build(self, spec, prefix): with working_dir("src"): if plat.startswith("linux"): filter_file("CC_EXEC = gcc", "CC_EXEC = {0}".format(spack_cc), "Makefile.Linux") - if spec.target.family == "aarch64": - filter_file("-mtune=core2", "", "Makefile.Linux") - if spec.satisfies("@1.6.2:2.0.0"): - filter_file("-mtune=core2", "", "longread-one/Makefile") - elif spec.satisfies("@1.6.0"): - filter_file("-mtune=core2", "", "longread-mapping/Makefile") + filter_file("-mtune=core2", "", "Makefile.Linux") + if spec.satisfies("@1.6.2:"): + filter_file("-mtune=core2", "", "longread-one/Makefile") + if spec.satisfies("@1.6.0"): + filter_file("-mtune=core2", "", "longread-mapping/Makefile") make("-f", "Makefile.Linux") elif plat.startswith("darwin"): make("-f", "Makefile.MacOS") From d97251a4c6384a537d498f13320e72e8c7ae034f Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Mon, 25 Sep 2023 20:23:02 +0100 Subject: [PATCH 03/34] spdlog: add version 1.12.0 (#40186) --- var/spack/repos/builtin/packages/spdlog/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/spdlog/package.py b/var/spack/repos/builtin/packages/spdlog/package.py index de933739bbf..36dc0a19b9a 100644 --- a/var/spack/repos/builtin/packages/spdlog/package.py +++ b/var/spack/repos/builtin/packages/spdlog/package.py @@ -12,6 +12,7 @@ class Spdlog(CMakePackage): homepage = "https://github.com/gabime/spdlog" url = "https://github.com/gabime/spdlog/archive/v0.9.0.tar.gz" + version("1.12.0", sha256="4dccf2d10f410c1e2feaff89966bfc49a1abb29ef6f08246335b110e001e09a9") version("1.11.0", sha256="ca5cae8d6cac15dae0ec63b21d6ad3530070650f68076f3a4a862ca293a858bb") version("1.10.0", sha256="697f91700237dbae2326b90469be32b876b2b44888302afbc7aceb68bcfe8224") version("1.9.2", sha256="6fff9215f5cb81760be4cc16d033526d1080427d236e86d70bb02994f85e3d38") From 4e17a40d091333aa493e4892babe8e1886f73317 Mon Sep 17 00:00:00 2001 From: Cameron Smith Date: Mon, 25 Sep 2023 15:53:36 -0400 Subject: [PATCH 04/34] omegah: new version (#40192) --- var/spack/repos/builtin/packages/omega-h/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/omega-h/package.py b/var/spack/repos/builtin/packages/omega-h/package.py index 2dddcf96191..3d8c952afd4 100644 --- a/var/spack/repos/builtin/packages/omega-h/package.py +++ b/var/spack/repos/builtin/packages/omega-h/package.py @@ -19,6 +19,11 @@ class OmegaH(CMakePackage, CudaPackage): maintainers("cwsmith") tags = ["e4s"] version("main", branch="main") + version( + "scorec.10.7.0", + commit="0e5de8618c3370f702e08c1b1af476dbbc118892", + git="https://github.com/SCOREC/omega_h.git", + ) version( "scorec.10.6.0", commit="f376fad4741b55a4b2482218eb3437d719b7c72e", From aef58776b4bf6cb845f2e7ba1d52b599371fc7a0 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 25 Sep 2023 21:54:05 +0200 Subject: [PATCH 05/34] openssl: new versions (#40194) apparently there was still a 1.1.1 release --- .../repos/builtin/packages/openssl/package.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 8d955b33322..358a0080888 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -30,9 +30,14 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package executables = ["openssl"] - version("3.1.2", sha256="a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539") - version("3.0.10", sha256="1761d4f5b13a1028b9b6f3d4b8e17feb0cedc9370f6afe61d7193d2cdce83323") + version("3.1.3", sha256="f0316a2ebd89e7f2352976445458689f80302093788c466692fb2a188b2eacf6") + version("3.0.11", sha256="b3425d3bb4a2218d0697eb41f7fc0cdede016ed19ca49d168b78e8d947887f55") + version( + "3.1.2", + sha256="a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539", + deprecated=True, + ) version( "3.1.1", sha256="b3aa61334233b852b63ddb048df181177c2c659eb9d4376008118f9c08d07674", @@ -43,6 +48,11 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package sha256="aaa925ad9828745c4cad9d9efeb273deca820f2cdcf2c3ac7d7c1212b7c497b4", deprecated=True, ) + version( + "3.0.10", + sha256="1761d4f5b13a1028b9b6f3d4b8e17feb0cedc9370f6afe61d7193d2cdce83323", + deprecated=True, + ) version( "3.0.9", sha256="eb1ab04781474360f77c318ab89d8c5a03abc38e63d65a603cabbf1b00a1dc90", @@ -83,6 +93,11 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package sha256="59eedfcb46c25214c9bd37ed6078297b4df01d012267fe9e9eee31f61bc70536", deprecated=True, ) + version( + "1.1.1w", + sha256="cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8", + deprecated=True, + ) version( "1.1.1v", sha256="d6697e2871e77238460402e9362d47d18382b15ef9f246aba6c7bd780d38a6b0", From fc027e34d14b4483f7aeb4e080d0f75df1b871a4 Mon Sep 17 00:00:00 2001 From: Alberto Invernizzi <9337627+albestro@users.noreply.github.com> Date: Tue, 26 Sep 2023 01:00:58 +0200 Subject: [PATCH 06/34] apex: add new version 2.6.3 + deal with ompt build problem (#40073) * add new version 2.6.3 * add conflict for openmp when using gcc --- var/spack/repos/builtin/packages/apex/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/apex/package.py b/var/spack/repos/builtin/packages/apex/package.py index 76b213a40f6..bf6ea039acb 100644 --- a/var/spack/repos/builtin/packages/apex/package.py +++ b/var/spack/repos/builtin/packages/apex/package.py @@ -18,6 +18,7 @@ class Apex(CMakePackage): version("develop", branch="develop") version("master", branch="master") + version("2.6.3", sha256="7fef12937d3bd1271a01abe44cb931b1d63823fb5c74287a332f3012ed7297d5") version("2.6.2", sha256="0c3ec26631db7925f50cf4e8920a778b57d11913f239a0eb964081f925129725") version("2.6.1", sha256="511dbab0af541489052a3d6379c48f9577e51654491d3b2c8545020e9d29fb29") version("2.6.0", sha256="25b4f6afd1083475dc6680b5da87759c62d31fcf368996185573694fc40d5317") @@ -115,6 +116,9 @@ class Apex(CMakePackage): conflicts("+jemalloc", when="+gperftools") conflicts("+plugins", when="~activeharmony") + # https://github.com/UO-OACISS/apex/pull/177#issuecomment-1726322959 + conflicts("+openmp", when="%gcc") + # Patches # This patch ensures that the missing dependency_tree.hpp header is From 5341834ebeb455c4552a92e8abf0143f475d0866 Mon Sep 17 00:00:00 2001 From: Ethan Williams <37885088+ethanjjjjjjj@users.noreply.github.com> Date: Tue, 26 Sep 2023 01:53:28 +0100 Subject: [PATCH 07/34] Elbencho: add elbencho package (#40193) * add elbencho package * pep8 compliant * add description * depends on boost * boost options * dependencies * fix ncurses not linking properly missing tinfo * pep8 fix * fix style of boost variants * final style fix - spack style is happy * correct cufile env variable name --------- Co-authored-by: Ethan W --- .../builtin/packages/elbencho/package.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 var/spack/repos/builtin/packages/elbencho/package.py diff --git a/var/spack/repos/builtin/packages/elbencho/package.py b/var/spack/repos/builtin/packages/elbencho/package.py new file mode 100644 index 00000000000..a9417a4dfc1 --- /dev/null +++ b/var/spack/repos/builtin/packages/elbencho/package.py @@ -0,0 +1,71 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class Elbencho(MakefilePackage): + + """ + Elbencho storage benchmark + """ + + homepage = "https://github.com/breuner/elbencho" + url = "https://github.com/breuner/elbencho/archive/refs/tags/v3.0-1.tar.gz" + + maintainers("ethanjjjjjjj") + + version("3.0-1", sha256="19dad85e1fc74419dcdf740f11a47d3f6d566770a06e40976755a3404566c11d") + version("2.2-5", sha256="4b598639452665a8b79c4c9d8a22ae63fb9b04057635a45e686aa3939ee255b4") + version("2.2-3", sha256="0ae2d495d2863b84f21f55b7c526674fab1be723d0697087017946647f79d0e6") + version("2.1-5", sha256="5d2293dcdb766e9194bed964486a10b4c8c308cc1ba8c0044c6e5a2aadd4f199") + version("2.1-3", sha256="9d08aa0e83753666cb16a78320dfa5710350879f9f4f1e281dacd69f53249d01") + version("2.1-1", sha256="18be49f521df2fab4f16a1a9f00dd6104a25e5ea335ce8801bf07268ed9271a9") + version("2.0-9", sha256="fe0f67fbb7dd7c743f8b3e0a92358f7393f2950da456474d4adb38690fab1878") + version("2.0-7", sha256="a2e49cb2cf1ae99e46e9fa95b42ece250cb58fbadb4c393f9776b40204e8b2c0") + + variant("s3", default=False, description="Enable support for s3 api") + variant("cuda", default=True, description="Enable CUDA support", when="+cufile") + variant("cuda", default=False, description="Enable CUDA support") + variant("cufile", default=False, description="GPU Direct Storage") + + depends_on("cuda", when="+cuda") + depends_on( + """ + boost + +filesystem+program_options + +thread + +system+date_time + +regex + +serialization + +iostreams + """ + ) + depends_on("ncurses") + depends_on("numactl") + depends_on("libaio") + depends_on("curl", when="+s3") + depends_on("libarchive", when="+s3") + depends_on("openssl", when="+s3") + depends_on("libuuid", when="+s3") + depends_on("zlib", when="+s3") + depends_on("cmake", when="+s3") + + conflicts("+cufile", when="~cuda") + + def edit(self, spec, prefix): + os.mkdir(prefix.bin) + os.environ["INST_PATH"] = prefix.bin + if "+s3" in spec: + os.environ["S3_SUPPORT"] = "1" + if "+cuda" in spec: + os.environ["CUDA_SUPPORT"] = "1" + if "+cufile" in spec: + os.environ["CUFILE_SUPPORT"] = "1" + makefile = FileFilter("Makefile") + makefile.filter(r"\s+/etc/bash_completion.d/", f" {prefix}/etc/bash_completion.d/") + makefile.filter(r"-lncurses", "-ltinfo -lncurses") From 550613ee3a8e36e6b74a4d33dc7bea3ec6ac81d5 Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:59:31 -0500 Subject: [PATCH 08/34] gmap-gsnap: add v2023-07-20 and aarch64 support (#40200) --- .../repos/builtin/packages/gmap-gsnap/package.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/gmap-gsnap/package.py b/var/spack/repos/builtin/packages/gmap-gsnap/package.py index 1d512aed62f..3b7773763d2 100644 --- a/var/spack/repos/builtin/packages/gmap-gsnap/package.py +++ b/var/spack/repos/builtin/packages/gmap-gsnap/package.py @@ -16,6 +16,9 @@ class GmapGsnap(AutotoolsPackage): maintainers("snehring") + version( + "2023-07-20", sha256="19e70eebd9b282d8596721812d071efed188b6d5000627b9948f0486f87fe68f" + ) version( "2023-06-01", sha256="c7e6f6cf644e6f66f9f5a0811a49da8cc81f095a4bd7b7cef2ab10aa5b314430" ) @@ -60,12 +63,18 @@ class GmapGsnap(AutotoolsPackage): depends_on("bzip2") depends_on("perl", type="run") + requires("simd=arm", when="target=aarch64", msg="simd=arm is required when building on arm") + variant( "simd", description="CPU support.", - values=("avx2", "sse42", "avx512", "sse2"), + values=( + conditional("avx2", "sse42", "avx512", "sse2", when="target=x86_64:"), + conditional("arm", when="@2023-02-17: target=aarch64:"), + conditional("avx512", "avx512bw", when="@2023-03-24: target=x86_64:"), + ), multi=True, - default="sse2", + default="avx2", ) def configure(self, spec, prefix): From 9fda22d942854098bc48bec4256456957d5005e8 Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Mon, 25 Sep 2023 23:26:19 -0500 Subject: [PATCH 09/34] bcl2fastq2: patch for compiling on aarch64 (#40195) --- .../packages/bcl2fastq2/cxxConfigure-aarch64.patch | 11 +++++++++++ .../repos/builtin/packages/bcl2fastq2/package.py | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 var/spack/repos/builtin/packages/bcl2fastq2/cxxConfigure-aarch64.patch diff --git a/var/spack/repos/builtin/packages/bcl2fastq2/cxxConfigure-aarch64.patch b/var/spack/repos/builtin/packages/bcl2fastq2/cxxConfigure-aarch64.patch new file mode 100644 index 00000000000..490b9fcd078 --- /dev/null +++ b/var/spack/repos/builtin/packages/bcl2fastq2/cxxConfigure-aarch64.patch @@ -0,0 +1,11 @@ +--- a/src/cmake/cxxConfigure.cmake 2017-06-22 12:14:50.000000000 -0500 ++++ b/src/cmake/cxxConfigure.cmake 2023-09-25 11:50:55.819690648 -0500 +@@ -118,7 +118,7 @@ + set(BCL2FASTQ_DEP_LIB ${BCL2FASTQ_DEP_LIB} "${LIBEXSLT_LIBRARIES}" "${LIBXSLT_LIBRARIES}" "${LIBXML2_LIBRARIES}") + + #set (CMAKE_CXX_FLAGS "$ENV{CXX_FLAGS} $ENV{CXXFLAGS} -fopenmp -msse2 -Werror -Wall -Wextra -Wunused -Wno-long-long -Wsign-compare -Wpointer-arith" CACHE STRING "g++ flags" FORCE) +-set (CMAKE_CXX_FLAGS "$ENV{CXX_FLAGS} $ENV{CXXFLAGS} -std=c++11 -fopenmp -msse2 -Wall -Wextra -Wunused -Wno-long-long -Wsign-compare -Wpointer-arith" CACHE STRING "g++ flags" FORCE) ++set (CMAKE_CXX_FLAGS "$ENV{CXX_FLAGS} $ENV{CXXFLAGS} -std=c++11 -fopenmp -Wall -Wextra -Wunused -Wno-long-long -Wsign-compare -Wpointer-arith" CACHE STRING "g++ flags" FORCE) + #set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -pg -fprofile-arcs -ftest-coverage -D_GLIBCXX_DEBUG" CACHE STRING "g++ flags" FORCE) + set (CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++11 -g -pg -fprofile-arcs -ftest-coverage" CACHE STRING "g++ flags" FORCE) + #set (CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -O0 -g -pg -fprofile-arcs -ftest-coverage" CACHE STRING "g++ flags" FORCE) diff --git a/var/spack/repos/builtin/packages/bcl2fastq2/package.py b/var/spack/repos/builtin/packages/bcl2fastq2/package.py index 2dfc2ac8e5f..65695f04f43 100644 --- a/var/spack/repos/builtin/packages/bcl2fastq2/package.py +++ b/var/spack/repos/builtin/packages/bcl2fastq2/package.py @@ -49,6 +49,8 @@ class Bcl2fastq2(Package): # After finding the libxslt bits, cmake still needs to wire in the # libexslt bits. patch("cxxConfigure-cmake.patch") + # -msse2 isn't valid for arm + patch("cxxConfigure-aarch64.patch", when="target=aarch64:") root_cmakelists_dir = "src" From aec88ef3e6cfddc354e9ac9fc2851ebea709289d Mon Sep 17 00:00:00 2001 From: "Victor A. P. Magri" <50467563+victorapm@users.noreply.github.com> Date: Tue, 26 Sep 2023 00:27:14 -0400 Subject: [PATCH 10/34] hypre: add support for magma (#40121) --- .../repos/builtin/packages/hypre/package.py | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index a891d4ab05c..433d60a2ce7 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -76,6 +76,7 @@ class Hypre(AutotoolsPackage, CudaPackage, ROCmPackage): variant("gptune", default=False, description="Add the GPTune hookup code") variant("umpire", default=False, description="Enable Umpire support") variant("sycl", default=False, description="Enable SYCL support") + variant("magma", default=False, description="Enable MAGMA interface") variant("caliper", default=False, description="Enable Caliper support") # Patch to add gptune hookup codes @@ -100,6 +101,7 @@ def patch(self): # fix sequential compilation in 'src/seq_mv' depends_on("mpi", when="+mpi") depends_on("blas") depends_on("lapack") + depends_on("magma", when="+magma") depends_on("superlu-dist", when="+superlu-dist+mpi") depends_on("rocsparse", when="+rocm") depends_on("rocthrust", when="+rocm") @@ -108,18 +110,23 @@ def patch(self): # fix sequential compilation in 'src/seq_mv' depends_on("umpire", when="+umpire") depends_on("caliper", when="+caliper") + gpu_pkgs = ["magma", "umpire"] for sm_ in CudaPackage.cuda_arch_values: - depends_on( - "umpire+cuda cuda_arch={0}".format(sm_), when="+umpire+cuda cuda_arch={0}".format(sm_) - ) - for gfx in ROCmPackage.amdgpu_targets: - depends_on( - "umpire+rocm amdgpu_target={0}".format(gfx), - when="+umpire+rocm amdgpu_target={0}".format(gfx), - ) + for pkg in gpu_pkgs: + depends_on( + "{0}+cuda cuda_arch={1}".format(pkg, sm_), + when="+{0}+cuda cuda_arch={1}".format(pkg, sm_), + ) - # Uses deprecated cuSPARSE functions/types (e.g. csrsv2Info_t). - depends_on("cuda@:11", when="+cuda") + for gfx in ROCmPackage.amdgpu_targets: + for pkg in gpu_pkgs: + depends_on( + "{0}+rocm amdgpu_target={1}".format(pkg, gfx), + when="+{0}+rocm amdgpu_target={1}".format(pkg, gfx), + ) + + # hypre@:2.28.0 uses deprecated cuSPARSE functions/types (e.g. csrsv2Info_t). + depends_on("cuda@:11", when="@:2.28.0+cuda") # Conflicts conflicts("+cuda", when="+int64") @@ -150,6 +157,9 @@ def patch(self): # fix sequential compilation in 'src/seq_mv' # Option added in v2.24.0 conflicts("+sycl", when="@:2.23") + # Option added in v2.29.0 + conflicts("+magma", when="@:2.28") + configure_directory = "src" def url_for_version(self, version): @@ -280,6 +290,11 @@ def configure_args(self): if "+unified-memory" in spec: configure_args.append("--enable-unified-memory") + if "+magma" in spec: + configure_args.append("--with-magma-include=%s" % spec["magma"].prefix.include) + configure_args.append("--with-magma-lib=%s" % spec["magma"].libs) + configure_args.append("--with-magma") + configure_args.extend(self.enable_or_disable("fortran")) return configure_args @@ -329,7 +344,7 @@ def install(self, spec, prefix): @run_after("install") def cache_test_sources(self): - self.cache_extra_test_sources(self.extra_install_tests) + cache_extra_test_sources(self, self.extra_install_tests) @property def _cached_tests_work_dir(self): From 34ff3b408b1f3a174620e1be6f5e07f614959ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Aum=C3=BCller?= Date: Tue, 26 Sep 2023 06:35:38 +0200 Subject: [PATCH 11/34] seacas: correctly limit fmt dependency (#39756) versions older than 2022-10-14 do not build with fmt@10, either: fmt/core.h:1579:3: error: static_assert failed due to requirement 'formattable' --- var/spack/repos/builtin/packages/seacas/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/seacas/package.py b/var/spack/repos/builtin/packages/seacas/package.py index ce54a90368d..7a7d48c4087 100644 --- a/var/spack/repos/builtin/packages/seacas/package.py +++ b/var/spack/repos/builtin/packages/seacas/package.py @@ -140,7 +140,7 @@ class Seacas(CMakePackage): depends_on("netcdf-c@4.8.0:~mpi", when="~mpi") depends_on("hdf5+hl~mpi", when="~mpi") - depends_on("fmt@8.1.0:", when="@2022-03-04:2022-05-16") + depends_on("fmt@8.1.0:9", when="@2022-03-04:2022-05-16") depends_on("fmt@9.1.0", when="@2022-10-14") depends_on("fmt@9.1.0:", when="@2023-05-30") depends_on("matio", when="+matio") From 13816f19fdcbc8f20bafc037763010c5a0c0d1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Aum=C3=BCller?= Date: Tue, 26 Sep 2023 10:28:29 +0200 Subject: [PATCH 12/34] opencv: add 4.7.0 and 4.8.0 and fix ffmpeg dependency (#39013) --- var/spack/repos/builtin/packages/opencv/package.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/opencv/package.py b/var/spack/repos/builtin/packages/opencv/package.py index 3dd582aedc1..d8db8f53626 100644 --- a/var/spack/repos/builtin/packages/opencv/package.py +++ b/var/spack/repos/builtin/packages/opencv/package.py @@ -19,6 +19,8 @@ class Opencv(CMakePackage, CudaPackage): maintainers("bvanessen", "adamjstewart") version("master", branch="master") + version("4.8.0", sha256="cbf47ecc336d2bff36b0dcd7d6c179a9bb59e805136af6b9670ca944aef889bd") + version("4.7.0", sha256="8df0079cdbe179748a18d44731af62a245a45ebf5085223dc03133954c662973") version("4.6.0", sha256="1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277") version("4.5.5", sha256="a1cfdcf6619387ca9e232687504da996aaa9f7b5689986b8331ec02cb61d28ad") version("4.5.4", sha256="c20bb83dd790fc69df9f105477e24267706715a9d3c705ca1e7f613c7b3bad3d") @@ -63,6 +65,8 @@ class Opencv(CMakePackage, CudaPackage): "4.5.4", "4.5.5", "4.6.0", + "4.7.0", + "4.8.0", ] for cv in contrib_vers: resource( @@ -691,6 +695,7 @@ class Opencv(CMakePackage, CudaPackage): "mfx", "ngraph", "nvcuvid", # disabled, details: https://github.com/opencv/opencv/issues/14850 + "nvcuvenc", # disabled, depends on nvcuvid being enabled "opencl_svm", "openclamdblas", "openclamdfft", @@ -740,8 +745,9 @@ class Opencv(CMakePackage, CudaPackage): depends_on("cudnn@:7.3", when="@3.3.1:3.4+cudnn") depends_on("cudnn@:6", when="@:3.3.0+cudnn") depends_on("eigen", when="+eigen") - depends_on("ffmpeg+avresample", when="+ffmpeg") - depends_on("ffmpeg@:4+avresample", when="@:4.5+ffmpeg") + depends_on("ffmpeg", when="+ffmpeg") + depends_on("ffmpeg@:5", when="@:4.7+ffmpeg") + depends_on("ffmpeg@:4+avresample", when="@:4.6+ffmpeg") depends_on("gdal", when="+gdal") depends_on("gtkplus", when="+gtk") depends_on("hpx", when="+hpx") From 143e6a4fbb20f39d856e77eb1f838cf5d15a4cdc Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 26 Sep 2023 02:38:20 -0600 Subject: [PATCH 13/34] Always apply Python unixcompilers.py `rpath` fix, not just on cray (#39929) * Rename var/spack/repos/builtin/packages/python/cray-rpath-3.1.patch as var/spack/repos/builtin/packages/python/rpath-non-gcc.patch and apply unconditionally * Update var/spack/repos/builtin/packages/python/package.py Co-authored-by: Adam J. Stewart --------- Co-authored-by: Adam J. Stewart --- var/spack/repos/builtin/packages/python/package.py | 4 ++-- .../python/{cray-rpath-3.1.patch => rpath-non-gcc.patch} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename var/spack/repos/builtin/packages/python/{cray-rpath-3.1.patch => rpath-non-gcc.patch} (100%) diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 28803dfe655..2a904c73864 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -282,8 +282,8 @@ class Python(Package): patch("tkinter-3.10.patch", when="@3.10.0:3.10 ~tkinter") patch("tkinter-3.11.patch", when="@3.11.0:3.11 ~tkinter") - # Ensure that distutils chooses correct compiler option for RPATH on cray: - patch("cray-rpath-3.1.patch", when="@3 platform=cray") + # Ensure that distutils chooses correct compiler option for RPATH: + patch("rpath-non-gcc.patch", when="@:3.11") # Ensure that distutils chooses correct compiler option for RPATH on fj: patch("fj-rpath-3.1.patch", when="@:3.9.7,3.10.0 %fj") diff --git a/var/spack/repos/builtin/packages/python/cray-rpath-3.1.patch b/var/spack/repos/builtin/packages/python/rpath-non-gcc.patch similarity index 100% rename from var/spack/repos/builtin/packages/python/cray-rpath-3.1.patch rename to var/spack/repos/builtin/packages/python/rpath-non-gcc.patch From c16546bd4c0efea2e463028d2842d6eabad35815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Aum=C3=BCller?= Date: Tue, 26 Sep 2023 10:39:29 +0200 Subject: [PATCH 14/34] libressl: fix package & new versions (#39741) --- var/spack/repos/builtin/packages/libressl/package.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/libressl/package.py b/var/spack/repos/builtin/packages/libressl/package.py index d436df8abf8..0fca30e3539 100644 --- a/var/spack/repos/builtin/packages/libressl/package.py +++ b/var/spack/repos/builtin/packages/libressl/package.py @@ -16,14 +16,15 @@ class Libressl(AutotoolsPackage): maintainers("eschnett") + version("3.7.2", sha256="b06aa538fefc9c6b33c4db4931a09a5f52d9d2357219afcbff7d93fe12ebf6f7") + version("3.6.3", sha256="87b1bbe36e9eec8d0ae5f04c83d36b2c5b0e581784c7eb0817025ed29eadea37") version("3.6.1", sha256="acfac61316e93b919c28d62d53037ca734de85c46b4d703f19fd8395cf006774") variant("shared", default=True, description="Build shared libraries") variant("static", default=False, description="Build static libraries") def configure_args(self): - args = [ - "--enable-shared" if "+shared" in spec else "--disable-shared", - "--enable-static" if "+static" in spec else "--disable-static", - ] + args = [] + args.extend(self.enable_or_disable("shared")) + args.extend(self.enable_or_disable("static")) return args From 40dbadb868db7a42b60a5bf463d95930b1f708aa Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 26 Sep 2023 11:17:39 +0200 Subject: [PATCH 15/34] crosstool-ng: add v1.26.0 (#40204) --- var/spack/repos/builtin/packages/crosstool-ng/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/crosstool-ng/package.py b/var/spack/repos/builtin/packages/crosstool-ng/package.py index de1ed5648e5..defc7095e48 100644 --- a/var/spack/repos/builtin/packages/crosstool-ng/package.py +++ b/var/spack/repos/builtin/packages/crosstool-ng/package.py @@ -17,6 +17,7 @@ class CrosstoolNg(AutotoolsPackage): maintainers("alalazo") + version("1.26.0", sha256="e8ce69c5c8ca8d904e6923ccf86c53576761b9cf219e2e69235b139c8e1b74fc") version("1.25.0", sha256="68162f342243cd4189ed7c1f4e3bb1302caa3f2cbbf8331879bd01fe06c60cd3") depends_on("ncurses") From 90edd18d1f99bc08baff11806a33c80119780196 Mon Sep 17 00:00:00 2001 From: Matt Fraser Date: Tue, 26 Sep 2023 06:05:23 -0700 Subject: [PATCH 16/34] Add NCCL v2.18.5-1 release to recipe (#40201) --- var/spack/repos/builtin/packages/nccl/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/nccl/package.py b/var/spack/repos/builtin/packages/nccl/package.py index 99e569dbddd..21db9dad2cb 100644 --- a/var/spack/repos/builtin/packages/nccl/package.py +++ b/var/spack/repos/builtin/packages/nccl/package.py @@ -17,7 +17,8 @@ class Nccl(MakefilePackage, CudaPackage): maintainers("adamjstewart") libraries = ["libnccl.so"] - version("2.18.3-1", sha256="b4f5d7d9eea2c12e32e7a06fe138b2cfc75969c6d5c473aa6f819a792db2fc96") + version("2.18.5-1", sha256="16ac98f3e926c024ce48e10ab220e19ce734adc48c423cfd55ad6f509bd1179f") + version("2.18.3-1", sha256="6477d83c9edbb34a0ebce6d751a1b32962bc6415d75d04972b676c6894ceaef9") version("2.18.1-1", sha256="0e4ede5cf8df009bff5aeb3a9f194852c03299ae5664b5a425b43358e7a9eef2") version("2.17.1-1", sha256="1311a6fd7cd44ad6d4523ba03065ce694605843fd30a5c0f77aa3d911abe706d") version("2.16.2-1", sha256="7f7c738511a8876403fc574d13d48e7c250d934d755598d82e14bab12236fc64") From 0e72ff4a0d09cdeb26fefe6d302065da111beec7 Mon Sep 17 00:00:00 2001 From: Christoph Weber <96774182+Christoph-TU@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:15:12 +0200 Subject: [PATCH 17/34] ploticus: new package (#39881) Co-authored-by: Bernhard Kaindl --- .../builtin/packages/ploticus/package.py | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 var/spack/repos/builtin/packages/ploticus/package.py diff --git a/var/spack/repos/builtin/packages/ploticus/package.py b/var/spack/repos/builtin/packages/ploticus/package.py new file mode 100644 index 00000000000..cff43fae29a --- /dev/null +++ b/var/spack/repos/builtin/packages/ploticus/package.py @@ -0,0 +1,41 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Ploticus(MakefilePackage): + """Ploticus can produce various types of plots and graphs.""" + + homepage = "http://ploticus.sourceforge.net/doc/welcome.html" + + maintainers("Christoph-TU") + + version("2.42", sha256="3f29e4b9f405203a93efec900e5816d9e1b4381821881e241c08cab7dd66e0b0") + + depends_on("zlib-api") + depends_on("libpng") + + build_directory = "src" + + def url_for_version(self, version): + # spack's default url_for_version may replace "242_src" with 2.42_src, causing a 404. + # Returning the correct url here instead of as 'url =' fixes this issue: + return ( + "https://sourceforge.net/projects/ploticus/files/ploticus/2.42/ploticus242_src.tar.gz" + ) + + def setup_run_environment(self, env): + env.set("PLOTICUS_PREFABS", self.prefix.prefabs) + + def edit(self, spec, prefix): + makefile = FileFilter("src/Makefile") + makefile.filter("CC = .*", "CC = {0}".format(spack_cc)) + + def install(self, spec, prefix): + mkdir(prefix.bin) + mkdir(prefix.prefabs) + install("src/pl", prefix.bin) + install_tree("prefabs", prefix.prefabs) From 5c25437c9fe937fa83a2978cc980c678a3b638e7 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 26 Sep 2023 16:18:47 +0200 Subject: [PATCH 18/34] spack --profile: dump to stderr (#40209) --- lib/spack/spack/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 3b330c08d43..bc29b6f1f1e 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -774,7 +774,7 @@ def _profile_wrapper(command, parser, args, unknown_args): pr.disable() # print out profile stats. - stats = pstats.Stats(pr) + stats = pstats.Stats(pr, stream=sys.stderr) stats.sort_stats(*sortby) stats.print_stats(nlines) From 115e448bd37dad0833da16528a1c1c45fce233c2 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:41:24 -0400 Subject: [PATCH 19/34] Paraview package: update freetype find patch for shared libs (#40085) VTK's (and therefore Paraview's) FindFreetype module required patching to handle static import libraries from Freetype. However it did not cover shared libraries. This adds support for importing shared freetype into the VTK build --- .../builtin/packages/paraview/FindFreetype.cmake.patch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/paraview/FindFreetype.cmake.patch b/var/spack/repos/builtin/packages/paraview/FindFreetype.cmake.patch index ebb5f7c29c9..7e20b0a5718 100644 --- a/var/spack/repos/builtin/packages/paraview/FindFreetype.cmake.patch +++ b/var/spack/repos/builtin/packages/paraview/FindFreetype.cmake.patch @@ -1,8 +1,9 @@ +Submodule VTK contains modified content diff --git a/VTK/CMake/FindFreetype.cmake b/VTK/CMake/FindFreetype.cmake -index b4532735c2..f06d32327e 100644 +index b4532735c2..51671d4c3c 100644 --- a/VTK/CMake/FindFreetype.cmake +++ b/VTK/CMake/FindFreetype.cmake -@@ -63,6 +63,30 @@ directory of a Freetype installation. +@@ -63,6 +63,32 @@ directory of a Freetype installation. # I'm going to attempt to cut out the middleman and hope # everything still works. @@ -14,6 +15,8 @@ index b4532735c2..f06d32327e 100644 + get_target_property(freetype_location freetype LOCATION) + if (freetype_library_type STREQUAL STATIC_LIBRARY) + set(freetype_library_type STATIC) ++ elseif (freetype_library_type STREQUAL SHARED_LIBRARY) ++ set(freetype_library_type SHARED) + endif() + get_target_property(freetype_interface_include_directories freetype INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(freetype_interface_link_libraries freetype INTERFACE_LINK_LIBRARIES) From 38dc3a6896f64b894adead3446e8f822f878860b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Aum=C3=BCller?= Date: Tue, 26 Sep 2023 21:48:44 +0200 Subject: [PATCH 20/34] vtk: @9.2 need seacas@2022-10-14, fix macos (#39896) Co-authored-by: Bernhard Kaindl --- .../repos/builtin/packages/vtk/package.py | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py index 27b757c2c35..122e29408eb 100644 --- a/var/spack/repos/builtin/packages/vtk/package.py +++ b/var/spack/repos/builtin/packages/vtk/package.py @@ -72,6 +72,8 @@ class Vtk(CMakePackage): # We cannot build with both osmesa and qt in spack conflicts("+osmesa", when="+qt") + conflicts("%gcc@13", when="@9.2") + with when("+python"): # Depend on any Python, add bounds below. extends("python@2.7:", type=("build", "run")) @@ -165,8 +167,20 @@ class Vtk(CMakePackage): depends_on("proj@4:7", when="@9:") depends_on("cgns@4.1.1:+mpi", when="@9.1: +mpi") depends_on("cgns@4.1.1:~mpi", when="@9.1: ~mpi") - depends_on("seacas@2021-05-12:+mpi", when="@9.1: +mpi") - depends_on("seacas@2021-05-12:~mpi", when="@9.1: ~mpi") + with when("@9.1:"): + depends_on("seacas+mpi", when="+mpi") + depends_on("seacas~mpi", when="~mpi") + depends_on("seacas@2021-05-12:") + + # seacas@2023-05-30 does not provide needed SEACASIoss_INCLUDE_DIRS: + # CMake Error at CMake/vtkModule.cmake:5552 (message): + # The variable `SEACASIoss_INCLUDE_DIRS` was expected to have been available, + # but was not defined: + conflicts("seacas@2023-05-30", when="@:9.2") + + # vtk@9.2: need Ioss::Utils::get_debug_stream() which only 2022-10-14 provides, + # and to be safe against other issues, make them build with this version only: + depends_on("seacas@2022-10-14", when="@9.2:") depends_on("nlohmann-json", when="@9.2:") # For finding Fujitsu-MPI wrapper commands @@ -186,6 +200,13 @@ class Vtk(CMakePackage): when="@9.1", ) + @when("@9.2:") + def patch(self): + # provide definition for Ioss::Init::Initializer::Initializer(), + # required on macOS, as "-undefined error" is the default, + # but not on Linux, as undefined symbols are tolerated + filter_file("TARGETS Ioss", "TARGETS Ioss Ionit", "ThirdParty/ioss/CMakeLists.txt") + def url_for_version(self, version): url = "http://www.vtk.org/files/release/{0}/VTK-{1}.tar.gz" return url.format(version.up_to(2), version) From 5165524ca6eb9cb0b8c2e225352e4729b5a04062 Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Tue, 26 Sep 2023 19:51:34 -0700 Subject: [PATCH 21/34] e4s cray sles: suspend ci until machine issues resolved (#40219) --- .../gitlab/cloud_pipelines/.gitlab-ci.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml index a9a9fee13c0..d7f8a38ef63 100644 --- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -827,16 +827,16 @@ e4s-cray-rhel-build: variables: SPACK_CI_STACK_NAME: e4s-cray-sles -e4s-cray-sles-generate: - extends: [ ".generate-cray-sles", ".e4s-cray-sles" ] +# e4s-cray-sles-generate: +# extends: [ ".generate-cray-sles", ".e4s-cray-sles" ] -e4s-cray-sles-build: - extends: [ ".build", ".e4s-cray-sles" ] - trigger: - include: - - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml - job: e4s-cray-sles-generate - strategy: depend - needs: - - artifacts: True - job: e4s-cray-sles-generate +# e4s-cray-sles-build: +# extends: [ ".build", ".e4s-cray-sles" ] +# trigger: +# include: +# - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml +# job: e4s-cray-sles-generate +# strategy: depend +# needs: +# - artifacts: True +# job: e4s-cray-sles-generate From 43cb49d87ab7e3d904eadebcbd355bb048cb3632 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Wed, 27 Sep 2023 15:28:26 +0100 Subject: [PATCH 22/34] py-nanonbind: add new versions (#40161) --- var/spack/repos/builtin/packages/py-nanobind/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/var/spack/repos/builtin/packages/py-nanobind/package.py b/var/spack/repos/builtin/packages/py-nanobind/package.py index 5c4f5cb60d9..9f1f2fd8bb5 100644 --- a/var/spack/repos/builtin/packages/py-nanobind/package.py +++ b/var/spack/repos/builtin/packages/py-nanobind/package.py @@ -23,6 +23,15 @@ class PyNanobind(PythonPackage): maintainers("ma595") version("master", branch="master", submodules=True) + version( + "1.5.2", tag="v1.5.2", commit="b0e24d5b0ab0d518317d6b263a257ae72d4d29a2", submodules=True + ) + version( + "1.5.1", tag="v1.5.1", commit="ec6168d06dbf2ab94c31858223bd1d7617222706", submodules=True + ) + version( + "1.5.0", tag="v1.5.0", commit="e85a51049db500383808aaa4a77306ff37d96131", submodules=True + ) version( "1.4.0", tag="v1.4.0", commit="05cba0ef85ba2bb68aa115af4b74c30aa2aa7bec", submodules=True ) From 1cd2d07f0b9ad9d96e75d6c71c7bda9514cfa754 Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:32:18 -0500 Subject: [PATCH 23/34] last: add new version, fix build on aarch64 (#40216) Co-authored-by: Bernhard Kaindl --- var/spack/repos/builtin/packages/last/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/last/package.py b/var/spack/repos/builtin/packages/last/package.py index 8e1b953e301..a59da3ef538 100644 --- a/var/spack/repos/builtin/packages/last/package.py +++ b/var/spack/repos/builtin/packages/last/package.py @@ -16,10 +16,15 @@ class Last(MakefilePackage): git = "https://gitlab.com/mcfrith/last.git" maintainers("snehring") + version("1499", commit="2cc68d3ba8ae5ca46ceeb69302aef18b9db04f46") version("1282", commit="4368be912f4759e52b549940276f1adf087f489a") version("869", sha256="6371a6282bc1bb02a5e5013cc463625f2ce3e7746ff2ea0bdf9fe6b15605a67c") + depends_on("zlib-api") + def edit(self, spec, prefix): + if not spec.satisfies("target=x86_64:"): + filter_file("-msse4", "", "makefile") files = ["mat-doc.sh", "mat-inc.sh", "seed-doc.sh", "seed-inc.sh"] if spec.satisfies("@1282:"): files.append("gc-inc.sh") From bb66d15d08513e50c6d66d6c6d78854ca0348ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Aum=C3=BCller?= Date: Wed, 27 Sep 2023 16:41:32 +0200 Subject: [PATCH 24/34] ffmpeg: fix build with XCode 15 (#40187) As reported in #40159, a shared library build of ffmpeg 6.0 fails with the linker that was added with XCode 15: ld: building exports trie: duplicate symbol '_av_ac3_parse_header' clang: error: linker command failed with exit code 1 (use -v to see invocation) Forcing the old linker with -Wl,-ld_classic works around this. --- var/spack/repos/builtin/packages/ffmpeg/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/ffmpeg/package.py b/var/spack/repos/builtin/packages/ffmpeg/package.py index cfc1db119c6..ff597653ff9 100644 --- a/var/spack/repos/builtin/packages/ffmpeg/package.py +++ b/var/spack/repos/builtin/packages/ffmpeg/package.py @@ -128,6 +128,10 @@ def headers(self): headers.directories = [self.prefix.include] return headers + @when("@:6.0 %apple-clang@15:") + def setup_build_environment(self, env): + env.append_flags("LDFLAGS", "-Wl,-ld_classic") + def enable_or_disable_meta(self, variant, options): switch = "enable" if "+{0}".format(variant) in self.spec else "disable" return ["--{0}-{1}".format(switch, option) for option in options] From c90c946d52615ea56eed2e5f16e00a6343f2572b Mon Sep 17 00:00:00 2001 From: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:20:13 -0500 Subject: [PATCH 25/34] ParaView: Add versio 5.11.2 (#40213) --- var/spack/repos/builtin/packages/paraview/package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 757077e0e32..9b43d5e92c8 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -29,10 +29,11 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage): version("master", branch="master", submodules=True) version( - "5.11.1", - sha256="5cc2209f7fa37cd3155d199ff6c3590620c12ca4da732ef7698dec37fa8dbb34", + "5.11.2", + sha256="5c5d2f922f30d91feefc43b4a729015dbb1459f54c938896c123d2ac289c7a1e", preferred=True, ) + version("5.11.1", sha256="5cc2209f7fa37cd3155d199ff6c3590620c12ca4da732ef7698dec37fa8dbb34") version("5.11.0", sha256="9a0b8fe8b1a2cdfd0ace9a87fa87e0ec21ee0f6f0bcb1fdde050f4f585a25165") version("5.10.1", sha256="520e3cdfba4f8592be477314c2f6c37ec73fb1d5b25ac30bdbd1c5214758b9c2") version("5.10.0", sha256="86d85fcbec395cdbc8e1301208d7c76d8f48b15dc6b967ffbbaeee31242343a5") From d9724597eded17784b395b324d653305f3bf0e90 Mon Sep 17 00:00:00 2001 From: Jared Popelar Date: Wed, 27 Sep 2023 09:58:12 -0600 Subject: [PATCH 26/34] Trilinos package: build on Windows (#34622) Update Trilinos and dependencies to build a limited version of Trilinos on Windows. * Support trilinos~mpi~shared on Windows * superlu: force CMake build on Windows * boost: update to build on Windows (proper option formatting and build tool names) * pcre, openblas: add CMake-based build (keep prior build system as default on platforms other than Windows) * openblas: add patch when using Intel Fortran compiler (currently this is included as part of the hybrid %msvc compiler in Spack) Co-authored-by: John Parent --- .../repos/builtin/packages/boost/package.py | 39 +++++--- .../packages/openblas/ifort-msvc.patch | 13 +++ .../builtin/packages/openblas/package.py | 90 +++++++++++++------ .../repos/builtin/packages/pcre/package.py | 26 +++++- .../repos/builtin/packages/superlu/package.py | 2 + .../builtin/packages/trilinos/package.py | 19 +++- 6 files changed, 145 insertions(+), 44 deletions(-) create mode 100644 var/spack/repos/builtin/packages/openblas/ifort-msvc.patch diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index efa8b2270b1..58b836ac60b 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -498,7 +498,9 @@ def determine_bootstrap_options(self, spec, with_libs, options): with open("user-config.jam", "w") as f: # Boost may end up using gcc even though clang+gfortran is set in # compilers.yaml. Make sure this does not happen: - f.write("using {0} : : {1} ;\n".format(boost_toolset_id, spack_cxx)) + if not spec.satisfies("platform=windows"): + # Skip this on Windows since we don't have a cl.exe wrapper in spack + f.write("using {0} : : {1} ;\n".format(boost_toolset_id, spack_cxx)) if "+mpi" in spec: # Use the correct mpi compiler. If the compiler options are @@ -584,7 +586,7 @@ def determine_b2_options(self, spec, options): options.extend(["link=%s" % ",".join(link_types), "--layout=%s" % layout]) - if not spec.satisfies("@:1.75 %intel"): + if not spec.satisfies("@:1.75 %intel") and not spec.satisfies("platform=windows"): # When building any version >= 1.76, the toolset must be specified. # Earlier versions could not specify Intel as the toolset # as that was considered to be redundant/conflicting with @@ -634,7 +636,7 @@ def determine_b2_options(self, spec, options): return threading_opts def add_buildopt_symlinks(self, prefix): - with working_dir(prefix.lib): + with working_dir(prefix.lib, create=True): for lib in os.listdir(os.curdir): if os.path.isfile(lib): prefix, remainder = lib.split(".", 1) @@ -687,12 +689,15 @@ def install(self, spec, prefix): # to make Boost find the user-config.jam env["BOOST_BUILD_PATH"] = self.stage.source_path - bootstrap = Executable("./bootstrap.sh") - bootstrap_options = ["--prefix=%s" % prefix] self.determine_bootstrap_options(spec, with_libs, bootstrap_options) - bootstrap(*bootstrap_options) + if self.spec.satisfies("platform=windows"): + bootstrap = Executable("cmd.exe") + bootstrap("/c", ".\\bootstrap.bat", *bootstrap_options) + else: + bootstrap = Executable("./bootstrap.sh") + bootstrap(*bootstrap_options) # strip the toolchain to avoid double include errors (intel) or # user-config being overwritten (again intel, but different boost version) @@ -704,6 +709,8 @@ def install(self, spec, prefix): # b2 used to be called bjam, before 1.47 (sigh) b2name = "./b2" if spec.satisfies("@1.47:") else "./bjam" + if self.spec.satisfies("platform=windows"): + b2name = "b2.exe" if spec.satisfies("@1.47:") else "bjam.exe" b2 = Executable(b2name) jobs = make_jobs @@ -711,11 +718,14 @@ def install(self, spec, prefix): if jobs > 64 and spec.satisfies("@:1.58"): jobs = 64 - b2_options = [ - "-j", - "%s" % jobs, - "--user-config=%s" % os.path.join(self.stage.source_path, "user-config.jam"), - ] + # Windows just wants a b2 call with no args + b2_options = [] + if not self.spec.satisfies("platform=windows"): + path_to_config = "--user-config=%s" % os.path.join( + self.stage.source_path, "user-config.jam" + ) + b2_options = ["-j", "%s" % jobs] + b2_options.append(path_to_config) threading_opts = self.determine_b2_options(spec, b2_options) @@ -727,8 +737,11 @@ def install(self, spec, prefix): # In theory it could be done on one call but it fails on # Boost.MPI if the threading options are not separated. - for threading_opt in threading_opts: - b2("install", "threading=%s" % threading_opt, *b2_options) + if not self.spec.satisfies("platform=windows"): + for threading_opt in threading_opts: + b2("install", "threading=%s" % threading_opt, *b2_options) + else: + b2("install", *b2_options) if "+multithreaded" in spec and "~taggedlayout" in spec: self.add_buildopt_symlinks(prefix) diff --git a/var/spack/repos/builtin/packages/openblas/ifort-msvc.patch b/var/spack/repos/builtin/packages/openblas/ifort-msvc.patch new file mode 100644 index 00000000000..dd4c97fdd86 --- /dev/null +++ b/var/spack/repos/builtin/packages/openblas/ifort-msvc.patch @@ -0,0 +1,13 @@ +diff -ruN spack-src/cmake/fc.cmake spack-src-new/cmake/fc.cmake +--- spack-src/cmake/fc.cmake 2023-04-01 14:18:01.000000000 -0600 ++++ spack-src-new/cmake/fc.cmake 2023-06-06 09:34:12.921982500 -0600 +@@ -89,6 +89,9 @@ + + if (${F_COMPILER} STREQUAL "INTEL") + set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_INTEL") ++ if (MSVC) ++ set(FCOMMON_OPT "${FCOMMON_OPT} -names:uppercase -assume:underscore") ++ endif () + if (INTERFACE64) + set(FCOMMON_OPT "${FCOMMON_OPT} -i8") + endif () diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index 8b00d2983c6..e194a366e47 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -6,11 +6,13 @@ import os import re +import spack.build_systems.cmake +import spack.build_systems.makefile from spack.package import * from spack.package_test import compare_output_file, compile_c_and_execute -class Openblas(MakefilePackage): +class Openblas(CMakePackage, MakefilePackage): """OpenBLAS: An optimized BLAS library""" homepage = "https://www.openblas.net" @@ -19,7 +21,7 @@ class Openblas(MakefilePackage): ) git = "https://github.com/OpenMathLib/OpenBLAS.git" - libraries = ["libopenblas"] + libraries = ["libopenblas", "openblas"] version("develop", branch="develop") version("0.3.24", sha256="ceadc5065da97bd92404cac7254da66cc6eb192679cf1002098688978d4d5132") @@ -91,6 +93,9 @@ class Openblas(MakefilePackage): provides("lapack@3.9.1:", when="@0.3.15:") provides("lapack@3.7.0", when="@0.2.20") + # https://github.com/xianyi/OpenBLAS/pull/2519/files + patch("ifort-msvc.patch", when="%msvc") + # https://github.com/OpenMathLib/OpenBLAS/pull/3712 patch("cce.patch", when="@0.3.20 %cce") @@ -213,6 +218,8 @@ class Openblas(MakefilePackage): depends_on("perl", type="build") + build_system("makefile", "cmake", default="makefile") + def flag_handler(self, name, flags): spec = self.spec iflags = [] @@ -242,13 +249,37 @@ def check_compilers(self): # require both. # As of 08/2022 (0.3.21), we can build purely with a C compiler using # a f2c translated LAPACK version - # https://github.com/OpenMathLib/OpenBLAS/releases/tag/v0.3.21 + # https://github.com/xianyi/OpenBLAS/releases/tag/v0.3.21 if self.compiler.fc is None and "~fortran" not in self.spec: raise InstallError( self.compiler.cc + " has no Fortran compiler added in spack. Add it or use openblas~fortran!" ) + @property + def headers(self): + # The only public headers for cblas and lapacke in + # openblas are cblas.h and lapacke.h. The remaining headers are private + # headers either included in one of these two headers, or included in + # one of the source files implementing functions declared in these + # headers. + return find_headers(["cblas", "lapacke"], self.prefix.include) + + @property + def libs(self): + spec = self.spec + + # Look for openblas{symbol_suffix} + name = ["libopenblas", "openblas"] + search_shared = bool(spec.variants["shared"].value) + suffix = spec.variants["symbol_suffix"].value + if suffix != "none": + name += suffix + + return find_libraries(name, spec.prefix, shared=search_shared, recursive=True) + + +class MakefileBuilder(spack.build_systems.makefile.MakefileBuilder): @staticmethod def _read_targets(target_file): """Parse a list of available targets from the OpenBLAS/TargetList.txt @@ -304,7 +335,7 @@ def _microarch_target_args(self): if microarch.name in available_targets: break - if self.version >= Version("0.3"): + if self.spec.version >= Version("0.3"): # 'ARCH' argument causes build errors in older OpenBLAS # see https://github.com/spack/spack/issues/15385 arch_name = microarch.family.name @@ -379,9 +410,9 @@ def make_defs(self): if "~shared" in self.spec: if "+pic" in self.spec: - make_defs.append("CFLAGS={0}".format(self.compiler.cc_pic_flag)) + make_defs.append("CFLAGS={0}".format(self.pkg.compiler.cc_pic_flag)) if "~fortran" not in self.spec: - make_defs.append("FFLAGS={0}".format(self.compiler.f77_pic_flag)) + make_defs.append("FFLAGS={0}".format(self.pkg.compiler.f77_pic_flag)) make_defs += ["NO_SHARED=1"] # fix missing _dggsvd_ and _sggsvd_ if self.spec.satisfies("@0.2.16"): @@ -442,28 +473,6 @@ def make_defs(self): return make_defs - @property - def headers(self): - # As in netlib-lapack, the only public headers for cblas and lapacke in - # openblas are cblas.h and lapacke.h. The remaining headers are private - # headers either included in one of these two headers, or included in - # one of the source files implementing functions declared in these - # headers. - return find_headers(["cblas", "lapacke"], self.prefix.include) - - @property - def libs(self): - spec = self.spec - - # Look for openblas{symbol_suffix} - name = "libopenblas" - search_shared = bool(spec.variants["shared"].value) - suffix = spec.variants["symbol_suffix"].value - if suffix != "none": - name += suffix - - return find_libraries(name, spec.prefix, shared=search_shared, recursive=True) - @property def build_targets(self): return ["-s"] + self.make_defs + ["all"] @@ -499,3 +508,28 @@ def check_install(self): output = compile_c_and_execute(source_file, [include_flags], link_flags.split()) compare_output_file(output, blessed_file) + + +class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): + def cmake_args(self): + cmake_defs = [self.define("TARGET", "GENERIC")] + if self.spec.satisfies("platform=windows"): + cmake_defs += [ + self.define("DYNAMIC_ARCH", "OFF"), + self.define("BUILD_WITHOUT_LAPACK", "ON"), + ] + + if "~fortran" in self.spec: + cmake_defs += [self.define("NOFORTRAN", "ON")] + + if "+shared" in self.spec: + cmake_defs += [self.define("BUILD_SHARED_LIBS", "ON")] + + if self.spec.satisfies("threads=openmp"): + cmake_defs += [self.define("USE_OPENMP", "ON"), self.define("USE_THREAD", "ON")] + elif self.spec.satisfies("threads=pthreads"): + cmake_defs += [self.define("USE_OPENMP", "OFF"), self.define("USE_THREAD", "ON")] + else: + cmake_defs += [self.define("USE_OPENMP", "OFF"), self.define("USE_THREAD", "OFF")] + + return cmake_defs diff --git a/var/spack/repos/builtin/packages/pcre/package.py b/var/spack/repos/builtin/packages/pcre/package.py index 4e6e0473350..4719f5ea379 100644 --- a/var/spack/repos/builtin/packages/pcre/package.py +++ b/var/spack/repos/builtin/packages/pcre/package.py @@ -3,10 +3,12 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import spack.build_systems.autotools +import spack.build_systems.cmake from spack.package import * -class Pcre(AutotoolsPackage): +class Pcre(AutotoolsPackage, CMakePackage): """The PCRE package contains Perl Compatible Regular Expression libraries. These are useful for implementing regular expression pattern matching using the same syntax and semantics as Perl 5.""" @@ -26,6 +28,8 @@ class Pcre(AutotoolsPackage): maintainers("drkennetz") patch("intel.patch", when="@8.38") + build_system("autotools", "cmake", default="autotools") + variant("jit", default=False, description="Enable JIT support.") variant("multibyte", default=True, description="Enable support for 16 and 32 bit characters.") @@ -36,6 +40,8 @@ class Pcre(AutotoolsPackage): description="Enable support for UTF-8/16/32, " "incompatible with EBCDIC.", ) + +class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): def configure_args(self): args = [] @@ -51,3 +57,21 @@ def configure_args(self): args.append("--enable-unicode-properties") return args + + +class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): + def cmake_args(self): + args = [] + + if "+jit" in self.spec: + args.append("-DPCRE_SUPPORT_JIT:BOOL=ON") + + if "+multibyte" in self.spec: + args.append("-DPCRE_BUILD_PCRE16:BOOL=ON") + args.append("-DPCRE_BUILD_PCRE32:BOOL=ON") + + if "+utf" in self.spec: + args.append("-DPCRE_SUPPORT_UTF:BOOL=ON") + args.append("-DPCRE_SUPPORT_UNICODE_PROPERTIES:BOOL=ON") + + return args diff --git a/var/spack/repos/builtin/packages/superlu/package.py b/var/spack/repos/builtin/packages/superlu/package.py index fd7f66d4d0d..9ad86ab2193 100644 --- a/var/spack/repos/builtin/packages/superlu/package.py +++ b/var/spack/repos/builtin/packages/superlu/package.py @@ -46,6 +46,8 @@ class Superlu(CMakePackage, Package): conditional("cmake", when="@5:"), conditional("generic", when="@:4"), default="cmake" ) + requires("build_system=cmake", when="platform=windows") + variant("pic", default=True, description="Build with position independent code") depends_on("blas") diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 20a8d290e25..28f68b1b488 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import pathlib import sys from spack.build_environment import dso_suffix @@ -366,6 +367,18 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): conflicts("+stokhos", when="%xl") conflicts("+stokhos", when="%xl_r") + # Current Windows support, only have serial static builds + conflicts( + "+shared", + when="platform=windows", + msg="Only static builds are supported on Windows currently.", + ) + conflicts( + "+mpi", + when="platform=windows", + msg="Only serial builds are supported on Windows currently.", + ) + # ###################### Dependencies ########################## # External Kokkos @@ -393,7 +406,9 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): depends_on("cgns", when="+exodus") depends_on("cmake@3.23:", type="build", when="@14.0.0:") depends_on("hdf5+hl", when="+hdf5") - depends_on("hypre~internal-superlu~int64", when="+hypre") + for plat in ["cray", "darwin", "linux"]: + depends_on("hypre~internal-superlu~int64", when="+hypre platform=%s" % plat) + depends_on("hypre-cmake~int64", when="+hypre platform=windows") depends_on("kokkos-nvcc-wrapper", when="+wrapper") depends_on("lapack") # depends_on('perl', type=('build',)) # TriBITS finds but doesn't use... @@ -811,7 +826,7 @@ def define_tpl(trilinos_name, spack_name, have_dep): define("CMAKE_C_COMPILER", spec["mpi"].mpicc), define("CMAKE_CXX_COMPILER", spec["mpi"].mpicxx), define("CMAKE_Fortran_COMPILER", spec["mpi"].mpifc), - define("MPI_BASE_DIR", spec["mpi"].prefix), + define("MPI_BASE_DIR", str(pathlib.PurePosixPath(spec["mpi"].prefix))), ] ) From b6f08f1d4ef3b0ca56430c1a465d660828b45ed2 Mon Sep 17 00:00:00 2001 From: Vicente Bolea Date: Wed, 27 Sep 2023 12:13:18 -0400 Subject: [PATCH 27/34] vtk-m: add VTK-m 2.1.0-rc1 (#39581) --- var/spack/repos/builtin/packages/vtk-m/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/vtk-m/package.py b/var/spack/repos/builtin/packages/vtk-m/package.py index 18586846262..a8d350d028a 100644 --- a/var/spack/repos/builtin/packages/vtk-m/package.py +++ b/var/spack/repos/builtin/packages/vtk-m/package.py @@ -29,6 +29,7 @@ class VtkM(CMakePackage, CudaPackage, ROCmPackage): version("master", branch="master") version("release", branch="release") + version("2.1.0-rc1", sha256="337df672ac5c2e0b442571a1380aa98ae70a155c93488c32198d055cb893417a") version( "2.0.0", sha256="32643cf3564fa77f8e2a2a5456a574b6b2355bb68918eb62ccde493993ade1a3", From ebc0e9be1971c5670b6a9f9d6ffd0b4b1c2354bb Mon Sep 17 00:00:00 2001 From: Sam Gillingham Date: Thu, 28 Sep 2023 11:08:28 +1000 Subject: [PATCH 28/34] kealib: add 1.5.1 and 1.5.2 versions (#40202) * add recent kealib versions * udpdate depends_on so hl not required for latest version --- var/spack/repos/builtin/packages/kealib/package.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/kealib/package.py b/var/spack/repos/builtin/packages/kealib/package.py index d4b17a7fb92..3d9bdd7629c 100644 --- a/var/spack/repos/builtin/packages/kealib/package.py +++ b/var/spack/repos/builtin/packages/kealib/package.py @@ -24,12 +24,14 @@ class Kealib(CMakePackage): """ homepage = "http://www.kealib.org/" - url = "https://github.com/ubarsc/kealib/releases/download/kealib-1.5.0/kealib-1.5.0.tar.gz" + url = "https://github.com/ubarsc/kealib/releases/download/kealib-1.5.2/kealib-1.5.2.tar.gz" git = "https://github.com/ubarsc/kealib" maintainers("gillins", "neilflood", "petebunting") version("develop", git=git) + version("1.5.2", sha256="c4e17c472761a39e45184b5fa687395b319ac75430e0f6584dbf4cec6e335572") + version("1.5.1", sha256="06cd547b1e40394b9539beaf6982bd249e8ee93d6150295e9cd9161d00829657") version("1.5.0", sha256="d19a0fb051019f87fe413bda76472bf4fff8fca52ede92e0ffd983caeafd05b8") version("1.4.15", sha256="40f2573c00f005f93c1fa88f1f13bfbd485cbc7a9b3f1c706931e69bff17dae4") version("1.4.12", sha256="0b100e36b3e25e57487aa197d7be47f22e1b30afb16a57fdaa5f877696ec321e") @@ -39,8 +41,9 @@ class Kealib(CMakePackage): version("1.4.8", sha256="0f24d8478865abcb17865c8f49c0370095726c529b8ac373ffae018ad3d40a02") version("1.4.7", sha256="ec38751b3b555d3a26f0c7445f2d2cd9d7c3a3502237519a206a50cb58df56ec") - depends_on("cmake@2.8.10:", type="build") - depends_on("hdf5+cxx+hl") + depends_on("cmake@3.5:", type="build") + depends_on("hdf5+cxx+hl", when="@:1.5.1") + depends_on("hdf5+cxx", when="@1.5.2:") patch("cmake.patch", when="@1.4.7") From bf8e8d9f5f7f5456edddd0deaceb9a59fe1eba3e Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 28 Sep 2023 11:06:28 +0200 Subject: [PATCH 29/34] cmake: add v3.27.6 (#40037) Co-authored-by: Harmen Stoppels --- var/spack/repos/builtin/packages/cmake/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py index 9f0dfe86a53..c4c61aee82a 100644 --- a/var/spack/repos/builtin/packages/cmake/package.py +++ b/var/spack/repos/builtin/packages/cmake/package.py @@ -27,6 +27,7 @@ class Cmake(Package): executables = ["^cmake[0-9]*$"] version("master", branch="master") + version("3.27.6", sha256="ef3056df528569e0e8956f6cf38806879347ac6de6a4ff7e4105dc4578732cfb") version("3.27.4", sha256="0a905ca8635ca81aa152e123bdde7e54cbe764fdd9a70d62af44cad8b92967af") version("3.27.3", sha256="66afdc0f181461b70b6fedcde9ecc4226c5cd184e7203617c83b7d8e47f49521") version("3.27.2", sha256="798e50085d423816fe96c9ef8bee5e50002c9eca09fed13e300de8a91d35c211") From fba47e87d7ff3fd387ee07e13b8c420090d2d661 Mon Sep 17 00:00:00 2001 From: Brian Vanderwende Date: Thu, 28 Sep 2023 04:52:22 -0600 Subject: [PATCH 30/34] Support optional vars script arguments (#40064) --- lib/spack/spack/build_systems/oneapi.py | 7 ++++++- .../repos/builtin/packages/intel-oneapi-mpi/package.py | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py index fddbd3410c7..1961eb312ce 100644 --- a/lib/spack/spack/build_systems/oneapi.py +++ b/lib/spack/spack/build_systems/oneapi.py @@ -61,6 +61,11 @@ def component_prefix(self): """Path to component //.""" return self.prefix.join(join_path(self.component_dir, self.spec.version)) + @property + def env_script_args(self): + """Additional arguments to pass to vars.sh script.""" + return () + def install(self, spec, prefix): self.install_component(basename(self.url_for_version(spec.version))) @@ -124,7 +129,7 @@ def setup_run_environment(self, env): if "~envmods" not in self.spec: env.extend( EnvironmentModifications.from_sourcing_file( - join_path(self.component_prefix, "env", "vars.sh") + join_path(self.component_prefix, "env", "vars.sh"), *self.env_script_args ) ) diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py index 5651544401b..fab6c8ca1f4 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py @@ -111,6 +111,13 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): def component_dir(self): return "mpi" + @property + def env_script_args(self): + if "+external-libfabric" in self.spec: + return ("-i_mpi_ofi_internal=0",) + else: + return () + def setup_dependent_package(self, module, dep_spec): if "+generic-names" in self.spec: self.spec.mpicc = join_path(self.component_prefix.bin, "mpicc") From 78132f2d6b0529cb2280f91d77026340c19f322e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 28 Sep 2023 13:30:43 +0200 Subject: [PATCH 31/34] glibc: dont link libgcc_eh.a pre 2.17, and backport at_random auxval patch (#40013) This resolves an interesting circular dependency between gcc and glibc: 1. glibc < 2.17 depends on libgcc.a and libgcc_eh.a 2. libgcc_eh.a is only built when gcc is configured with --enable-shared 3. but building shared libraries requires crt*.o and libc.so Backport AT_RANDOM auxval changes to avoid dealing with wrong inline assembly (fallback code fails on ubuntu 23.04) --- .../builtin/packages/glibc/95f5a9a-2.11.patch | 194 ++++++++++++++++ .../builtin/packages/glibc/95f5a9a-2.13.patch | 195 ++++++++++++++++ .../builtin/packages/glibc/95f5a9a-2.15.patch | 211 +++++++++++++++++ .../builtin/packages/glibc/95f5a9a-2.16.patch | 214 ++++++++++++++++++ .../builtin/packages/glibc/95f5a9a-stub.patch | 57 +++++ .../builtin/packages/glibc/965cb60-2.5.patch | 176 ++++++++++++++ .../builtin/packages/glibc/965cb60-2.6.patch | 176 ++++++++++++++ .../builtin/packages/glibc/965cb60-2.7.patch | 174 ++++++++++++++ .../builtin/packages/glibc/965cb60.patch | 205 +++++++++++++++++ .../repos/builtin/packages/glibc/package.py | 26 ++- 10 files changed, 1623 insertions(+), 5 deletions(-) create mode 100644 var/spack/repos/builtin/packages/glibc/95f5a9a-2.11.patch create mode 100644 var/spack/repos/builtin/packages/glibc/95f5a9a-2.13.patch create mode 100644 var/spack/repos/builtin/packages/glibc/95f5a9a-2.15.patch create mode 100644 var/spack/repos/builtin/packages/glibc/95f5a9a-2.16.patch create mode 100644 var/spack/repos/builtin/packages/glibc/95f5a9a-stub.patch create mode 100644 var/spack/repos/builtin/packages/glibc/965cb60-2.5.patch create mode 100644 var/spack/repos/builtin/packages/glibc/965cb60-2.6.patch create mode 100644 var/spack/repos/builtin/packages/glibc/965cb60-2.7.patch create mode 100644 var/spack/repos/builtin/packages/glibc/965cb60.patch diff --git a/var/spack/repos/builtin/packages/glibc/95f5a9a-2.11.patch b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.11.patch new file mode 100644 index 00000000000..bb73cf44d76 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.11.patch @@ -0,0 +1,194 @@ +From 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 3 Jul 2012 19:14:59 +0000 +Subject: [PATCH] Avoid use of libgcc_s and libgcc_eh when building glibc. + +diff --git a/Makeconfig b/Makeconfig +index 47638b13c6..6384e22a72 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -423,7 +423,7 @@ endif + + # Command for linking programs with the C library. + ifndef +link +-+link = $(CC) -nostdlib -nostartfiles -o $@ \ +++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ + $(addprefix $(csu-objpfx),$(start-installed-name)) \ +@@ -432,7 +432,10 @@ ifndef +link + $(start-installed-name))\ + $(+preinit) $(link-extra-libs) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) ++ $(link-extra-libs) +++link-after-libc = $(+postctor) $(+postinit) +++link = $(+link-before-libc) $(link-libc) $(+link-after-libc) +++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc) + endif + # Command for linking PIE programs with the C library. + ifndef +link-pie +@@ -449,7 +452,7 @@ ifndef +link-pie + endif + # Command for statically linking programs with the C library. + ifndef +link-static +-+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ +++link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ + $(+preinit) $(+prector) \ +@@ -457,7 +460,12 @@ ifndef +link-static + $(start-installed-name))\ + $(+preinit) $(link-extra-libs-static) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) ++ $(link-extra-libs-static) $(link-libc-static) +++link-static-after-libc = $(+postctor) $(+postinit) +++link-static = $(+link-static-before-libc) $(link-libc-static) \ ++ $(+link-static-after-libc) +++link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \ ++ $(+link-static-after-libc) + endif + # Command for statically linking bounded-pointer programs with the C library. + ifndef +link-bounded +@@ -482,9 +490,11 @@ ifeq ($(elf),yes) + # We need the versioned name of libc.so in the deps of $(others) et al + # so that the symlink to libc.so is created before anything tries to + # run the linked programs. +-link-libc = -Wl,-rpath-link=$(rpath-link) \ ++link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) ++ $(common-objpfx)$(patsubst %,$(libtype.oS),c) ++link-libc = $(link-libc-before-gnulib) $(gnulib) ++link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -495,6 +505,7 @@ else + nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) + resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) + link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) ++link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) + endif + endif + +@@ -523,6 +534,7 @@ endif + # The static libraries. + ifeq (yes,$(build-static)) + link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static-tests = $(common-objpfx)libc.a $(static-gnulib-tests) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +@@ -542,8 +554,12 @@ ifneq ($(have-as-needed),yes) + else + libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed + endif +-gnulib := -lgcc $(libgcc_eh) +-static-gnulib := -lgcc -lgcc_eh $(libunwind) ++gnulib-arch = ++gnulib = -lgcc $(gnulib-arch) ++gnulib-tests := -lgcc $(libgcc_eh) ++static-gnulib-arch = ++static-gnulib = -lgcc $(static-gnulib-arch) ++static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) + libc.so-gnulib := -lgcc + endif + ifeq ($(elf),yes) +diff --git a/Rules b/Rules +index 5ace24cee0..45eb7541dc 100644 +--- a/Rules ++++ b/Rules +@@ -104,29 +104,52 @@ xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out) + endif + + ifeq ($(build-programs),yes) +-binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) +-binaries-static = $(others-static) $(tests-static) $(xtests-static) ++binaries-all-notests = $(others) $(sysdep-others) ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-notests) $(binaries-all-tests) ++binaries-static-notests = $(others-static) ++binaries-static-tests = $(tests-static) $(xtests-static) ++binaries-static = $(binaries-static-notests) $(binaries-static-tests) + else +-binaries-all = $(tests) $(xtests) $(test-srcs) ++binaries-all-notests = ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-tests) ++binaries-static-notests = ++binaries-static-tests = + binaries-static = + endif + +-binaries-shared = $(filter-out $(binaries-static), $(binaries-all)) ++binaries-shared-tests = $(filter-out $(binaries-static), $(binaries-all-tests)) ++binaries-shared-notests = $(filter-out $(binaries-static), $(binaries-all-notests)) + +-ifneq "$(strip $(binaries-shared))" "" +-$(addprefix $(objpfx),$(binaries-shared)): %: %.o \ ++ifneq "$(strip $(binaries-shared-notests))" "" ++$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link) + endif + +-ifneq "$(strip $(binaries-static))" "" +-$(addprefix $(objpfx),$(binaries-static)): %: %.o \ ++ifneq "$(strip $(binaries-shared-tests))" "" ++$(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-tests) ++endif ++ ++ifneq "$(strip $(binaries-static-notests))" "" ++$(addprefix $(objpfx),$(binaries-static-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-static) + endif + ++ifneq "$(strip $(binaries-static-tests))" "" ++$(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-static-tests) ++endif ++ + ifeq ($(build-bounded),yes) + binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs)) + $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \ +diff --git a/elf/Makefile b/elf/Makefile +index 34609a0f85..84709920e8 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -150,6 +150,8 @@ others = sprof sln + install-bin = sprof + others-static = sln + install-rootsbin = sln ++sln-modules := static-stubs ++extra-objs += $(sln-modules:=.o) + + ifeq (yes,$(use-ldconfig)) + ifeq (yes,$(build-shared)) +@@ -157,7 +159,7 @@ others-static += ldconfig + others += ldconfig + install-rootsbin += ldconfig + +-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon ++ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs + extra-objs += $(ldconfig-modules:=.o) + + # To find xmalloc.c and xstrdup.c +@@ -448,6 +450,8 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \ + + $(objpfx)sprof: $(libdl) + ++$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o) ++ + $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o) + SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"' + CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \ diff --git a/var/spack/repos/builtin/packages/glibc/95f5a9a-2.13.patch b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.13.patch new file mode 100644 index 00000000000..346d87fa0e4 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.13.patch @@ -0,0 +1,195 @@ +From 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 3 Jul 2012 19:14:59 +0000 +Subject: [PATCH] Avoid use of libgcc_s and libgcc_eh when building glibc. + +diff --git a/Makeconfig b/Makeconfig +index e5cbf646fa..870a4bec4f 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -431,7 +431,7 @@ endif + + # Command for linking programs with the C library. + ifndef +link +-+link = $(CC) -nostdlib -nostartfiles -o $@ \ +++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ + $(addprefix $(csu-objpfx),$(start-installed-name)) \ +@@ -440,7 +440,10 @@ ifndef +link + $(start-installed-name))\ + $(+preinit) $(link-extra-libs) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) ++ $(link-extra-libs) +++link-after-libc = $(+postctor) $(+postinit) +++link = $(+link-before-libc) $(link-libc) $(+link-after-libc) +++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc) + endif + # Command for linking PIE programs with the C library. + ifndef +link-pie +@@ -457,7 +460,7 @@ ifndef +link-pie + endif + # Command for statically linking programs with the C library. + ifndef +link-static +-+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ +++link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ + $(+preinit) $(+prector) \ +@@ -465,7 +468,12 @@ ifndef +link-static + $(start-installed-name))\ + $(+preinit) $(link-extra-libs-static) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) ++ $(link-extra-libs-static) $(link-libc-static) +++link-static-after-libc = $(+postctor) $(+postinit) +++link-static = $(+link-static-before-libc) $(link-libc-static) \ ++ $(+link-static-after-libc) +++link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \ ++ $(+link-static-after-libc) + endif + # Command for statically linking bounded-pointer programs with the C library. + ifndef +link-bounded +@@ -490,10 +498,12 @@ ifeq ($(elf),yes) + # We need the versioned name of libc.so in the deps of $(others) et al + # so that the symlink to libc.so is created before anything tries to + # run the linked programs. +-link-libc = -Wl,-rpath-link=$(rpath-link) \ ++link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ + $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ +- $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib) ++ $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) ++link-libc = $(link-libc-before-gnulib) $(gnulib) ++link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -504,6 +514,7 @@ else + nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) + resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) + link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) ++link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) + endif + endif + +@@ -532,6 +543,7 @@ endif + # The static libraries. + ifeq (yes,$(build-static)) + link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static-tests = $(common-objpfx)libc.a $(static-gnulib-tests) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +@@ -551,8 +563,12 @@ ifneq ($(have-as-needed),yes) + else + libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed + endif +-gnulib := -lgcc $(libgcc_eh) +-static-gnulib := -lgcc -lgcc_eh $(libunwind) ++gnulib-arch = ++gnulib = -lgcc $(gnulib-arch) ++gnulib-tests := -lgcc $(libgcc_eh) ++static-gnulib-arch = ++static-gnulib = -lgcc $(static-gnulib-arch) ++static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) + libc.so-gnulib := -lgcc + endif + ifeq ($(elf),yes) +diff --git a/Rules b/Rules +index 5ace24cee0..45eb7541dc 100644 +--- a/Rules ++++ b/Rules +@@ -104,29 +104,52 @@ xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out) + endif + + ifeq ($(build-programs),yes) +-binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) +-binaries-static = $(others-static) $(tests-static) $(xtests-static) ++binaries-all-notests = $(others) $(sysdep-others) ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-notests) $(binaries-all-tests) ++binaries-static-notests = $(others-static) ++binaries-static-tests = $(tests-static) $(xtests-static) ++binaries-static = $(binaries-static-notests) $(binaries-static-tests) + else +-binaries-all = $(tests) $(xtests) $(test-srcs) ++binaries-all-notests = ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-tests) ++binaries-static-notests = ++binaries-static-tests = + binaries-static = + endif + +-binaries-shared = $(filter-out $(binaries-static), $(binaries-all)) ++binaries-shared-tests = $(filter-out $(binaries-static), $(binaries-all-tests)) ++binaries-shared-notests = $(filter-out $(binaries-static), $(binaries-all-notests)) + +-ifneq "$(strip $(binaries-shared))" "" +-$(addprefix $(objpfx),$(binaries-shared)): %: %.o \ ++ifneq "$(strip $(binaries-shared-notests))" "" ++$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link) + endif + +-ifneq "$(strip $(binaries-static))" "" +-$(addprefix $(objpfx),$(binaries-static)): %: %.o \ ++ifneq "$(strip $(binaries-shared-tests))" "" ++$(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-tests) ++endif ++ ++ifneq "$(strip $(binaries-static-notests))" "" ++$(addprefix $(objpfx),$(binaries-static-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-static) + endif + ++ifneq "$(strip $(binaries-static-tests))" "" ++$(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-static-tests) ++endif ++ + ifeq ($(build-bounded),yes) + binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs)) + $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \ +diff --git a/elf/Makefile b/elf/Makefile +index 2d2d568013..fe1924ebd4 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -150,6 +150,8 @@ others = sprof sln + install-bin = sprof + others-static = sln + install-rootsbin = sln ++sln-modules := static-stubs ++extra-objs += $(sln-modules:=.o) + + ifeq (yes,$(use-ldconfig)) + ifeq (yes,$(build-shared)) +@@ -157,7 +159,7 @@ others-static += ldconfig + others += ldconfig + install-rootsbin += ldconfig + +-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon ++ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs + extra-objs += $(ldconfig-modules:=.o) + + # To find xmalloc.c and xstrdup.c +@@ -458,6 +460,8 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \ + + $(objpfx)sprof: $(libdl) + ++$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o) ++ + $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o) + SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"' + CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \ diff --git a/var/spack/repos/builtin/packages/glibc/95f5a9a-2.15.patch b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.15.patch new file mode 100644 index 00000000000..3fecf3a3c80 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.15.patch @@ -0,0 +1,211 @@ +From 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 3 Jul 2012 19:14:59 +0000 +Subject: [PATCH] Avoid use of libgcc_s and libgcc_eh when building glibc. + +diff --git a/Makeconfig b/Makeconfig +index 8195245052..b23cee8723 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -447,7 +447,7 @@ endif + + # Command for linking programs with the C library. + ifndef +link +-+link = $(CC) -nostdlib -nostartfiles -o $@ \ +++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ + $(addprefix $(csu-objpfx),$(start-installed-name)) \ +@@ -456,7 +456,10 @@ ifndef +link + $(start-installed-name))\ + $(+preinit) $(link-extra-libs) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) ++ $(link-extra-libs) +++link-after-libc = $(+postctor) $(+postinit) +++link = $(+link-before-libc) $(link-libc) $(+link-after-libc) +++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc) + endif + # Command for linking PIE programs with the C library. + ifndef +link-pie +@@ -473,7 +476,7 @@ ifndef +link-pie + endif + # Command for statically linking programs with the C library. + ifndef +link-static +-+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ +++link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ + $(+preinit) $(+prector) \ +@@ -481,7 +484,12 @@ ifndef +link-static + $(start-installed-name))\ + $(+preinit) $(link-extra-libs-static) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) ++ $(link-extra-libs-static) $(link-libc-static) +++link-static-after-libc = $(+postctor) $(+postinit) +++link-static = $(+link-static-before-libc) $(link-libc-static) \ ++ $(+link-static-after-libc) +++link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \ ++ $(+link-static-after-libc) + endif + # Command for statically linking bounded-pointer programs with the C library. + ifndef +link-bounded +@@ -506,10 +514,12 @@ ifeq ($(elf),yes) + # We need the versioned name of libc.so in the deps of $(others) et al + # so that the symlink to libc.so is created before anything tries to + # run the linked programs. +-link-libc = -Wl,-rpath-link=$(rpath-link) \ ++link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ + $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ +- $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib) ++ $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) ++link-libc = $(link-libc-before-gnulib) $(gnulib) ++link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -520,6 +530,7 @@ else + nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) + resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) + link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) ++link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) + endif + endif + +@@ -548,6 +559,7 @@ endif + # The static libraries. + ifeq (yes,$(build-static)) + link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group ++link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +@@ -567,8 +579,12 @@ ifneq ($(have-as-needed),yes) + else + libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed + endif +-gnulib := -lgcc $(libgcc_eh) +-static-gnulib := -lgcc -lgcc_eh $(libunwind) ++gnulib-arch = ++gnulib = -lgcc $(gnulib-arch) ++gnulib-tests := -lgcc $(libgcc_eh) ++static-gnulib-arch = ++static-gnulib = -lgcc $(static-gnulib-arch) ++static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) + libc.so-gnulib := -lgcc + endif + ifeq ($(elf),yes) +diff --git a/Rules b/Rules +index 00f03df6da..4a31d2905c 100644 +--- a/Rules ++++ b/Rules +@@ -104,29 +104,46 @@ xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out) + endif + + ifeq ($(build-programs),yes) +-binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) +-binaries-static = $(others-static) $(tests-static) $(xtests-static) ++binaries-all-notests = $(others) $(sysdep-others) ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-notests) $(binaries-all-tests) ++binaries-static-notests = $(others-static) ++binaries-static-tests = $(tests-static) $(xtests-static) ++binaries-static = $(binaries-static-notests) $(binaries-static-tests) + ifeq (yesyes,$(have-fpie)$(build-shared)) + binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie) + else + binaries-pie = + endif + else +-binaries-all = $(tests) $(xtests) $(test-srcs) ++binaries-all-notests = ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-tests) ++binaries-static-notests = ++binaries-static-tests = + binaries-static = + binaries-pie = + endif + +-binaries-shared = $(filter-out $(binaries-pie) $(binaries-static), \ +- $(binaries-all)) ++binaries-shared-tests = $(filter-out $(binaries-pie) $(binaries-static), \ ++ $(binaries-all-tests)) ++binaries-shared-notests = $(filter-out $(binaries-pie) $(binaries-static), \ ++ $(binaries-all-notests)) + +-ifneq "$(strip $(binaries-shared))" "" +-$(addprefix $(objpfx),$(binaries-shared)): %: %.o \ ++ifneq "$(strip $(binaries-shared-notests))" "" ++$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link) + endif + ++ifneq "$(strip $(binaries-shared-tests))" "" ++$(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-tests) ++endif ++ + ifneq "$(strip $(binaries-pie))" "" + $(addprefix $(objpfx),$(binaries-pie)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ +@@ -134,13 +151,20 @@ $(addprefix $(objpfx),$(binaries-pie)): %: %.o \ + $(+link-pie) + endif + +-ifneq "$(strip $(binaries-static))" "" +-$(addprefix $(objpfx),$(binaries-static)): %: %.o \ ++ifneq "$(strip $(binaries-static-notests))" "" ++$(addprefix $(objpfx),$(binaries-static-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-static) + endif + ++ifneq "$(strip $(binaries-static-tests))" "" ++$(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-static-tests) ++endif ++ + ifeq ($(build-bounded),yes) + binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs)) + $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \ +diff --git a/elf/Makefile b/elf/Makefile +index f20f52dee1..64555b9243 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -156,6 +156,8 @@ others = sprof sln pldd + install-bin = sprof pldd + others-static = sln + install-rootsbin = sln ++sln-modules := static-stubs ++extra-objs += $(sln-modules:=.o) + + ifeq (yes,$(use-ldconfig)) + ifeq (yes,$(build-shared)) +@@ -163,7 +165,7 @@ others-static += ldconfig + others += ldconfig + install-rootsbin += ldconfig + +-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon ++ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs + extra-objs += $(ldconfig-modules:=.o) + + pldd-modules := xmalloc +@@ -495,6 +497,8 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \ + + $(objpfx)sprof: $(libdl) + ++$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o) ++ + $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o) + + $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o) diff --git a/var/spack/repos/builtin/packages/glibc/95f5a9a-2.16.patch b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.16.patch new file mode 100644 index 00000000000..4c2c77edb4a --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/95f5a9a-2.16.patch @@ -0,0 +1,214 @@ +From 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 3 Jul 2012 19:14:59 +0000 +Subject: [PATCH] Avoid use of libgcc_s and libgcc_eh when building glibc. + +diff --git a/Makeconfig b/Makeconfig +index 417fa508a6..c860e68cdd 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -415,9 +415,9 @@ LDFLAGS.so += $(hashstyle-LDFLAGS) + LDFLAGS-rtld += $(hashstyle-LDFLAGS) + endif + +-# Command for linking programs with the C library. ++# Commands for linking programs with the C library. + ifndef +link +-+link = $(CC) -nostdlib -nostartfiles -o $@ \ +++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ + $(addprefix $(csu-objpfx),$(start-installed-name)) \ +@@ -426,7 +426,10 @@ ifndef +link + $(start-installed-name))\ + $(+preinit) $(link-extra-libs) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) ++ $(link-extra-libs) +++link-after-libc = $(+postctor) $(+postinit) +++link = $(+link-before-libc) $(link-libc) $(+link-after-libc) +++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc) + endif + # Command for linking PIE programs with the C library. + ifndef +link-pie +@@ -443,7 +446,7 @@ ifndef +link-pie + endif + # Command for statically linking programs with the C library. + ifndef +link-static +-+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ +++link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ + $(+preinit) $(+prector) \ +@@ -451,7 +454,12 @@ ifndef +link-static + $(start-installed-name))\ + $(+preinit) $(link-extra-libs-static) \ + $(common-objpfx)libc% $(+postinit),$^) \ +- $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) ++ $(link-extra-libs-static) $(link-libc-static) +++link-static-after-libc = $(+postctor) $(+postinit) +++link-static = $(+link-static-before-libc) $(link-libc-static) \ ++ $(+link-static-after-libc) +++link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \ ++ $(+link-static-after-libc) + endif + # Command for statically linking bounded-pointer programs with the C library. + ifndef +link-bounded +@@ -475,10 +483,12 @@ ifeq (yes,$(build-shared)) + # We need the versioned name of libc.so in the deps of $(others) et al + # so that the symlink to libc.so is created before anything tries to + # run the linked programs. +-link-libc = -Wl,-rpath-link=$(rpath-link) \ ++link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ + $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ +- $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib) ++ $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) ++link-libc = $(link-libc-before-gnulib) $(gnulib) ++link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + rpath-link = \ +@@ -488,6 +498,7 @@ else + nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) + resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) + link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) ++link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) + endif + endif + +@@ -513,6 +524,7 @@ endif + + # The static libraries. + link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group ++link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group + link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a + + ifndef gnulib +@@ -522,8 +534,12 @@ else + libunwind = -lunwind + endif + libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed +-gnulib := -lgcc $(libgcc_eh) +-static-gnulib := -lgcc -lgcc_eh $(libunwind) ++gnulib-arch = ++gnulib = -lgcc $(gnulib-arch) ++gnulib-tests := -lgcc $(libgcc_eh) ++static-gnulib-arch = ++static-gnulib = -lgcc $(static-gnulib-arch) ++static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) + libc.so-gnulib := -lgcc + endif + +preinit = $(addprefix $(csu-objpfx),crti.o) +diff --git a/Rules b/Rules +index 3c61a2933b..be3a738574 100644 +--- a/Rules ++++ b/Rules +@@ -103,29 +103,46 @@ xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out) + endif + + ifeq ($(build-programs),yes) +-binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) +-binaries-static = $(others-static) $(tests-static) $(xtests-static) ++binaries-all-notests = $(others) $(sysdep-others) ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-notests) $(binaries-all-tests) ++binaries-static-notests = $(others-static) ++binaries-static-tests = $(tests-static) $(xtests-static) ++binaries-static = $(binaries-static-notests) $(binaries-static-tests) + ifeq (yesyes,$(have-fpie)$(build-shared)) + binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie) + else + binaries-pie = + endif + else +-binaries-all = $(tests) $(xtests) $(test-srcs) ++binaries-all-notests = ++binaries-all-tests = $(tests) $(xtests) $(test-srcs) ++binaries-all = $(binaries-all-tests) ++binaries-static-notests = ++binaries-static-tests = + binaries-static = + binaries-pie = + endif + +-binaries-shared = $(filter-out $(binaries-pie) $(binaries-static), \ +- $(binaries-all)) ++binaries-shared-tests = $(filter-out $(binaries-pie) $(binaries-static), \ ++ $(binaries-all-tests)) ++binaries-shared-notests = $(filter-out $(binaries-pie) $(binaries-static), \ ++ $(binaries-all-notests)) + +-ifneq "$(strip $(binaries-shared))" "" +-$(addprefix $(objpfx),$(binaries-shared)): %: %.o \ ++ifneq "$(strip $(binaries-shared-notests))" "" ++$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link) + endif + ++ifneq "$(strip $(binaries-shared-tests))" "" ++$(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-tests) ++endif ++ + ifneq "$(strip $(binaries-pie))" "" + $(addprefix $(objpfx),$(binaries-pie)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ +@@ -133,13 +150,20 @@ $(addprefix $(objpfx),$(binaries-pie)): %: %.o \ + $(+link-pie) + endif + +-ifneq "$(strip $(binaries-static))" "" +-$(addprefix $(objpfx),$(binaries-static)): %: %.o \ ++ifneq "$(strip $(binaries-static-notests))" "" ++$(addprefix $(objpfx),$(binaries-static-notests)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-static) + endif + ++ifneq "$(strip $(binaries-static-tests))" "" ++$(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-static-tests) ++endif ++ + ifeq ($(build-bounded),yes) + binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs)) + $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \ +diff --git a/elf/Makefile b/elf/Makefile +index 0c26ce545a..90541991d2 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -71,6 +71,8 @@ others = sprof sln pldd + install-bin = sprof pldd + others-static = sln + install-rootsbin = sln ++sln-modules := static-stubs ++extra-objs += $(sln-modules:=.o) + + ifeq (yes,$(use-ldconfig)) + ifeq (yes,$(build-shared)) +@@ -78,7 +80,7 @@ others-static += ldconfig + others += ldconfig + install-rootsbin += ldconfig + +-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon ++ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs + extra-objs += $(ldconfig-modules:=.o) + endif + endif +@@ -411,6 +413,8 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \ + + $(objpfx)sprof: $(libdl) + ++$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o) ++ + $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o) + + $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o) diff --git a/var/spack/repos/builtin/packages/glibc/95f5a9a-stub.patch b/var/spack/repos/builtin/packages/glibc/95f5a9a-stub.patch new file mode 100644 index 00000000000..da25ce77ade --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/95f5a9a-stub.patch @@ -0,0 +1,57 @@ +From 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 3 Jul 2012 19:14:59 +0000 +Subject: [PATCH] Avoid use of libgcc_s and libgcc_eh when building glibc. + +diff --git a/elf/static-stubs.c b/elf/static-stubs.c +new file mode 100644 +index 0000000000..6c5eebc3fb +--- /dev/null ++++ b/elf/static-stubs.c +@@ -0,0 +1,46 @@ ++/* Stub implementations of functions to link into statically linked ++ programs without needing libgcc_eh. ++ Copyright (C) 2012 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Avoid backtrace (and so _Unwind_Backtrace) dependencies from ++ sysdeps/unix/sysv/linux/libc_fatal.c. */ ++#include ++ ++#include ++#include ++ ++/* These programs do not use thread cancellation, so _Unwind_Resume ++ and the personality routine are never actually called. */ ++ ++void ++_Unwind_Resume (struct _Unwind_Exception *exc __attribute__ ((unused))) ++{ ++ abort (); ++} ++ ++_Unwind_Reason_Code ++__gcc_personality_v0 (int version __attribute__ ((unused)), ++ _Unwind_Action actions __attribute__ ((unused)), ++ _Unwind_Exception_Class exception_class ++ __attribute__ ((unused)), ++ struct _Unwind_Exception *ue_header ++ __attribute__ ((unused)), ++ struct _Unwind_Context *context __attribute__ ((unused))) ++{ ++ abort (); ++} diff --git a/var/spack/repos/builtin/packages/glibc/965cb60-2.5.patch b/var/spack/repos/builtin/packages/glibc/965cb60-2.5.patch new file mode 100644 index 00000000000..e998379ce60 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/965cb60-2.5.patch @@ -0,0 +1,176 @@ +diff --git a/csu/libc-start.c b/csu/libc-start.c +index 194db6b1ec..f85ec9604e 100644 +--- a/csu/libc-start.c ++++ b/csu/libc-start.c +@@ -151,8 +151,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), + + # ifndef SHARED + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); +-# ifdef THREAD_SET_STACK_GUARD ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); ++# ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + # else + __stack_chk_guard = stack_chk_guard; +diff --git a/elf/dl-support.c b/elf/dl-support.c +index 4b7be6bc27..f62867abf1 100644 +--- a/elf/dl-support.c ++++ b/elf/dl-support.c +@@ -84,6 +84,9 @@ struct r_scope_elem _dl_initial_searchlist; + int _dl_starting_up = 1; + #endif + ++/* Random data provided by the kernel. */ ++void *_dl_random; ++ + /* Get architecture specific initializer. */ + #include + +@@ -218,6 +221,9 @@ _dl_aux_init (ElfW(auxv_t) *av) + __libc_enable_secure = av->a_un.a_val; + __libc_enable_secure_decided = 1; + break; ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + } + if (seen == 0xf) + { +diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c +index 68e08f480a..133ba0d29f 100644 +--- a/elf/dl-sysdep.c ++++ b/elf/dl-sysdep.c +@@ -62,6 +62,7 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion + void *__libc_stack_end attribute_relro = NULL; + rtld_hidden_data_def(__libc_stack_end) + static ElfW(auxv_t) *_dl_auxv attribute_relro; ++void *_dl_random attribute_relro = NULL; + + #ifndef DL_FIND_ARG_COMPONENTS + # define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ +@@ -173,6 +174,9 @@ _dl_sysdep_start (void **start_argptr, + GLRO(dl_sysinfo_dso) = (void *) av->a_un.a_val; + break; + #endif ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + #ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + #endif +@@ -293,6 +297,7 @@ _dl_show_auxv (void) + [AT_SECURE - 2] = { "AT_SECURE: ", dec }, + [AT_SYSINFO - 2] = { "AT_SYSINFO: 0x", hex }, + [AT_SYSINFO_EHDR - 2] = { "AT_SYSINFO_EHDR: 0x", hex }, ++ [AT_RANDOM - 2] = { "AT_RANDOM: 0x", hex }, + }; + unsigned int idx = (unsigned int) (av->a_type - 2); + +diff --git a/elf/rtld.c b/elf/rtld.c +index a357a46987..a02a319677 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -1837,7 +1837,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + #endif + + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); + #ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + #else +diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h +index 60b84a900d..02ec28d424 100644 +--- a/sysdeps/generic/dl-osinfo.h ++++ b/sysdeps/generic/dl-osinfo.h +@@ -1,12 +1,29 @@ + #include + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { +- uintptr_t ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; +- p[0] = 0; ++ uintptr_t ret; ++ if (dl_random == NULL) ++ { ++ ret = 0; ++ unsigned char *p = (unsigned char *) &ret; ++ p[sizeof (ret) - 1] = 255; ++ p[sizeof (ret) - 2] = '\n'; ++ p[0] = 0; ++ } ++ else ++ memcmp (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ if (dl_random == NULL) ++ ret = stack_chk_guard; ++ else ++ memcmp (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } +diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h +index eee6141c6a..54789c0639 100644 +--- a/sysdeps/generic/ldsodefs.h ++++ b/sysdeps/generic/ldsodefs.h +@@ -740,6 +740,9 @@ weak_extern (_dl_starting_up) + extern int _dl_starting_up_internal attribute_hidden; + #endif + ++/* Random data provided by the kernel. */ ++extern void *_dl_random attribute_hidden; ++ + /* OS-dependent function to open the zero-fill device. */ + extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ + +diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h +index 0738501a56..d796651ff4 100644 +--- a/sysdeps/unix/sysv/linux/dl-osinfo.h ++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h +@@ -159,22 +159,20 @@ _dl_discover_osversion (void) + } while (0) + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { + uintptr_t ret; +-#ifdef ENABLE_STACKGUARD_RANDOMIZE +- int fd = __open ("/dev/urandom", O_RDONLY); +- if (fd >= 0) +- { +- ssize_t reslen = __read (fd, &ret, sizeof (ret)); +- __close (fd); +- if (reslen == (ssize_t) sizeof (ret)) +- return ret; +- } +-#endif +- ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; ++ /* We need in the moment only 8 bytes on 32-bit platforms and 16 ++ bytes on 64-bit platforms. Therefore we can use the data ++ directly and not use the kernel-provided data to seed a PRNG. */ ++ memcpy (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } diff --git a/var/spack/repos/builtin/packages/glibc/965cb60-2.6.patch b/var/spack/repos/builtin/packages/glibc/965cb60-2.6.patch new file mode 100644 index 00000000000..68fd0cb64e2 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/965cb60-2.6.patch @@ -0,0 +1,176 @@ +diff --git a/csu/libc-start.c b/csu/libc-start.c +index 0ed993651e..a8b1be8c7d 100644 +--- a/csu/libc-start.c ++++ b/csu/libc-start.c +@@ -142,8 +142,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), + + # ifndef SHARED + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); +-# ifdef THREAD_SET_STACK_GUARD ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); ++# ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + # else + __stack_chk_guard = stack_chk_guard; +diff --git a/elf/dl-support.c b/elf/dl-support.c +index 2c11ac6881..321ed07a18 100644 +--- a/elf/dl-support.c ++++ b/elf/dl-support.c +@@ -84,6 +84,9 @@ struct r_scope_elem _dl_initial_searchlist; + int _dl_starting_up = 1; + #endif + ++/* Random data provided by the kernel. */ ++void *_dl_random; ++ + /* Get architecture specific initializer. */ + #include + +@@ -216,6 +219,9 @@ _dl_aux_init (ElfW(auxv_t) *av) + __libc_enable_secure = av->a_un.a_val; + __libc_enable_secure_decided = 1; + break; ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + # ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + # endif +diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c +index 85e331a90f..6ce20b5150 100644 +--- a/elf/dl-sysdep.c ++++ b/elf/dl-sysdep.c +@@ -62,6 +62,7 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion + void *__libc_stack_end attribute_relro = NULL; + rtld_hidden_data_def(__libc_stack_end) + static ElfW(auxv_t) *_dl_auxv attribute_relro; ++void *_dl_random attribute_relro = NULL; + + #ifndef DL_FIND_ARG_COMPONENTS + # define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ +@@ -173,6 +174,9 @@ _dl_sysdep_start (void **start_argptr, + GLRO(dl_sysinfo_dso) = (void *) av->a_un.a_val; + break; + #endif ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + #ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + #endif +@@ -293,6 +297,7 @@ _dl_show_auxv (void) + [AT_SECURE - 2] = { "AT_SECURE: ", dec }, + [AT_SYSINFO - 2] = { "AT_SYSINFO: 0x", hex }, + [AT_SYSINFO_EHDR - 2] = { "AT_SYSINFO_EHDR: 0x", hex }, ++ [AT_RANDOM - 2] = { "AT_RANDOM: 0x", hex }, + }; + unsigned int idx = (unsigned int) (av->a_type - 2); + +diff --git a/elf/rtld.c b/elf/rtld.c +index 7612a69324..e77ac43713 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -1816,7 +1816,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + tcbp = init_tls (); + + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); + #ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + #else +diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h +index 60b84a900d..02ec28d424 100644 +--- a/sysdeps/generic/dl-osinfo.h ++++ b/sysdeps/generic/dl-osinfo.h +@@ -1,12 +1,29 @@ + #include + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { +- uintptr_t ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; +- p[0] = 0; ++ uintptr_t ret; ++ if (dl_random == NULL) ++ { ++ ret = 0; ++ unsigned char *p = (unsigned char *) &ret; ++ p[sizeof (ret) - 1] = 255; ++ p[sizeof (ret) - 2] = '\n'; ++ p[0] = 0; ++ } ++ else ++ memcmp (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ if (dl_random == NULL) ++ ret = stack_chk_guard; ++ else ++ memcmp (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } +diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h +index aefd105f0a..929b91b56c 100644 +--- a/sysdeps/generic/ldsodefs.h ++++ b/sysdeps/generic/ldsodefs.h +@@ -726,6 +726,9 @@ weak_extern (_dl_starting_up) + extern int _dl_starting_up_internal attribute_hidden; + #endif + ++/* Random data provided by the kernel. */ ++extern void *_dl_random attribute_hidden; ++ + /* OS-dependent function to open the zero-fill device. */ + extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ + +diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h +index 0738501a56..d796651ff4 100644 +--- a/sysdeps/unix/sysv/linux/dl-osinfo.h ++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h +@@ -159,22 +159,20 @@ _dl_discover_osversion (void) + } while (0) + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { + uintptr_t ret; +-#ifdef ENABLE_STACKGUARD_RANDOMIZE +- int fd = __open ("/dev/urandom", O_RDONLY); +- if (fd >= 0) +- { +- ssize_t reslen = __read (fd, &ret, sizeof (ret)); +- __close (fd); +- if (reslen == (ssize_t) sizeof (ret)) +- return ret; +- } +-#endif +- ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; ++ /* We need in the moment only 8 bytes on 32-bit platforms and 16 ++ bytes on 64-bit platforms. Therefore we can use the data ++ directly and not use the kernel-provided data to seed a PRNG. */ ++ memcpy (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } diff --git a/var/spack/repos/builtin/packages/glibc/965cb60-2.7.patch b/var/spack/repos/builtin/packages/glibc/965cb60-2.7.patch new file mode 100644 index 00000000000..24d9292eb39 --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/965cb60-2.7.patch @@ -0,0 +1,174 @@ +diff --git a/csu/libc-start.c b/csu/libc-start.c +index a14ed71616..8b3f436f46 100644 +--- a/csu/libc-start.c ++++ b/csu/libc-start.c +@@ -140,7 +140,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), + __pthread_initialize_minimal (); + + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); + # ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + # else +diff --git a/elf/dl-support.c b/elf/dl-support.c +index 2c11ac6881..321ed07a18 100644 +--- a/elf/dl-support.c ++++ b/elf/dl-support.c +@@ -84,6 +84,9 @@ struct r_scope_elem _dl_initial_searchlist; + int _dl_starting_up = 1; + #endif + ++/* Random data provided by the kernel. */ ++void *_dl_random; ++ + /* Get architecture specific initializer. */ + #include + +@@ -216,6 +219,9 @@ _dl_aux_init (ElfW(auxv_t) *av) + __libc_enable_secure = av->a_un.a_val; + __libc_enable_secure_decided = 1; + break; ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + # ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + # endif +diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c +index 85e331a90f..6ce20b5150 100644 +--- a/elf/dl-sysdep.c ++++ b/elf/dl-sysdep.c +@@ -62,6 +62,7 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion + void *__libc_stack_end attribute_relro = NULL; + rtld_hidden_data_def(__libc_stack_end) + static ElfW(auxv_t) *_dl_auxv attribute_relro; ++void *_dl_random attribute_relro = NULL; + + #ifndef DL_FIND_ARG_COMPONENTS + # define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ +@@ -173,6 +174,9 @@ _dl_sysdep_start (void **start_argptr, + GLRO(dl_sysinfo_dso) = (void *) av->a_un.a_val; + break; + #endif ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + #ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + #endif +@@ -293,6 +297,7 @@ _dl_show_auxv (void) + [AT_SECURE - 2] = { "AT_SECURE: ", dec }, + [AT_SYSINFO - 2] = { "AT_SYSINFO: 0x", hex }, + [AT_SYSINFO_EHDR - 2] = { "AT_SYSINFO_EHDR: 0x", hex }, ++ [AT_RANDOM - 2] = { "AT_RANDOM: 0x", hex }, + }; + unsigned int idx = (unsigned int) (av->a_type - 2); + +diff --git a/elf/rtld.c b/elf/rtld.c +index 7612a69324..e77ac43713 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -1816,7 +1816,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + tcbp = init_tls (); + + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); + #ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + #else +diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h +index 60b84a900d..02ec28d424 100644 +--- a/sysdeps/generic/dl-osinfo.h ++++ b/sysdeps/generic/dl-osinfo.h +@@ -1,12 +1,29 @@ + #include + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { +- uintptr_t ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; +- p[0] = 0; ++ uintptr_t ret; ++ if (dl_random == NULL) ++ { ++ ret = 0; ++ unsigned char *p = (unsigned char *) &ret; ++ p[sizeof (ret) - 1] = 255; ++ p[sizeof (ret) - 2] = '\n'; ++ p[0] = 0; ++ } ++ else ++ memcmp (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ if (dl_random == NULL) ++ ret = stack_chk_guard; ++ else ++ memcmp (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } +diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h +index 958a099b82..c4d2874085 100644 +--- a/sysdeps/generic/ldsodefs.h ++++ b/sysdeps/generic/ldsodefs.h +@@ -726,6 +726,9 @@ weak_extern (_dl_starting_up) + extern int _dl_starting_up_internal attribute_hidden; + #endif + ++/* Random data provided by the kernel. */ ++extern void *_dl_random attribute_hidden; ++ + /* OS-dependent function to open the zero-fill device. */ + extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ + +diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h +index 082790f63b..d90f228942 100644 +--- a/sysdeps/unix/sysv/linux/dl-osinfo.h ++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h +@@ -154,22 +154,20 @@ _dl_discover_osversion (void) + } while (0) + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { + uintptr_t ret; +-#ifdef ENABLE_STACKGUARD_RANDOMIZE +- int fd = __open ("/dev/urandom", O_RDONLY); +- if (fd >= 0) +- { +- ssize_t reslen = __read (fd, &ret, sizeof (ret)); +- __close (fd); +- if (reslen == (ssize_t) sizeof (ret)) +- return ret; +- } +-#endif +- ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; ++ /* We need in the moment only 8 bytes on 32-bit platforms and 16 ++ bytes on 64-bit platforms. Therefore we can use the data ++ directly and not use the kernel-provided data to seed a PRNG. */ ++ memcpy (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } diff --git a/var/spack/repos/builtin/packages/glibc/965cb60.patch b/var/spack/repos/builtin/packages/glibc/965cb60.patch new file mode 100644 index 00000000000..f8e461b0cba --- /dev/null +++ b/var/spack/repos/builtin/packages/glibc/965cb60.patch @@ -0,0 +1,205 @@ +From 965cb60a21674edb8e20b1a2a41297bcd4622361 Mon Sep 17 00:00:00 2001 +From: Ulrich Drepper +Date: Sun, 11 Jan 2009 04:44:06 +0000 +Subject: [PATCH] * sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard) + +diff --git a/elf/dl-support.c b/elf/dl-support.c +index 6bd573ec57..7b3ccf3d4d 100644 +--- a/elf/dl-support.c ++++ b/elf/dl-support.c +@@ -84,6 +84,9 @@ struct r_scope_elem _dl_initial_searchlist; + int _dl_starting_up = 1; + #endif + ++/* Random data provided by the kernel. */ ++void *_dl_random; ++ + /* Get architecture specific initializer. */ + #include + +@@ -216,6 +219,9 @@ _dl_aux_init (ElfW(auxv_t) *av) + __libc_enable_secure = av->a_un.a_val; + __libc_enable_secure_decided = 1; + break; ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + # ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + # endif +diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c +index e6f4272a63..29ae895473 100644 +--- a/elf/dl-sysdep.c ++++ b/elf/dl-sysdep.c +@@ -62,6 +62,7 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion + void *__libc_stack_end attribute_relro = NULL; + rtld_hidden_data_def(__libc_stack_end) + static ElfW(auxv_t) *_dl_auxv attribute_relro; ++void *_dl_random attribute_relro = NULL; + + #ifndef DL_FIND_ARG_COMPONENTS + # define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ +@@ -173,6 +174,9 @@ _dl_sysdep_start (void **start_argptr, + GLRO(dl_sysinfo_dso) = (void *) av->a_un.a_val; + break; + #endif ++ case AT_RANDOM: ++ _dl_random = (void *) av->a_un.a_val; ++ break; + #ifdef DL_PLATFORM_AUXV + DL_PLATFORM_AUXV + #endif +@@ -294,6 +298,7 @@ _dl_show_auxv (void) + [AT_SECURE - 2] = { "AT_SECURE: ", dec }, + [AT_SYSINFO - 2] = { "AT_SYSINFO: 0x", hex }, + [AT_SYSINFO_EHDR - 2] = { "AT_SYSINFO_EHDR: 0x", hex }, ++ [AT_RANDOM - 2] = { "AT_RANDOM: 0x", hex }, + }; + unsigned int idx = (unsigned int) (av->a_type - 2); + +diff --git a/elf/rtld.c b/elf/rtld.c +index 46bece7fa3..60d414d637 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -841,7 +841,7 @@ static void + security_init (void) + { + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); + #ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + #else +@@ -851,18 +851,18 @@ security_init (void) + /* Set up the pointer guard as well, if necessary. */ + if (GLRO(dl_pointer_guard)) + { +- // XXX If it is cheap, we should use a separate value. +- uintptr_t pointer_chk_guard = stack_chk_guard; +-#ifndef HP_TIMING_NONAVAIL +- hp_timing_t now; +- HP_TIMING_NOW (now); +- pointer_chk_guard ^= now; +-#endif ++ uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random, ++ stack_chk_guard); + #ifdef THREAD_SET_POINTER_GUARD + THREAD_SET_POINTER_GUARD (pointer_chk_guard); + #endif + __pointer_chk_guard_local = pointer_chk_guard; + } ++ ++ /* We do not need the _dl_random value anymore. The less ++ information we leave behind, the better, so clear the ++ variable. */ ++ _dl_random = NULL; + } + + +diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h +index 60b84a900d..02ec28d424 100644 +--- a/sysdeps/generic/dl-osinfo.h ++++ b/sysdeps/generic/dl-osinfo.h +@@ -1,12 +1,29 @@ + #include + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { +- uintptr_t ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; +- p[0] = 0; ++ uintptr_t ret; ++ if (dl_random == NULL) ++ { ++ ret = 0; ++ unsigned char *p = (unsigned char *) &ret; ++ p[sizeof (ret) - 1] = 255; ++ p[sizeof (ret) - 2] = '\n'; ++ p[0] = 0; ++ } ++ else ++ memcmp (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ if (dl_random == NULL) ++ ret = stack_chk_guard; ++ else ++ memcmp (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } +diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h +index 4d857404a3..f5606f373f 100644 +--- a/sysdeps/generic/ldsodefs.h ++++ b/sysdeps/generic/ldsodefs.h +@@ -731,6 +731,9 @@ weak_extern (_dl_starting_up) + extern int _dl_starting_up_internal attribute_hidden; + #endif + ++/* Random data provided by the kernel. */ ++extern void *_dl_random attribute_hidden; ++ + /* OS-dependent function to open the zero-fill device. */ + extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ + +diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h +index 5271d4e4de..ee8eaf20e4 100644 +--- a/sysdeps/unix/sysv/linux/dl-osinfo.h ++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h +@@ -60,22 +60,20 @@ dl_fatal (const char *str) + } while (0) + + static inline uintptr_t __attribute__ ((always_inline)) +-_dl_setup_stack_chk_guard (void) ++_dl_setup_stack_chk_guard (void *dl_random) + { + uintptr_t ret; +-#ifdef ENABLE_STACKGUARD_RANDOMIZE +- int fd = __open ("/dev/urandom", O_RDONLY); +- if (fd >= 0) +- { +- ssize_t reslen = __read (fd, &ret, sizeof (ret)); +- __close (fd); +- if (reslen == (ssize_t) sizeof (ret)) +- return ret; +- } +-#endif +- ret = 0; +- unsigned char *p = (unsigned char *) &ret; +- p[sizeof (ret) - 1] = 255; +- p[sizeof (ret) - 2] = '\n'; ++ /* We need in the moment only 8 bytes on 32-bit platforms and 16 ++ bytes on 64-bit platforms. Therefore we can use the data ++ directly and not use the kernel-provided data to seed a PRNG. */ ++ memcpy (&ret, dl_random, sizeof (ret)); ++ return ret; ++} ++ ++static inline uintptr_t __attribute__ ((always_inline)) ++_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) ++{ ++ uintptr_t ret; ++ memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); + return ret; + } +diff --git a/csu/libc-start.c b/csu/libc-start.c +index a14ed71616a..80b672f88d8 100644 +--- a/csu/libc-start.c ++++ b/csu/libc-start.c +@@ -140,7 +140,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), + __pthread_initialize_minimal (); + + /* Set up the stack checker's canary. */ +- uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); ++ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); + # ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); + # else diff --git a/var/spack/repos/builtin/packages/glibc/package.py b/var/spack/repos/builtin/packages/glibc/package.py index 5c19e3b9307..a49a934abe3 100644 --- a/var/spack/repos/builtin/packages/glibc/package.py +++ b/var/spack/repos/builtin/packages/glibc/package.py @@ -57,11 +57,6 @@ class Glibc(AutotoolsPackage, GNUMirrorPackage): version("2.6.1", sha256="6be7639ccad715d25eef560ce9d1637ef206fb9a162714f6ab8167fc0d971cae") version("2.5", sha256="16d3ac4e86eed75d85d80f1f214a6bd58d27f13590966b5ad0cc181df85a3493") - # Spack commit 29aa7117f42f758bc537e03e4bedf66ced0accfa has older versions - # of glibc, but they are removed, because glibc < 2.17 links against - # libgcc_s and libgcc_eh, see glibc commit "Avoid use of libgcc_s and - # libgcc_eh when building glibc." 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 - # Fix for newer GCC, related to -fno-common patch("locs.patch", when="@2.23:2.25") patch("locs-2.22.patch", when="@:2.22") @@ -75,6 +70,13 @@ class Glibc(AutotoolsPackage, GNUMirrorPackage): # rpc/types.h include issue, should be from local version, not system. patch("fb21f89.patch", when="@:2.16") + # Avoid linking libgcc_eh + patch("95f5a9a-stub.patch", when="@:2.16") + patch("95f5a9a-2.16.patch", when="@2.16") + patch("95f5a9a-2.15.patch", when="@2.14:2.15") + patch("95f5a9a-2.13.patch", when="@2.12:2.13") + patch("95f5a9a-2.11.patch", when="@:2.11") + # Use init_array (modified commit 4a531bb to unconditionally define # NO_CTORS_DTORS_SECTIONS) patch("4a531bb.patch", when="@:2.12") @@ -85,6 +87,14 @@ class Glibc(AutotoolsPackage, GNUMirrorPackage): # linker flag output regex patch("7c8a673.patch", when="@:2.9") + # Use AT_RANDOM provided by the kernel instead of /dev/urandom; + # recent gcc + binutils have issues with the inline assembly in + # the fallback code, so better to use the kernel-provided value. + patch("965cb60.patch", when="@2.8:2.9") + patch("965cb60-2.7.patch", when="@2.7") + patch("965cb60-2.6.patch", when="@2.6") + patch("965cb60-2.5.patch", when="@2.5") + # include_next not working patch("67fbfa5.patch", when="@:2.7") @@ -95,6 +105,12 @@ def setup_build_environment(self, env): # for some reason CPPFLAGS -U_FORTIFY_SOURCE is not enough, it has to be CFLAGS env.append_flags("CPPFLAGS", "-U_FORTIFY_SOURCE") env.append_flags("CFLAGS", "-O2 -g -fno-stack-protector -U_FORTIFY_SOURCE") + if self.spec.satisfies("@:2.9"): + # missing defines in elf.h after 965cb60.patch + env.append_flags("CFLAGS", "-DAT_BASE_PLATFORM=24 -DAT_RANDOM=25") + if self.spec.satisfies("@:2.6"): + # change of defaults in gcc 10 + env.append_flags("CFLAGS", "-fcommon") if self.spec.satisfies("@2.5"): env.append_flags("CFLAGS", "-fgnu89-inline") From 6d55066b94a9669816fce5c22102997a1f7b21a5 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 28 Sep 2023 15:24:56 +0200 Subject: [PATCH 32/34] Use st_nlink in hardlink tracking (#39328) Only add potential hardlinks to a set/dict, instead of each file. This should be much cheaper, since hardlinks are very rare. --- lib/spack/spack/binary_distribution.py | 12 +++++++----- lib/spack/spack/hooks/drop_redundant_rpaths.py | 11 +++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 50043af762f..fc6056e6be0 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -647,8 +647,7 @@ class BuildManifestVisitor(BaseDirectoryVisitor): directories.""" def __init__(self): - # Save unique identifiers of files to avoid - # relocating hardlink files for each path. + # Save unique identifiers of hardlinks to avoid relocating them multiple times self.visited = set() # Lists of files we will check @@ -657,6 +656,8 @@ def __init__(self): def seen_before(self, root, rel_path): stat_result = os.lstat(os.path.join(root, rel_path)) + if stat_result.st_nlink == 1: + return False identifier = (stat_result.st_dev, stat_result.st_ino) if identifier in self.visited: return True @@ -1581,9 +1582,10 @@ def dedupe_hardlinks_if_necessary(root, buildinfo): for rel_path in buildinfo[key]: stat_result = os.lstat(os.path.join(root, rel_path)) identifier = (stat_result.st_dev, stat_result.st_ino) - if identifier in visited: - continue - visited.add(identifier) + if stat_result.st_nlink > 1: + if identifier in visited: + continue + visited.add(identifier) new_list.append(rel_path) buildinfo[key] = new_list diff --git a/lib/spack/spack/hooks/drop_redundant_rpaths.py b/lib/spack/spack/hooks/drop_redundant_rpaths.py index 4cbbf5359d3..a32d435e388 100644 --- a/lib/spack/spack/hooks/drop_redundant_rpaths.py +++ b/lib/spack/spack/hooks/drop_redundant_rpaths.py @@ -79,8 +79,7 @@ class ElfFilesWithRPathVisitor(BaseDirectoryVisitor): """Visitor that collects all elf files that have an rpath""" def __init__(self): - # Map from (ino, dev) -> path. We need 1 path per file, if there are hardlinks, - # we don't need to store the path multiple times. + # Keep track of what hardlinked files we've already visited. self.visited = set() def visit_file(self, root, rel_path, depth): @@ -89,10 +88,10 @@ def visit_file(self, root, rel_path, depth): identifier = (s.st_ino, s.st_dev) # We're hitting a hardlink or symlink of an excluded lib, no need to parse. - if identifier in self.visited: - return - - self.visited.add(identifier) + if s.st_nlink > 1: + if identifier in self.visited: + return + self.visited.add(identifier) result = drop_redundant_rpaths(filepath) From f77a38a96bef7184f872f4225801ac937e825866 Mon Sep 17 00:00:00 2001 From: snehring <7978778+snehring@users.noreply.github.com> Date: Thu, 28 Sep 2023 11:16:11 -0500 Subject: [PATCH 33/34] mash: fix compilation for aarch64 (#40218) --- var/spack/repos/builtin/packages/mash/package.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/var/spack/repos/builtin/packages/mash/package.py b/var/spack/repos/builtin/packages/mash/package.py index 4f6ac179883..7148bbe1e21 100644 --- a/var/spack/repos/builtin/packages/mash/package.py +++ b/var/spack/repos/builtin/packages/mash/package.py @@ -27,6 +27,16 @@ class Mash(AutotoolsPackage): depends_on("capnproto") depends_on("gsl") + def patch(self): + if self.spec.satisfies("target=aarch64:"): + filter_file( + "CXXFLAGS += -include src/mash/memcpyLink.h -Wl,--wrap=memcpy", + "", + "Makefile.in", + string=True, + ) + filter_file("CFLAGS += -include src/mash/memcpyLink.h", "", "Makefile.in", string=True) + def configure_args(self): args = [] args.append("--with-capnp=" + self.spec["capnproto"].prefix) From a236fce31f5d5018c788f51cda50492f1f241cba Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 28 Sep 2023 18:21:52 +0200 Subject: [PATCH 34/34] Partial removal of circular dependencies between `spack` and `llnl` (#40090) Modifications: - [x] Move `spack.util.string` to `llnl.string` - [x] Remove dependency of `llnl` on `spack.error` - [x] Move path of `spack.util.path` to `llnl.path` - [x] Move `spack.util.environment.get_host_*` to `spack.spec` --- lib/spack/llnl/path.py | 105 ++++++++++++++++++++ lib/spack/llnl/string.py | 67 +++++++++++++ lib/spack/llnl/util/filesystem.py | 6 +- lib/spack/llnl/util/lock.py | 4 +- lib/spack/llnl/util/symlink.py | 5 +- lib/spack/spack/build_environment.py | 2 +- lib/spack/spack/cmd/__init__.py | 4 +- lib/spack/spack/cmd/buildcache.py | 2 +- lib/spack/spack/cmd/env.py | 2 +- lib/spack/spack/cmd/make_installer.py | 3 +- lib/spack/spack/cmd/tags.py | 3 +- lib/spack/spack/compiler.py | 4 +- lib/spack/spack/directory_layout.py | 4 +- lib/spack/spack/environment/environment.py | 2 +- lib/spack/spack/fetch_strategy.py | 2 +- lib/spack/spack/install_test.py | 2 +- lib/spack/spack/repo.py | 3 +- lib/spack/spack/spec.py | 51 ++++++++-- lib/spack/spack/stage.py | 4 +- lib/spack/spack/test/build_environment.py | 2 +- lib/spack/spack/test/cmd/bootstrap.py | 3 +- lib/spack/spack/test/directory_layout.py | 3 +- lib/spack/spack/test/llnl/llnl_string.py | 43 +++++++++ lib/spack/spack/test/util/util_string.py | 14 --- lib/spack/spack/url.py | 2 +- lib/spack/spack/util/environment.py | 44 +-------- lib/spack/spack/util/path.py | 106 --------------------- lib/spack/spack/util/string.py | 57 ----------- lib/spack/spack/util/url.py | 4 +- lib/spack/spack/variant.py | 2 +- 30 files changed, 297 insertions(+), 258 deletions(-) create mode 100644 lib/spack/llnl/path.py create mode 100644 lib/spack/llnl/string.py create mode 100644 lib/spack/spack/test/llnl/llnl_string.py delete mode 100644 lib/spack/spack/test/util/util_string.py delete mode 100644 lib/spack/spack/util/string.py diff --git a/lib/spack/llnl/path.py b/lib/spack/llnl/path.py new file mode 100644 index 00000000000..bef9e14adac --- /dev/null +++ b/lib/spack/llnl/path.py @@ -0,0 +1,105 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""Path primitives that just require Python standard library.""" +import functools +import sys +from typing import List, Optional +from urllib.parse import urlparse + + +class Path: + """Enum to identify the path-style.""" + + unix: int = 0 + windows: int = 1 + platform_path: int = windows if sys.platform == "win32" else unix + + +def format_os_path(path: str, mode: int = Path.unix) -> str: + """Formats the input path to use consistent, platform specific separators. + + Absolute paths are converted between drive letters and a prepended '/' as per platform + requirement. + + Parameters: + path: the path to be normalized, must be a string or expose the replace method. + mode: the path file separator style to normalize the passed path to. + Default is unix style, i.e. '/' + """ + if not path: + return path + if mode == Path.windows: + path = path.replace("/", "\\") + else: + path = path.replace("\\", "/") + return path + + +def convert_to_posix_path(path: str) -> str: + """Converts the input path to POSIX style.""" + return format_os_path(path, mode=Path.unix) + + +def convert_to_windows_path(path: str) -> str: + """Converts the input path to Windows style.""" + return format_os_path(path, mode=Path.windows) + + +def convert_to_platform_path(path: str) -> str: + """Converts the input path to the current platform's native style.""" + return format_os_path(path, mode=Path.platform_path) + + +def path_to_os_path(*parameters: str) -> List[str]: + """Takes an arbitrary number of positional parameters, converts each argument of type + string to use a normalized filepath separator, and returns a list of all values. + """ + + def _is_url(path_or_url: str) -> bool: + if "\\" in path_or_url: + return False + url_tuple = urlparse(path_or_url) + return bool(url_tuple.scheme) and len(url_tuple.scheme) > 1 + + result = [] + for item in parameters: + if isinstance(item, str) and not _is_url(item): + item = convert_to_platform_path(item) + result.append(item) + return result + + +def system_path_filter(_func=None, arg_slice: Optional[slice] = None): + """Filters function arguments to account for platform path separators. + Optional slicing range can be specified to select specific arguments + + This decorator takes all (or a slice) of a method's positional arguments + and normalizes usage of filepath separators on a per platform basis. + + Note: `**kwargs`, urls, and any type that is not a string are ignored + so in such cases where path normalization is required, that should be + handled by calling path_to_os_path directly as needed. + + Parameters: + arg_slice: a slice object specifying the slice of arguments + in the decorated method over which filepath separators are + normalized + """ + + def holder_func(func): + @functools.wraps(func) + def path_filter_caller(*args, **kwargs): + args = list(args) + if arg_slice: + args[arg_slice] = path_to_os_path(*args[arg_slice]) + else: + args = path_to_os_path(*args) + return func(*args, **kwargs) + + return path_filter_caller + + if _func: + return holder_func(_func) + return holder_func diff --git a/lib/spack/llnl/string.py b/lib/spack/llnl/string.py new file mode 100644 index 00000000000..a203be8d346 --- /dev/null +++ b/lib/spack/llnl/string.py @@ -0,0 +1,67 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""String manipulation functions that do not have other dependencies than Python +standard library +""" +from typing import List, Optional + + +def comma_list(sequence: List[str], article: str = "") -> str: + if type(sequence) is not list: + sequence = list(sequence) + + if not sequence: + return "" + if len(sequence) == 1: + return sequence[0] + + out = ", ".join(str(s) for s in sequence[:-1]) + if len(sequence) != 2: + out += "," # oxford comma + out += " " + if article: + out += article + " " + out += str(sequence[-1]) + return out + + +def comma_or(sequence: List[str]) -> str: + """Return a string with all the elements of the input joined by comma, but the last + one (which is joined by 'or'). + """ + return comma_list(sequence, "or") + + +def comma_and(sequence: List[str]) -> str: + """Return a string with all the elements of the input joined by comma, but the last + one (which is joined by 'and'). + """ + return comma_list(sequence, "and") + + +def quote(sequence: List[str], q: str = "'") -> List[str]: + """Quotes each item in the input list with the quote character passed as second argument.""" + return [f"{q}{e}{q}" for e in sequence] + + +def plural(n: int, singular: str, plural: Optional[str] = None, show_n: bool = True) -> str: + """Pluralize word by adding an s if n != 1. + + Arguments: + n: number of things there are + singular: singular form of word + plural: optional plural form, for when it's not just singular + 's' + show_n: whether to include n in the result string (default True) + + Returns: + "1 thing" if n == 1 or "n things" if n != 1 + """ + number = f"{n} " if show_n else "" + if n == 1: + return f"{number}{singular}" + elif plural is not None: + return f"{number}{plural}" + else: + return f"{number}{singular}s" diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index bd203ef200d..8f4217049dd 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -28,7 +28,8 @@ from llnl.util.symlink import islink, readlink, resolve_link_target_relative_to_the_link, symlink from spack.util.executable import Executable, which -from spack.util.path import path_to_os_path, system_path_filter + +from ..path import path_to_os_path, system_path_filter if sys.platform != "win32": import grp @@ -336,8 +337,7 @@ def groupid_to_group(x): if string: regex = re.escape(regex) - filenames = path_to_os_path(*filenames) - for filename in filenames: + for filename in path_to_os_path(*filenames): msg = 'FILTER FILE: {0} [replacing "{1}"]' tty.debug(msg.format(filename, regex)) diff --git a/lib/spack/llnl/util/lock.py b/lib/spack/llnl/util/lock.py index 74a325acd2e..156300b891b 100644 --- a/lib/spack/llnl/util/lock.py +++ b/lib/spack/llnl/util/lock.py @@ -14,7 +14,7 @@ from llnl.util import lang, tty -import spack.util.string +from ..string import plural if sys.platform != "win32": import fcntl @@ -169,7 +169,7 @@ def _attempts_str(wait_time, nattempts): if nattempts <= 1: return "" - attempts = spack.util.string.plural(nattempts, "attempt") + attempts = plural(nattempts, "attempt") return " after {} and {}".format(lang.pretty_seconds(wait_time), attempts) diff --git a/lib/spack/llnl/util/symlink.py b/lib/spack/llnl/util/symlink.py index ab6654e847e..4f4f965f139 100644 --- a/lib/spack/llnl/util/symlink.py +++ b/lib/spack/llnl/util/symlink.py @@ -11,8 +11,7 @@ from llnl.util import lang, tty -from spack.error import SpackError -from spack.util.path import system_path_filter +from ..path import system_path_filter if sys.platform == "win32": from win32file import CreateHardLink @@ -338,7 +337,7 @@ def resolve_link_target_relative_to_the_link(link): return os.path.join(link_dir, target) -class SymlinkError(SpackError): +class SymlinkError(RuntimeError): """Exception class for errors raised while creating symlinks, junctions and hard links """ diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 723f398ae6f..881fcb5c9cf 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -43,6 +43,7 @@ from typing import List, Tuple import llnl.util.tty as tty +from llnl.string import plural from llnl.util.filesystem import join_path from llnl.util.lang import dedupe from llnl.util.symlink import symlink @@ -82,7 +83,6 @@ from spack.util.executable import Executable from spack.util.log_parse import make_log_context, parse_log_events from spack.util.module_cmd import load_module, module, path_from_modules -from spack.util.string import plural # # This can be set by the user to globally disable parallel builds. diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index fd5e81fe7aa..c26ab181c10 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -11,6 +11,7 @@ from textwrap import dedent from typing import List, Match, Tuple +import llnl.string import llnl.util.tty as tty from llnl.util.filesystem import join_path from llnl.util.lang import attr_setdefault, index_by @@ -29,7 +30,6 @@ import spack.user_environment as uenv import spack.util.spack_json as sjson import spack.util.spack_yaml as syaml -import spack.util.string # cmd has a submodule called "list" so preserve the python list module python_list = list @@ -516,7 +516,7 @@ def print_how_many_pkgs(specs, pkg_type=""): category, e.g. if pkg_type is "installed" then the message would be "3 installed packages" """ - tty.msg("%s" % spack.util.string.plural(len(specs), pkg_type + " package")) + tty.msg("%s" % llnl.string.plural(len(specs), pkg_type + " package")) def spack_is_git_repo(): diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index f611956c360..5eb0ea1ed40 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -13,6 +13,7 @@ import llnl.util.tty as tty import llnl.util.tty.color as clr +from llnl.string import plural from llnl.util.lang import elide_list import spack.binary_distribution as bindist @@ -32,7 +33,6 @@ from spack.cmd import display_specs from spack.spec import Spec, save_dependency_specfiles from spack.stage import Stage -from spack.util.string import plural description = "create, download and install binary packages" section = "packaging" diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index 8a2f129bda8..6c22e70a5d8 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -9,6 +9,7 @@ import sys import tempfile +import llnl.string as string import llnl.util.filesystem as fs import llnl.util.tty as tty from llnl.util.tty.colify import colify @@ -28,7 +29,6 @@ import spack.schema.env import spack.spec import spack.tengine -import spack.util.string as string from spack.util.environment import EnvironmentModifications description = "manage virtual environments" diff --git a/lib/spack/spack/cmd/make_installer.py b/lib/spack/spack/cmd/make_installer.py index 7f43659429a..986631d39f7 100644 --- a/lib/spack/spack/cmd/make_installer.py +++ b/lib/spack/spack/cmd/make_installer.py @@ -6,10 +6,11 @@ import posixpath import sys +from llnl.path import convert_to_posix_path + import spack.paths import spack.util.executable from spack.spec import Spec -from spack.util.path import convert_to_posix_path description = "generate Windows installer" section = "admin" diff --git a/lib/spack/spack/cmd/tags.py b/lib/spack/spack/cmd/tags.py index 0aa6acfd5f6..0fbc91b6f49 100644 --- a/lib/spack/spack/cmd/tags.py +++ b/lib/spack/spack/cmd/tags.py @@ -5,6 +5,7 @@ import io import sys +import llnl.string import llnl.util.tty as tty import llnl.util.tty.colify as colify @@ -24,7 +25,7 @@ def report_tags(category, tags): if isatty: num = len(tags) fmt = "{0} package tag".format(category) - buffer.write("{0}:\n".format(spack.util.string.plural(num, fmt))) + buffer.write("{0}:\n".format(llnl.string.plural(num, fmt))) if tags: colify.colify(tags, output=buffer, tty=isatty, indent=4) diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py index 3ec7d1421ac..70da3ca2c42 100644 --- a/lib/spack/spack/compiler.py +++ b/lib/spack/spack/compiler.py @@ -13,6 +13,7 @@ import tempfile from typing import List, Optional, Sequence +import llnl.path import llnl.util.lang import llnl.util.tty as tty from llnl.util.filesystem import path_contains_subdirectory, paths_containing_libs @@ -24,7 +25,6 @@ import spack.util.module_cmd import spack.version from spack.util.environment import filter_system_paths -from spack.util.path import system_path_filter __all__ = ["Compiler"] @@ -160,7 +160,7 @@ def _parse_link_paths(string): return implicit_link_dirs -@system_path_filter +@llnl.path.system_path_filter def _parse_non_system_link_dirs(string: str) -> List[str]: """Parses link paths out of compiler debug output. diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index dd4e6dd5e11..46bb6c85574 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -120,10 +120,8 @@ def write_host_environment(self, spec): versioning. We use it in the case that an analysis later needs to easily access this information. """ - from spack.util.environment import get_host_environment_metadata - env_file = self.env_metadata_path(spec) - environ = get_host_environment_metadata() + environ = spack.spec.get_host_environment_metadata() with open(env_file, "w") as fd: sjson.dump(environ, fd) diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index d8f04c7d4bc..496a8b332a7 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -404,7 +404,7 @@ def _write_yaml(data, str_or_file): def _eval_conditional(string): """Evaluate conditional definitions using restricted variable scope.""" - valid_variables = spack.util.environment.get_host_environment() + valid_variables = spack.spec.get_host_environment() valid_variables.update({"re": re, "env": os.environ}) return eval(string, valid_variables) diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index 90ff8527fde..8578b110fce 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -35,6 +35,7 @@ import llnl.util import llnl.util.filesystem as fs import llnl.util.tty as tty +from llnl.string import comma_and, quote from llnl.util.filesystem import get_single_file, mkdirp, temp_cwd, temp_rename, working_dir from llnl.util.symlink import symlink @@ -49,7 +50,6 @@ import spack.version.git_ref_lookup from spack.util.compression import decompressor_for from spack.util.executable import CommandNotFoundError, which -from spack.util.string import comma_and, quote #: List of all fetch strategies, created by FetchStrategy metaclass. all_strategies = [] diff --git a/lib/spack/spack/install_test.py b/lib/spack/spack/install_test.py index 90359796d86..0d8fa782b61 100644 --- a/lib/spack/spack/install_test.py +++ b/lib/spack/spack/install_test.py @@ -17,6 +17,7 @@ import llnl.util.filesystem as fs import llnl.util.tty as tty +from llnl.string import plural from llnl.util.lang import nullcontext from llnl.util.tty.color import colorize @@ -26,7 +27,6 @@ from spack.installer import InstallError from spack.spec import Spec from spack.util.prefix import Prefix -from spack.util.string import plural #: Stand-alone test failure info type TestFailureType = Tuple[BaseException, str] diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py index a4362d9d314..4391d9a9a23 100644 --- a/lib/spack/spack/repo.py +++ b/lib/spack/spack/repo.py @@ -26,6 +26,7 @@ import uuid from typing import Any, Dict, List, Union +import llnl.path import llnl.util.filesystem as fs import llnl.util.lang import llnl.util.tty as tty @@ -563,7 +564,7 @@ def __init__( self.checker = package_checker self.packages_path = self.checker.packages_path if sys.platform == "win32": - self.packages_path = spack.util.path.convert_to_posix_path(self.packages_path) + self.packages_path = llnl.path.convert_to_posix_path(self.packages_path) self.namespace = namespace self.indexers: Dict[str, Indexer] = {} diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 13bf66f506e..85a638b6022 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -54,10 +54,14 @@ import io import itertools import os +import platform import re +import socket import warnings -from typing import Callable, List, Optional, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, Union +import llnl.path +import llnl.string import llnl.util.filesystem as fs import llnl.util.lang as lang import llnl.util.tty as tty @@ -82,11 +86,9 @@ import spack.util.executable import spack.util.hash import spack.util.module_cmd as md -import spack.util.path as pth import spack.util.prefix import spack.util.spack_json as sjson import spack.util.spack_yaml as syaml -import spack.util.string import spack.variant as vt import spack.version as vn import spack.version.git_ref_lookup @@ -1390,7 +1392,7 @@ def _format_module_list(modules): @property def external_path(self): - return pth.path_to_os_path(self._external_path)[0] + return llnl.path.path_to_os_path(self._external_path)[0] @external_path.setter def external_path(self, ext_path): @@ -1799,7 +1801,7 @@ def prefix(self): @prefix.setter def prefix(self, value): - self._prefix = spack.util.prefix.Prefix(pth.convert_to_platform_path(value)) + self._prefix = spack.util.prefix.Prefix(llnl.path.convert_to_platform_path(value)) def spec_hash(self, hash): """Utility method for computing different types of Spec hashes. @@ -5148,6 +5150,43 @@ def save_dependency_specfiles(root: Spec, output_directory: str, dependencies: L fd.write(spec.to_json(hash=ht.dag_hash)) +def get_host_environment_metadata() -> Dict[str, str]: + """Get the host environment, reduce to a subset that we can store in + the install directory, and add the spack version. + """ + import spack.main + + environ = get_host_environment() + return { + "host_os": environ["os"], + "platform": environ["platform"], + "host_target": environ["target"], + "hostname": environ["hostname"], + "spack_version": spack.main.get_version(), + "kernel_version": platform.version(), + } + + +def get_host_environment() -> Dict[str, Any]: + """Return a dictionary (lookup) with host information (not including the + os.environ). + """ + host_platform = spack.platforms.host() + host_target = host_platform.target("default_target") + host_os = host_platform.operating_system("default_os") + arch_fmt = "platform={0} os={1} target={2}" + arch_spec = Spec(arch_fmt.format(host_platform, host_os, host_target)) + return { + "target": str(host_target), + "os": str(host_os), + "platform": str(host_platform), + "arch": arch_spec, + "architecture": arch_spec, + "arch_str": str(arch_spec), + "hostname": socket.gethostname(), + } + + class SpecParseError(spack.error.SpecError): """Wrapper for ParseError for when we're parsing specs.""" @@ -5208,7 +5247,7 @@ class InvalidDependencyError(spack.error.SpecError): def __init__(self, pkg, deps): self.invalid_deps = deps super().__init__( - "Package {0} does not depend on {1}".format(pkg, spack.util.string.comma_or(deps)) + "Package {0} does not depend on {1}".format(pkg, llnl.string.comma_or(deps)) ) diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index 065f74eb8b6..73b82c1378d 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -14,6 +14,7 @@ import tempfile from typing import Callable, Dict, Iterable, Optional +import llnl.string import llnl.util.lang import llnl.util.tty as tty from llnl.util.filesystem import ( @@ -37,7 +38,6 @@ import spack.util.lock import spack.util.path as sup import spack.util.pattern as pattern -import spack.util.string import spack.util.url as url_util from spack.util.crypto import bit_length, prefix_bits @@ -897,7 +897,7 @@ def get_checksums_for_versions( num_ver = len(sorted_versions) tty.msg( - f"Found {spack.util.string.plural(num_ver, 'version')} of {package_name}:", + f"Found {llnl.string.plural(num_ver, 'version')} of {package_name}:", "", *llnl.util.lang.elide_list( ["{0:{1}} {2}".format(str(v), max_len, url_by_version[v]) for v in sorted_versions] diff --git a/lib/spack/spack/test/build_environment.py b/lib/spack/spack/test/build_environment.py index 90f3fb378e0..2eb80fded3d 100644 --- a/lib/spack/spack/test/build_environment.py +++ b/lib/spack/spack/test/build_environment.py @@ -9,6 +9,7 @@ import pytest +from llnl.path import Path, convert_to_platform_path from llnl.util.filesystem import HeaderList, LibraryList import spack.build_environment @@ -21,7 +22,6 @@ from spack.util.cpus import determine_number_of_jobs from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable -from spack.util.path import Path, convert_to_platform_path def os_pathsep_join(path, *pths): diff --git a/lib/spack/spack/test/cmd/bootstrap.py b/lib/spack/spack/test/cmd/bootstrap.py index 35f6987becd..eff9bf042d5 100644 --- a/lib/spack/spack/test/cmd/bootstrap.py +++ b/lib/spack/spack/test/cmd/bootstrap.py @@ -7,13 +7,14 @@ import pytest +from llnl.path import convert_to_posix_path + import spack.bootstrap import spack.bootstrap.core import spack.config import spack.environment as ev import spack.main import spack.mirror -from spack.util.path import convert_to_posix_path _bootstrap = spack.main.SpackCommand("bootstrap") diff --git a/lib/spack/spack/test/directory_layout.py b/lib/spack/spack/test/directory_layout.py index 995707db23d..64676bfebcb 100644 --- a/lib/spack/spack/test/directory_layout.py +++ b/lib/spack/spack/test/directory_layout.py @@ -12,11 +12,12 @@ import pytest +from llnl.path import path_to_os_path + import spack.paths import spack.repo from spack.directory_layout import DirectoryLayout, InvalidDirectoryLayoutParametersError from spack.spec import Spec -from spack.util.path import path_to_os_path # number of packages to test (to reduce test time) max_packages = 10 diff --git a/lib/spack/spack/test/llnl/llnl_string.py b/lib/spack/spack/test/llnl/llnl_string.py new file mode 100644 index 00000000000..93d7e662c57 --- /dev/null +++ b/lib/spack/spack/test/llnl/llnl_string.py @@ -0,0 +1,43 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +import pytest + +import llnl.string + + +@pytest.mark.parametrize( + "arguments,expected", + [ + ((0, "thing"), "0 things"), + ((1, "thing"), "1 thing"), + ((2, "thing"), "2 things"), + ((1, "thing", "wombats"), "1 thing"), + ((2, "thing", "wombats"), "2 wombats"), + ((2, "thing", "wombats", False), "wombats"), + ], +) +def test_plural(arguments, expected): + assert llnl.string.plural(*arguments) == expected + + +@pytest.mark.parametrize( + "arguments,expected", + [((["one", "two"],), ["'one'", "'two'"]), ((["one", "two"], "^"), ["^one^", "^two^"])], +) +def test_quote(arguments, expected): + assert llnl.string.quote(*arguments) == expected + + +@pytest.mark.parametrize( + "input,expected_and,expected_or", + [ + (["foo"], "foo", "foo"), + (["foo", "bar"], "foo and bar", "foo or bar"), + (["foo", "bar", "baz"], "foo, bar, and baz", "foo, bar, or baz"), + ], +) +def test_comma_and_or(input, expected_and, expected_or): + assert llnl.string.comma_and(input) == expected_and + assert llnl.string.comma_or(input) == expected_or diff --git a/lib/spack/spack/test/util/util_string.py b/lib/spack/spack/test/util/util_string.py deleted file mode 100644 index f4de3738598..00000000000 --- a/lib/spack/spack/test/util/util_string.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack.util.string import plural - - -def test_plural(): - assert plural(0, "thing") == "0 things" - assert plural(1, "thing") == "1 thing" - assert plural(2, "thing") == "2 things" - assert plural(1, "thing", "wombats") == "1 thing" - assert plural(2, "thing", "wombats") == "2 wombats" diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py index c5e47232c00..080c9245961 100644 --- a/lib/spack/spack/url.py +++ b/lib/spack/spack/url.py @@ -31,12 +31,12 @@ import re import llnl.url +from llnl.path import convert_to_posix_path from llnl.util.tty.color import cescape, colorize import spack.error import spack.util.web import spack.version -from spack.util.path import convert_to_posix_path # # Note: We call the input to most of these functions a "path" but the functions diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index c18be76cc6d..246df65cb88 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -10,21 +10,16 @@ import os import os.path import pickle -import platform import re -import socket import sys from functools import wraps from typing import Any, Callable, Dict, List, MutableMapping, Optional, Tuple, Union +from llnl.path import path_to_os_path, system_path_filter from llnl.util import tty from llnl.util.lang import dedupe -import spack.platforms -import spack.spec - from .executable import Executable, which -from .path import path_to_os_path, system_path_filter if sys.platform == "win32": SYSTEM_PATHS = [ @@ -224,43 +219,6 @@ def pickle_environment(path: Path, environment: Optional[Dict[str, str]] = None) pickle.dump(dict(environment if environment else os.environ), pickle_file, protocol=2) -def get_host_environment_metadata() -> Dict[str, str]: - """Get the host environment, reduce to a subset that we can store in - the install directory, and add the spack version. - """ - import spack.main - - environ = get_host_environment() - return { - "host_os": environ["os"], - "platform": environ["platform"], - "host_target": environ["target"], - "hostname": environ["hostname"], - "spack_version": spack.main.get_version(), - "kernel_version": platform.version(), - } - - -def get_host_environment() -> Dict[str, Any]: - """Return a dictionary (lookup) with host information (not including the - os.environ). - """ - host_platform = spack.platforms.host() - host_target = host_platform.target("default_target") - host_os = host_platform.operating_system("default_os") - arch_fmt = "platform={0} os={1} target={2}" - arch_spec = spack.spec.Spec(arch_fmt.format(host_platform, host_os, host_target)) - return { - "target": str(host_target), - "os": str(host_os), - "platform": str(host_platform), - "arch": arch_spec, - "architecture": arch_spec, - "arch_str": str(arch_spec), - "hostname": socket.gethostname(), - } - - @contextlib.contextmanager def set_env(**kwargs): """Temporarily sets and restores environment variables. diff --git a/lib/spack/spack/util/path.py b/lib/spack/spack/util/path.py index 3dc0ea676ce..a46443c0831 100644 --- a/lib/spack/spack/util/path.py +++ b/lib/spack/spack/util/path.py @@ -15,7 +15,6 @@ import sys import tempfile from datetime import date -from urllib.parse import urlparse import llnl.util.tty as tty from llnl.util.lang import memoized @@ -98,31 +97,10 @@ def replacements(): SPACK_PATH_PADDING_CHARS = "__spack_path_placeholder__" -def is_path_url(path): - if "\\" in path: - return False - url_tuple = urlparse(path) - return bool(url_tuple.scheme) and len(url_tuple.scheme) > 1 - - def win_exe_ext(): return ".exe" -def path_to_os_path(*pths): - """ - Takes an arbitrary number of positional parameters - converts each arguemnt of type string to use a normalized - filepath separator, and returns a list of all values - """ - ret_pths = [] - for pth in pths: - if isinstance(pth, str) and not is_path_url(pth): - pth = convert_to_platform_path(pth) - ret_pths.append(pth) - return ret_pths - - def sanitize_filename(filename: str) -> str: """ Replaces unsupported characters (for the host) in a filename with underscores. @@ -145,42 +123,6 @@ def sanitize_filename(filename: str) -> str: return re.sub(r'[\x00-\x1F\x7F"*/:<>?\\|]', "_", filename) -def system_path_filter(_func=None, arg_slice=None): - """ - Filters function arguments to account for platform path separators. - Optional slicing range can be specified to select specific arguments - - This decorator takes all (or a slice) of a method's positional arguments - and normalizes usage of filepath separators on a per platform basis. - - Note: **kwargs, urls, and any type that is not a string are ignored - so in such cases where path normalization is required, that should be - handled by calling path_to_os_path directly as needed. - - Parameters: - arg_slice (slice): a slice object specifying the slice of arguments - in the decorated method over which filepath separators are - normalized - """ - from functools import wraps - - def holder_func(func): - @wraps(func) - def path_filter_caller(*args, **kwargs): - args = list(args) - if arg_slice: - args[arg_slice] = path_to_os_path(*args[arg_slice]) - else: - args = path_to_os_path(*args) - return func(*args, **kwargs) - - return path_filter_caller - - if _func: - return holder_func(_func) - return holder_func - - @memoized def get_system_path_max(): # Choose a conservative default @@ -202,54 +144,6 @@ def get_system_path_max(): return sys_max_path_length -class Path: - """ - Describes the filepath separator types - in an enum style - with a helper attribute - exposing the path type of - the current platform. - """ - - unix = 0 - windows = 1 - platform_path = windows if sys.platform == "win32" else unix - - -def format_os_path(path, mode=Path.unix): - """ - Format path to use consistent, platform specific - separators. Absolute paths are converted between - drive letters and a prepended '/' as per platform - requirement. - - Parameters: - path (str): the path to be normalized, must be a string - or expose the replace method. - mode (Path): the path filesperator style to normalize the - passed path to. Default is unix style, i.e. '/' - """ - if not path: - return path - if mode == Path.windows: - path = path.replace("/", "\\") - else: - path = path.replace("\\", "/") - return path - - -def convert_to_posix_path(path): - return format_os_path(path, mode=Path.unix) - - -def convert_to_windows_path(path): - return format_os_path(path, mode=Path.windows) - - -def convert_to_platform_path(path): - return format_os_path(path, mode=Path.platform_path) - - def substitute_config_variables(path): """Substitute placeholders into paths. diff --git a/lib/spack/spack/util/string.py b/lib/spack/spack/util/string.py deleted file mode 100644 index 03dc2bb8506..00000000000 --- a/lib/spack/spack/util/string.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -def comma_list(sequence, article=""): - if type(sequence) is not list: - sequence = list(sequence) - - if not sequence: - return - elif len(sequence) == 1: - return sequence[0] - else: - out = ", ".join(str(s) for s in sequence[:-1]) - if len(sequence) != 2: - out += "," # oxford comma - out += " " - if article: - out += article + " " - out += str(sequence[-1]) - return out - - -def comma_or(sequence): - return comma_list(sequence, "or") - - -def comma_and(sequence): - return comma_list(sequence, "and") - - -def quote(sequence, q="'"): - return ["%s%s%s" % (q, e, q) for e in sequence] - - -def plural(n, singular, plural=None, show_n=True): - """Pluralize word by adding an s if n != 1. - - Arguments: - n (int): number of things there are - singular (str): singular form of word - plural (str or None): optional plural form, for when it's not just - singular + 's' - show_n (bool): whether to include n in the result string (default True) - - Returns: - (str): "1 thing" if n == 1 or "n things" if n != 1 - """ - number = "%s " % n if show_n else "" - if n == 1: - return "%s%s" % (number, singular) - elif plural is not None: - return "%s%s" % (number, plural) - else: - return "%s%ss" % (number, singular) diff --git a/lib/spack/spack/util/url.py b/lib/spack/spack/util/url.py index 9b3c55f3320..0644a17adac 100644 --- a/lib/spack/spack/util/url.py +++ b/lib/spack/spack/util/url.py @@ -14,7 +14,9 @@ import urllib.parse import urllib.request -from spack.util.path import convert_to_posix_path, sanitize_filename +from llnl.path import convert_to_posix_path + +from spack.util.path import sanitize_filename def validate_scheme(scheme): diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py index e0b9a5540b9..7b045d62628 100644 --- a/lib/spack/spack/variant.py +++ b/lib/spack/spack/variant.py @@ -15,10 +15,10 @@ import llnl.util.lang as lang import llnl.util.tty.color +from llnl.string import comma_or import spack.directives import spack.error as error -from spack.util.string import comma_or special_variant_values = [None, "none", "*"]