diff --git a/.github/workflows/build-candidate-release-alma9.yml b/.github/workflows/build-candidate-release-alma9.yml index bf21586cd..28deee640 100644 --- a/.github/workflows/build-candidate-release-alma9.yml +++ b/.github/workflows/build-candidate-release-alma9.yml @@ -21,7 +21,7 @@ jobs: name: build_dev_release_spack runs-on: daq container: - image: ghcr.io/dune-daq/alma9-slim-externals:v2.2 + image: ghcr.io/dune-daq/alma9-slim-externals:v2.3 defaults: run: shell: bash @@ -79,7 +79,7 @@ jobs: strategy: matrix: include: - - input_image: "ghcr.io/dune-daq/alma9-slim-externals:v2.2" + - input_image: "ghcr.io/dune-daq/alma9-slim-externals:v2.3" output_image: "ghcr.io/dune-daq/candidate-release-alma9" tag: ${{ github.event.inputs.det }}daq-${{ github.event.inputs.det-release }}-rc${{ github.event.inputs.build-number }}-a9 needs: build_the_candidate_release_spack diff --git a/.github/workflows/build-nightly-release-alma9.yml b/.github/workflows/build-nightly-release-alma9.yml index 880c3dab4..c177d3eba 100644 --- a/.github/workflows/build-nightly-release-alma9.yml +++ b/.github/workflows/build-nightly-release-alma9.yml @@ -1,4 +1,4 @@ -name: Alma9 build v5 nightly release with externals v2.2 +name: Alma9 build v5 nightly release with externals v2.3 on: schedule: @@ -63,7 +63,7 @@ jobs: runs-on: daq needs: make_tags container: - image: ghcr.io/dune-daq/alma9-slim-externals:v2.2 + image: ghcr.io/dune-daq/alma9-slim-externals:v2.3 defaults: run: shell: bash @@ -123,7 +123,7 @@ jobs: strategy: matrix: include: - - input_image: "ghcr.io/dune-daq/alma9-slim-externals:v2.2" + - input_image: "ghcr.io/dune-daq/alma9-slim-externals:v2.3" output_image: "ghcr.io/dune-daq/nightly-release-alma9" tag: "development_v5${{ github.event.inputs.tag-prefix }}" needs: [build_the_develop_release_spack, make_tags] diff --git a/.github/workflows/build-stable-release-alma9.yml b/.github/workflows/build-stable-release-alma9.yml index c2df90bb2..c3dce4fa3 100644 --- a/.github/workflows/build-stable-release-alma9.yml +++ b/.github/workflows/build-stable-release-alma9.yml @@ -21,7 +21,7 @@ jobs: name: build_stable_release_spack runs-on: daq container: - image: ghcr.io/dune-daq/alma9-slim-externals:v2.2 + image: ghcr.io/dune-daq/alma9-slim-externals:v2.3 defaults: run: shell: bash @@ -80,7 +80,7 @@ jobs: strategy: matrix: include: - - input_image: "ghcr.io/dune-daq/alma9-slim-externals:v2.2" + - input_image: "ghcr.io/dune-daq/alma9-slim-externals:v2.3" output_image: "ghcr.io/dune-daq/stable-release-alma9" tag: ${{ github.event.inputs.det }}daq-${{ github.event.inputs.det-release }}-a9 needs: build_the_stable_release_spack diff --git a/.github/workflows/slim_externals.yaml b/.github/workflows/slim_externals.yaml index 7673f2aa8..b087e625b 100644 --- a/.github/workflows/slim_externals.yaml +++ b/.github/workflows/slim_externals.yaml @@ -4,13 +4,13 @@ on: workflow_dispatch: inputs: tag-suffix: - description: 'optional suffix for test-only externals image (e.g., T would mean alma9-slim-externals:v2.2T)' + description: 'optional suffix for test-only externals image (e.g., T would mean alma9-slim-externals:v2.3T)' default: '' account-to-copy: description: 'the user account whose docker-scratch/cvmfs_dunedaq area you want to copy (default dunedaq)' default: 'dunedaq' spack-version: - description: 'the version of Spack the v2.2 externals were built with (default 0.22.0)' + description: 'the version of Spack the v2.3 externals were built with (default 0.22.0)' default: '0.22.0' jobs: @@ -24,8 +24,8 @@ jobs: steps: - name: Intro run: | - echo "Will create a ghcr.io/dune-daq/alma9-slim-externals:v2.2${{ github.event.inputs.tag-suffix }} image" - echo "Image contents will include $HOSTNAME:/home/nfs/${{ github.event.inputs.account-to-copy }}/docker-scratch/cvmfs_dunedaq/spack/externals/ext-v2.2/spack-${{ github.event.inputs.spack-version }}" + echo "Will create a ghcr.io/dune-daq/alma9-slim-externals:v2.3${{ github.event.inputs.tag-suffix }} image" + echo "Image contents will include $HOSTNAME:/home/nfs/${{ github.event.inputs.account-to-copy }}/docker-scratch/cvmfs_dunedaq/spack/externals/ext-v2.3/spack-${{ github.event.inputs.spack-version }}" - name: Log in to the Container registry uses: docker/login-action@v3 @@ -41,7 +41,7 @@ jobs: images: | ghcr.io/dune-daq/alma9-slim-externals tags: | - type=raw,value=v2.2${{ github.event.inputs.tag-suffix }}-initial + type=raw,value=v2.3${{ github.event.inputs.tag-suffix }}-initial - name: prepare build dir id: prep_build_dir @@ -52,12 +52,11 @@ jobs: echo "FROM ghcr.io/dune-daq/alma9-spack:latest" > Dockerfile echo 'MAINTAINER John Freeman "jcfree@fnal.gov"' >> Dockerfile echo "ENV REFRESHED_AT $refresh_date" >> Dockerfile - echo "ADD spack/externals/ext-v2.2/spack-${{ github.event.inputs.spack-version }} /cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.2/spack-${{ github.event.inputs.spack-version }}" >> Dockerfile - echo "RUN source /cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.2/spack-${{ github.event.inputs.spack-version }}/share/spack/setup-env.sh && spack uninstall -y llvm || true" >> Dockerfile + echo "ADD spack/externals/ext-v2.3/spack-${{ github.event.inputs.spack-version }} /cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.3/spack-${{ github.event.inputs.spack-version }}" >> Dockerfile + echo "RUN source /cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.3/spack-${{ github.event.inputs.spack-version }}/share/spack/setup-env.sh && spack uninstall -y llvm || true" >> Dockerfile echo "ADD tools /cvmfs/dunedaq.opensciencegrid.org/tools" >> Dockerfile echo "ADD assets /cvmfs/dunedaq.opensciencegrid.org/assets" >> Dockerfile echo "ADD setup_dunedaq.sh /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh" >> Dockerfile - echo "ADD pypi-repo /cvmfs/dunedaq.opensciencegrid.org/pypi-repo" >> Dockerfile echo 'ENTRYPOINT ["/bin/bash"]' >> Dockerfile - name: Build and push Docker images @@ -100,7 +99,7 @@ jobs: images: | ghcr.io/dune-daq/alma9-slim-externals tags: | - type=raw,value=v2.2${{ github.event.inputs.tag-suffix }} + type=raw,value=v2.3${{ github.event.inputs.tag-suffix }} - name: prepare build dir run: | @@ -111,11 +110,10 @@ jobs: echo "FROM ghcr.io/dune-daq/alma9-spack:latest" > Dockerfile echo 'MAINTAINER John Freeman "jcfree@fnal.gov"' >> Dockerfile echo "ENV REFRESHED_AT $refresh_date" >> Dockerfile - echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.2${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/spack /cvmfs/dunedaq.opensciencegrid.org/spack" >> Dockerfile - echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.2${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/tools /cvmfs/dunedaq.opensciencegrid.org/tools" >> Dockerfile - echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.2${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/assets /cvmfs/dunedaq.opensciencegrid.org/assets" >> Dockerfile - echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.2${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh" >> Dockerfile - echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.2${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/pypi-repo /cvmfs/dunedaq.opensciencegrid.org/pypi-repo" >> Dockerfile + echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.3${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/spack /cvmfs/dunedaq.opensciencegrid.org/spack" >> Dockerfile + echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.3${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/tools /cvmfs/dunedaq.opensciencegrid.org/tools" >> Dockerfile + echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.3${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/assets /cvmfs/dunedaq.opensciencegrid.org/assets" >> Dockerfile + echo "COPY --from=ghcr.io/dune-daq/alma9-slim-externals:v2.3${{ github.event.inputs.tag-suffix }}-initial /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh" >> Dockerfile echo 'ENTRYPOINT ["/bin/bash"]' >> Dockerfile - name: Build and push Docker images diff --git a/.github/workflows/wf-setup-tools.sh b/.github/workflows/wf-setup-tools.sh index f61ac1215..10747a3c0 100644 --- a/.github/workflows/wf-setup-tools.sh +++ b/.github/workflows/wf-setup-tools.sh @@ -28,9 +28,9 @@ echo "Assuming detector release tag is $DET_RELEASE_TAG (i.e. the same name as t if [[ $OS == almalinux9 && $RELEASE_TYPE == production_v4 ]]; then # Alma9 v4 production nightly, externals v2.0 export EXT_VERSION=v2.0 export GCC_VERSION=12.1.0 -elif [[ $OS == almalinux9 && $RELEASE_TYPE == nightly ]]; then # Alma9 v5 development nightly, externals v2.2 - export EXT_VERSION=v2.2 - export GCC_VERSION=13.2.0 +elif [[ $OS == almalinux9 && $RELEASE_TYPE == nightly ]]; then # Alma9 v5 development nightly, externals v2.3 + export EXT_VERSION=v2.3 + export GCC_VERSION=14.3.0 elif [[ $OS == almalinux9 && $DET_RELEASE_TAG =~ "v4." ]]; then # Alma9 v4 candidate or stable, externals v2.0 export EXT_VERSION=v2.0 export GCC_VERSION=12.1.0 diff --git a/configs/coredaq/coredaq-develop/release.yaml b/configs/coredaq/coredaq-develop/release.yaml index 167e9e0eb..3ce31d59c 100644 --- a/configs/coredaq/coredaq-develop/release.yaml +++ b/configs/coredaq/coredaq-develop/release.yaml @@ -14,10 +14,10 @@ version: 3.17.14 variant: ~ - name: nlohmann-json - version: 3.11.2 + version: 3.12.0 variant: ~ - name: pistache - version: fddaq-v5.3.0 + version: fddaq-v5.6.0 variant: ~ - name: highfive version: 2.9.0 @@ -41,7 +41,7 @@ version: 2.12.0 variant: ~ - name: uhal - version: 2.8.1 + version: 2.8.18 variant: ~ - name: librdkafka version: 2.2.0 @@ -56,7 +56,7 @@ version: fddaq-v5.3.0 variant: ~ - name: folly - version: 2024.12.02.00 + version: 2025.11.24.00 variant: "cxxstd=2a" - name: cli11 version: 2.3.2 @@ -74,13 +74,13 @@ version: 0.6.7 variant: ~ - name: py-anyconfig - version: 0.9.11 + version: 0.14.0 variant: ~ - name: py-jsonnet version: 0.16.0 variant: ~ - name: rclone - version: 1.64.0 + version: 1.69.1 variant: ~ - name: libtorrent version: 2.0.9 @@ -91,13 +91,19 @@ - name: libevent version: 2.1.12 variant: "~openssl" + - name: glib + version: 2.80.5 + variant: ~ + - name: openmpi + version: 5.0.9 + variant: ~ devtools: - name: cmake - version: 3.26.3 - variant: "~ownlibs" + version: 4.1.2 + variant: "+ownlibs" - name: gdb - version: 14.1 + version: 16.2 variant: "~python" - name: ninja version: 1.10.0 @@ -105,10 +111,10 @@ systems: - name: python - version: 3.10.10 + version: 3.12.12 variant: "~ssl" - name: gcc - version: 13.2.0 + version: 14.3.0 variant: "+binutils" coredaq: diff --git a/configs/fddaq/fddaq-develop/release.yaml b/configs/fddaq/fddaq-develop/release.yaml index 2107956df..321848025 100644 --- a/configs/fddaq/fddaq-develop/release.yaml +++ b/configs/fddaq/fddaq-develop/release.yaml @@ -64,40 +64,52 @@ pymodules: - name: pip - version: 24.3.1 + version: 25.3 source: pypi - - name: aniso8601 - version: 9.0.1 + - name: aiohappyeyeballs + version: 2.6.1 + source: pypi + - name: aiohttp + version: 3.13.3 + source: pypi + - name: aiohttp-jinja2 + version: 1.6 source: pypi - - name: anyconfig - version: 0.14.0 + - name: aiosignal + version: 1.4.0 + source: pypi + - name: aniso8601 + version: 10.0.1 source: pypi - name: anyio - version: 4.6.2.post1 + version: 4.12.1 source: pypi - - name: argcomplete - version: 3.5.1 + - name: asttokens + version: 3.0.1 source: pypi - name: attrs - version: 24.2.0 + version: 25.4.0 + source: pypi + - name: bcrypt + version: 5.0.0 source: pypi - name: blinker version: 1.9.0 source: pypi - name: cachelib - version: 0.9.0 - source: pypi - - name: cachetools - version: 5.5.0 + version: 0.13.0 source: pypi - name: certifi - version: 2024.8.30 + version: 2026.1.4 + source: pypi + - name: cffi + version: 2.0.0 source: pypi - name: charset-normalizer - version: 3.4.0 + version: 3.4.4 source: pypi - name: click - version: 8.1.7 + version: 8.3.1 source: pypi - name: click-didyoumean version: 0.3.1 @@ -108,14 +120,14 @@ - name: colorama version: 0.4.6 source: pypi - - name: configparser - version: 7.1.0 - source: pypi - name: connectivityserver version: develop source: github_DUNE-DAQ - name: contourpy - version: 1.3.1 + version: 1.3.3 + source: pypi + - name: cryptography + version: 46.0.3 source: pypi - name: cycler version: 0.12.1 @@ -126,8 +138,11 @@ - name: daqpytools version: develop source: github_DUNE-DAQ - - name: docker - version: 7.1.0 + - name: decorator + version: 5.2.1 + source: pypi + - name: docopt + version: 0.6.2 source: pypi - name: drunc version: develop @@ -135,53 +150,50 @@ - name: druncschema version: develop source: github_DUNE-DAQ - - name: durationpy - version: 0.9 - source: pypi - - name: elisa_client_api + - name: elisa-client-api version: develop source: github_DUNE-DAQ - - name: et_xmlfile - version: 2.0.0 - source: pypi - - name: exceptiongroup - version: 1.2.2 + - name: executing + version: 2.2.1 source: pypi - - name: fastjsonschema - version: 2.21.0 + - name: flask + version: 3.1.2 source: pypi - - name: Flask - version: 3.1.0 - source: pypi - - name: Flask-Caching - version: 2.3.0 + - name: flask-caching + version: 2.3.1 source: pypi - - name: Flask-HTTPAuth + - name: flask-httpauth version: 4.8.0 source: pypi - - name: Flask-RESTful + - name: flask-restful version: 0.3.10 source: pypi - - name: Flask-SQLAlchemy + - name: flask-sqlalchemy version: 3.1.1 source: pypi - name: fonttools - version: 4.55.0 + version: 4.61.1 + source: pypi + - name: frozenlist + version: 1.8.0 source: pypi - name: gevent - version: 24.11.1 + version: 25.9.1 source: pypi - - name: gojsonnet - version: 0.20.0 + - name: gitdb + version: 4.0.12 source: pypi - - name: googleapis-common-protos - version: 1.70.0 + - name: gitpython + version: 3.1.46 source: pypi - name: google-auth - version: 2.36.0 + version: 2.47.0 + source: pypi + - name: googleapis-common-protos + version: 1.70.0 source: pypi - name: greenlet - version: 3.1.1 + version: 3.3.0 source: pypi - name: grpcio version: 1.75.0 @@ -196,172 +208,184 @@ version: 23.0.0 source: pypi - name: h11 - version: 0.14.0 + version: 0.16.0 source: pypi - name: h5py - version: 3.12.1 + version: 3.15.1 source: pypi - name: httpcore - version: 1.0.7 + version: 1.0.9 source: pypi - name: httpx - version: 0.27.2 + version: 0.28.1 source: pypi - name: idna - version: 3.10 + version: 3.11 source: pypi - name: iniconfig - version: 2.0.0 + version: 2.3.0 source: pypi - name: integrationtest version: develop source: github_DUNE-DAQ - - name: itsdangerous - version: 2.2.0 + - name: invoke + version: 2.2.1 + source: pypi + - name: ipython + version: 9.9.0 source: pypi - - name: Jinja2 - version: 3.1.4 + - name: ipython-pygments-lexers + version: 1.1.1 source: pypi - - name: jsonpointer - version: 3.0.0 + - name: itsdangerous + version: 2.2.0 source: pypi - - name: jsonschema - version: 4.23.0 + - name: jedi + version: 0.19.2 source: pypi - - name: jsonschema-specifications - version: 2024.10.1 + - name: jinja2 + version: 3.1.6 source: pypi - name: kafka-python - version: 2.0.2 + version: 2.3.0 source: pypi - name: kiwisolver - version: 1.4.7 + version: 1.4.9 source: pypi - name: kubernetes - version: 31.0.0 + version: 34.1.0 source: pypi - name: linkify-it-py version: 2.0.3 source: pypi - name: lxml - version: 5.1.0 + version: 6.0.2 source: pypi - name: markdown-it-py - version: 3.0.0 + version: 4.0.0 source: pypi - - name: MarkupSafe - version: 3.0.2 + - name: markupsafe + version: 3.0.3 source: pypi - name: matplotlib - version: 3.9.2 + version: 3.10.8 + source: pypi + - name: matplotlib-inline + version: 0.2.1 source: pypi - name: mdit-py-plugins - version: 0.4.2 + version: 0.5.0 source: pypi - name: mdurl version: 0.1.2 source: pypi - - name: moo - version: 0.6.7 - source: github_brettviren + - name: msgpack + version: 1.1.2 + source: pypi + - name: multidict + version: 6.7.0 + source: pypi - name: nest-asyncio version: 1.6.0 source: pypi - name: num2words - version: 0.5.13 + version: 0.5.14 source: pypi - name: numpy - version: 2.1.3 + version: 2.4.0 source: pypi - name: oauthlib - version: 3.2.2 - source: pypi - - name: openpyxl - version: 3.1.5 + version: 3.3.1 source: pypi - name: packaging - version: 24.2 + version: 25.0 source: pypi - name: pandas - version: 2.2.3 + version: 2.3.3 source: pypi - name: paramiko version: 4.0.0 source: pypi + - name: parso + version: 0.8.5 + source: pypi - name: pexpect version: 4.9.0 source: pypi - name: pillow - version: 11.0.0 - source: pypi - - name: pipx - version: 1.7.1 + version: 12.1.0 source: pypi - name: platformdirs - version: 4.3.6 + version: 4.5.1 source: pypi - name: pluggy - version: 1.5.0 + version: 1.6.0 + source: pypi + - name: prompt-toolkit + version: 3.0.52 + source: pypi + - name: propcache + version: 0.4.1 source: pypi - name: protobuf - version: 6.32.1 + version: 6.33.2 source: pypi - name: psutil - version: 6.1.0 + version: 7.2.1 source: pypi - name: ptyprocess version: 0.7.0 source: pypi - - name: py - version: 1.11.0 + - name: pure-eval + version: 0.2.3 source: pypi - name: pyasn1 version: 0.6.1 source: pypi - - name: pyasn1_modules - version: 0.4.1 + - name: pyasn1-modules + version: 0.4.2 + source: pypi + - name: pycparser + version: 2.23 source: pypi - - name: Pygments - version: 2.18.0 + - name: pygments + version: 2.19.2 + source: pypi + - name: pynacl + version: 1.6.2 source: pypi - name: pyparsing - version: 3.2.0 + version: 3.3.1 source: pypi - - name: PySocks + - name: pysocks version: 1.7.1 source: pypi - name: pytest - version: 8.3.3 + version: 9.0.2 source: pypi - name: python-dateutil version: 2.9.0.post0 source: pypi - name: python-ipmi - version: 0.5.7 + version: 0.5.8 source: pypi - name: pytz - version: 2024.2 - source: pypi - - name: PyYAML - version: 6.0.2 + version: 2025.2 source: pypi - - name: referencing - version: 0.35.1 + - name: pyyaml + version: 6.0.3 source: pypi - name: requests - version: 2.32.3 + version: 2.32.5 source: pypi - name: requests-oauthlib version: 2.0.0 source: pypi - name: rich - version: 13.9.4 - source: pypi - - name: rpds-py - version: 0.21.0 + version: 14.2.0 source: pypi - name: rsa - version: 4.9 + version: 4.9.1 source: pypi - name: runconftools version: develop @@ -369,51 +393,72 @@ - name: runconf-ui version: develop source: github_DUNE-DAQ + - name: setuptools + version: 80.9.0 + source: pypi - name: sh - version: 2.1.0 + version: 2.2.2 source: pypi - name: six - version: 1.16.0 + version: 1.17.0 + source: pypi + - name: smmap + version: 5.0.2 source: pypi - - name: sniffio - version: 1.3.1 + - name: sqlalchemy + version: 2.0.45 source: pypi - - name: SQLAlchemy - version: 2.0.36 + - name: stack-data + version: 0.6.3 source: pypi - name: textual - version: 0.87.1 + version: 7.0.2 + source: pypi + - name: textual-dev + version: 1.8.0 source: pypi - - name: tomli - version: 2.1.0 + - name: textual-serve + version: 1.1.3 source: pypi - - name: transitions - version: 0.9.2 + - name: tqdm + version: 4.67.1 source: pypi - - name: typing_extensions + - name: traitlets + version: 5.14.3 + source: pypi + - name: types-grpcio + version: 1.0.0.20251009 + source: pypi + - name: types-protobuf + version: 6.32.1.20251210 + source: pypi + - name: typing-extensions version: 4.15.0 source: pypi - name: tzdata - version: 2024.2 + version: 2025.3 source: pypi - name: uc-micro-py version: 1.0.3 source: pypi - name: urllib3 - version: 2.2.3 + version: 2.3.0 source: pypi - - name: userpath - version: 1.9.2 + - name: wcwidth + version: 0.2.14 source: pypi - name: websocket-client - version: 1.8.0 + version: 1.9.0 + source: pypi + - name: werkzeug + version: 3.1.5 source: pypi - - name: Werkzeug - version: 3.1.3 + - name: yarl + version: 1.22.0 source: pypi - - name: zope.event - version: 5.0 + - name: zope-event + version: 6.1 source: pypi - - name: zope.interface - version: 7.1.1 + - name: zope-interface + version: 8.2 source: pypi diff --git a/scripts/spack/build-ext.sh b/scripts/spack/build-ext.sh index bae82b8d4..881b00d9c 100755 --- a/scripts/spack/build-ext.sh +++ b/scripts/spack/build-ext.sh @@ -3,8 +3,8 @@ # Example usage: # docker run -it --name \ - # -e "EXT_VERSION=2.2" -e "DAQ_RELEASE=EXT2.2ADD" \ - # -e "SPACK_VERSION=0.22.0" -e "GCC_VERSION=13.2.0" -e "ARCH=linux-almalinux9-x86_64" \ + # -e "EXT_VERSION=2.3" -e "DAQ_RELEASE=EXT2.3ADD" \ + # -e "SPACK_VERSION=0.22.0" -e "GCC_VERSION=14.3.0" -e "ARCH=linux-almalinux9-x86_64" \ # -v :/daq-release \ # -v :/log \ # -v :/cvmfs/dunedaq.opensciencegrid.org \ @@ -164,7 +164,7 @@ dbe_spec="dbe%gcc@${GCC_VERSION} build_type=RelWithDebInfo arch=${ARCH} ^qt@5.15 boost_spec="boost@1.85.0%gcc@${GCC_VERSION}+atomic+chrono~clanglibcpp+container+context~contract~coroutine+date_time~debug+exception~fiber+filesystem+graph~graph_parallel~icu+iostreams~json+locale+log+math~mpi+multithreaded~nowide~numpy~pic+program_options~python+random+regex+serialization+shared+signals~singlethreaded~stacktrace+system~taggedlayout+test+thread+timer~type_erasure~versionedlayout+wave" -llvm_spec="llvm@18.1.3%gcc@${GCC_VERSION}~gold~libomptarget~lld~lldb~lua~polly build_type=MinSizeRel compiler-rt=none libcxx=none libunwind=none targets=none arch=${ARCH}" +llvm_spec="llvm@19.1.7%gcc@${GCC_VERSION}~gold~libomptarget~lld~lldb~lua~polly build_type=MinSizeRel compiler-rt=none libcxx=none libunwind=none targets=none arch=${ARCH}" dpdk_spec="dpdk max_lcores=512" @@ -172,6 +172,11 @@ dpdk_spec="dpdk max_lcores=512" gcc_spec="/${gcc_hash}" umbrella_spec="umbrella ^$gcc_spec ^$coredaq_spec ^$dbe_spec ^$llvm_spec ^$boost_spec ^$dpdk_spec" +#echo "JCF, Dec-12-2025: FOR DEVELOPMENT PURPOSES, SKIPPING llvm BUILD FOR NOW" >&2 +#echo "JCF, Dec-17-2025: also force version of py-openpyxl" >&2 + +#umbrella_spec="umbrella ^$gcc_spec ^$coredaq_spec ^$dbe_spec ^$boost_spec ^$dpdk_spec ^py-openpyxl@3.1.2" +#umbrella_spec="umbrella ^$gcc_spec ^$coredaq_spec ^$dbe_spec ^$boost_spec ^$dpdk_spec" echo $umbrella_spec @@ -194,7 +199,7 @@ spack install --reuse graphviz@8.0.5%gcc@${GCC_VERSION}~doc+expat~ghostscript~gt for pkg in daq-cmake externals devtools systems; do echo "Uninstalling $pkg" - spack uninstall -y --all --dependents $pkg || echo "Spack uninstall of $pkg returned nonzero" + spack uninstall -y --all --dependents $pkg || echo "Spack uninstall of $pkg returned nonzero" >> /log/uninstallations.txt done # Step 8 -- remove any unneeded externals (build-only packages, and those which are dependencies of build-only packages only) @@ -203,19 +208,23 @@ done build_only_packages=$( cat /log/spack_spec_umbrella.txt | sed -r -n 's/.*\[b \] +\^([^@]+).*/\1/p' ) +#echo "FOR DEVELOPMENT PURPOSES, SKIPPING UNINSTALLATION OF BUILD-ONLY DEPENDENCIES" for pkg in $build_only_packages; do echo "Uninstalling $pkg" - spack uninstall -y $pkg || echo "Spack uninstall of $pkg returned nonzero" + spack uninstall -y $pkg || echo "Spack uninstall of $pkg returned nonzero" >> /log/uninstallations.txt done # Now packages which are dependencies of build-only packages -for pkg in py-hatch-vcs py-setuptools-scm py-typing-extensions go-bootstrap git libidn2 docbook-xsl docbook-xml go libunistring gmake diffutils sed libtool bison flex autoconf automake openssl; do +for pkg in py-hatch-vcs py-setuptools-scm py-typing-extensions go-bootstrap git openssh krb5 libidn2 docbook-xsl docbook-xml go libunistring gmake diffutils sed libtool bison flex autoconf automake openssl; do echo "Uninstalling $pkg" - spack uninstall -y $pkg || echo "Spack uninstall of $pkg returned nonzero; this likely means it had already been uninstalled" + spack uninstall -y $pkg || echo "Spack uninstall of $pkg returned nonzero; this likely means it had already been uninstalled" >> /log/uninstallations.txt done spack find -l | sort |& tee /log/externals_list.txt +echo "Calling spack clean -a ..." +spack clean -a + endtime=$( date ) echo "Externals build complete" diff --git a/scripts/version_surveys/pyproject.toml b/scripts/version_surveys/pyproject.toml index 44e4e64ba..5a4b19714 100644 --- a/scripts/version_surveys/pyproject.toml +++ b/scripts/version_surveys/pyproject.toml @@ -5,45 +5,62 @@ authors = ["John Freeman "] readme = "README.md" [tool.poetry.dependencies] -python = ">=3.10.10,<4.0.0" # poetry is unaware there's no Python 4 -anytree = ">=2.8.0" +python = "3.12.12" click = ">=8.1.7" -click-didyoumean = ">=0.3.0" +click-didyoumean = ">=0.3.1" click-shell = ">=2.1" -colorama = ">=0.4.4" +colorama = ">=0.4.6" connectivityserver = {git = "https://github.com/DUNE-DAQ/connectivityserver.git"} daq-assettools = {git = "https://github.com/DUNE-DAQ/daq-assettools"} -deepdiff = ">=6.3.1" +daqpytools = {git = "https://github.com/DUNE-DAQ/daqpytools"} drunc = {git = "https://github.com/DUNE-DAQ/drunc"} druncschema = {git = "https://github.com/DUNE-DAQ/druncschema"} elisa_client_api = {git = "https://github.com/DUNE-DAQ/elisa_client_api"} -Flask = ">=2.1.1" -Flask-Cors = ">=3.0.10" -Flask-Caching = ">0.1" # Oldest version I could find -Flask-HTTPAuth = ">=4.6.0" -Flask-RESTful = ">=0.3.9" -Flask-SQLAlchemy = ">=0.5" # Oldest version I could find -graphviz = ">=0.16" -h5py = ">=3.7.0" +Flask = ">=3.1.0" +Flask-Caching = ">2.3.0" +Flask-HTTPAuth = ">=4.8.0" +Flask-RESTful = ">=0.3.10" +Flask-SQLAlchemy = ">=3.1.1" +GitPython = ">=3.1.46" +googleapis-common-protos = "==1.70.0" +grpcio = "== 1.75.0" +grpcio-status = "== 1.75.0" +grpcio-tools = "== 1.75.0" +gunicorn = ">= 23.0.0" +h5py = ">=3.12.1" httpx = ">=0.23.3" integrationtest = {git = "https://github.com/DUNE-DAQ/integrationtest"} -kubernetes = ">=23.6.0" -matplotlib = ">=1.5.0" # (1) is this needed? (2) lower version bound dates to 2015 -#moo = {git = "https://github.com/brettviren/moo", rev = "0.6.7"} -nanorc = {git = "https://github.com/DUNE-DAQ/nanorc"} -numpy = ">=1.24.0" -pandas = ">= 0.8.1" # (1) is this needed? (2) lower version bound dates to 2012 -pexpect = ">=4.8.0" -psutil = ">=5.9.0" -py = ">=1.10.0" -pytest = ">= 7.3.2" -python-ipmi = ">= 0.5.1" +ipython = ">=0.0.0" +Jinja2 = ">=3.1.4" +kafka-python = ">=2.3.0" +kubernetes = ">=31.0.0" +lxml = ">=5.1.0" +matplotlib = ">=3.9.2" +nest-asyncio = ">=1.6.0" +num2words = ">=0.5.13" +numpy = ">=2.1.3" +pandas = ">= 2.2.3" +paramiko = "==4.0.0" +pexpect = ">=4.9.0" +protobuf = ">=6.32.1" +psutil = ">=6.1.0" +PySocks = ">=1.7.1" +PyYAML = ">= 6.0.2" +pytest = ">= 8.3.3" +python-ipmi = ">= 0.5.7" +pytz = ">=2024.2" +requests = ">=2.32.3" +rich = ">=13.9.4" rsa = ">= 4.8" -sh = ">= 1.14.1" -textual = ">= 0.83.0" -transitions = ">= 0.8.10" -# xmlrpclib? - +runconftools = {git = "https://github.com/DUNE-DAQ/runconftools"} +runconf-ui = {git = "https://github.com/DUNE-DAQ/runconf-ui"} +setuptools = ">=69.2.0" +sh = ">= 2.1.0" +textual = ">= 0.87.1" +textual_dev = ">= 1.8.0" +types-grpcio = ">=1.0.0.20251009" +types-protobuf = ">=6.32.1.20251210" +tqdm = ">= 0.0.0" [tool.poetry.group.dev.dependencies] diff --git a/spack-repos/externals/packages/cli11/package.py b/spack-repos/externals/packages/cli11/package.py new file mode 100644 index 000000000..80f07de0d --- /dev/null +++ b/spack-repos/externals/packages/cli11/package.py @@ -0,0 +1,32 @@ +# Copyright 2013-2024 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 Cli11(CMakePackage): + """CLI11 is a command line parser for C++11 and beyond that provides a rich + feature set with a simple and intuitive interface.""" + + homepage = "https://cliutils.github.io/CLI11/book/" + url = "https://github.com/CLIUtils/CLI11/archive/v1.9.1.tar.gz" + maintainers("nightlark") + + license("BitTorrent-1.0") + + version("2.3.2", sha256="aac0ab42108131ac5d3344a9db0fdf25c4db652296641955720a4fbe52334e22") + version("2.3.1", sha256="378da73d2d1d9a7b82ad6ed2b5bda3e7bc7093c4034a1d680a2e009eb067e7b2") + version("2.1.1", sha256="d69023d1d0ab6a22be86b4f59d449422bc5efd9121868f4e284d6042e52f682e") + version("2.1.0", sha256="2661b0112b02478bad3dc7f1749c4825bfc7e37b440cbb4c8c0e2ffaa3999112") + version("2.0.0", sha256="2c672f17bf56e8e6223a3bfb74055a946fa7b1ff376510371902adb9cb0ab6a3") + version("1.9.1", sha256="c780cf8cf3ba5ec2648a7eeb20a47e274493258f38a9b417628e0576f473a50b") + + depends_on("cmake@3.4:", type="build") + + patch("update_cmake_minimum_required.patch", when="@2.3.2", sha256="822c02127c27d26fb389ffb58e6855d96455b16a14318b45fc6691067f329df1") + + def cmake_args(self): + args = ["-DCLI11_BUILD_EXAMPLES=OFF", "-DCLI11_BUILD_DOCS=OFF", "-DCLI11_BUILD_TESTS=OFF"] + return args diff --git a/spack-repos/externals/packages/cli11/update_cmake_minimum_required.patch b/spack-repos/externals/packages/cli11/update_cmake_minimum_required.patch new file mode 100644 index 000000000..9b6a77b3e --- /dev/null +++ b/spack-repos/externals/packages/cli11/update_cmake_minimum_required.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bad2b00..9c699b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.4) ++cmake_minimum_required(VERSION 3.26.3) + # Note: this is a header only library. If you have an older CMake than 3.4, + # just add the CLI11/include directory and that's all you need to do. + +diff --git a/book/code/CMakeLists.txt b/book/code/CMakeLists.txt +index 987d53c..4dec5cd 100644 +--- a/book/code/CMakeLists.txt ++++ b/book/code/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.11) ++cmake_minimum_required(VERSION 3.26.3) + + project(CLI11_Examples LANGUAGES CXX) + +diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt +index 48f6d99..27ce416 100644 +--- a/test_package/CMakeLists.txt ++++ b/test_package/CMakeLists.txt +@@ -1,5 +1,5 @@ + project(PackageTest CXX) +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) + + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_basic_setup() diff --git a/spack-repos/externals/packages/cmake/package.py b/spack-repos/externals/packages/cmake/package.py index 6d68186b7..4ef3dd50a 100644 --- a/spack-repos/externals/packages/cmake/package.py +++ b/spack-repos/externals/packages/cmake/package.py @@ -26,6 +26,21 @@ class Cmake(Package): executables = ["^cmake[0-9]*$"] version("master", branch="master") + + version("4.2.0", sha256="4104e94657d247c811cb29985405a360b78130b5d51e7f6daceb2447830bd579") + version("4.1.2", sha256="643f04182b7ba323ab31f526f785134fb79cba3188a852206ef0473fee282a15") + version("4.1.1", sha256="b29f6f19733aa224b7763507a108a427ed48c688e1faf22b29c44e1c30549282") + version("4.0.4", sha256="629be82af0b76e029b675a4a37569e2ddc1769d42a768957c00ec0e98407737e") + version( + "3.31.9", + sha256="5d4fdec04247ca8a8e8f63692f0d0f1e9d6d082a2bdd008dff8ab3ba7215aa83", + preferred=True, + ) + version("3.30.9", sha256="65f765bb87c8019316cabe67cbe5e8f45ede334eeb5afd161ca6874d17994e0d") + version("3.29.6", sha256="1391313003b83d48e2ab115a8b525a557f78d8c1544618b48d1d90184a10f0af") + version("3.28.6", sha256="c39c733900affc4eb0e9688b4d1a45435a732105d9bf9cc1e75dd2b9b81a36bb") + version("3.27.9", sha256="609a9b98572a6a5ea477f912cffb973109ed4d0a6a6b3f9e2353d2cdc048708e") + version("3.26.6", sha256="070b9a2422e666d2c1437e2dab239a236e8a63622d0a8d0ffe9e389613d2b76a") version("3.26.3", sha256="bbd8d39217509d163cb544a40d6428ac666ddc83e22905d3e52c925781f0f659") version("3.26.2", sha256="d54f25707300064308ef01d4d21b0f98f508f52dda5d527d882b9d88379f89a8") version("3.26.1", sha256="f29964290ad3ced782a1e58ca9fda394a82406a647e24d6afd4e6c32e42c412f") @@ -162,6 +177,11 @@ class Cmake(Package): values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"), ) + patch("suppress_excessive_warning.patch", + sha256="8676b35476eef5d4b92fc31dfba2c1d229968629e8fee0372f8dba91a7f8a115", + when="@4.1.2" + ) + patch( "cmake-findprotobuf.patch", sha256="4759c83e94606f7e69668b1f457fe7c5ff5d98826b5c23a837e4718cd4bcab90", @@ -227,11 +247,13 @@ class Cmake(Package): depends_on("libuv@1.10.0:1.10", when="@3.11.0:3.11") depends_on("libuv@1.10.0:", when="@3.12.0:") depends_on("rhash", when="@3.8.0:") + depends_on("jsoncpp build_system=meson", when="@3.2:") for plat in ["darwin", "linux", "cray"]: with when("+ownlibs platform=%s" % plat): - depends_on("openssl") - depends_on("openssl@:1.0", when="@:3.6.9") + pass # JCF, Jan-5-2026: use system openssl, not Spack openssl + #depends_on("openssl") + #depends_on("openssl@:1.0", when="@:3.6.9") depends_on("qt", when="+qt") depends_on("ncurses", when="+ncurses") @@ -320,7 +342,8 @@ def flag_handler(self, name, flags): def setup_build_environment(self, env): spec = self.spec if "+ownlibs" in spec and "platform=windows" not in spec: - env.set("OPENSSL_ROOT_DIR", spec["openssl"].prefix) + env.set("OPENSSL_ROOT_DIR", "/usr") + #env.set("OPENSSL_ROOT_DIR", spec["openssl"].prefix) def bootstrap_args(self): spec = self.spec diff --git a/spack-repos/externals/packages/cmake/suppress_excessive_warning.patch b/spack-repos/externals/packages/cmake/suppress_excessive_warning.patch new file mode 100644 index 000000000..7b39eca05 --- /dev/null +++ b/spack-repos/externals/packages/cmake/suppress_excessive_warning.patch @@ -0,0 +1,20 @@ +diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx +index 45838630..3a345b24 100644 +--- a/Source/cmPolicies.cxx ++++ b/Source/cmPolicies.cxx +@@ -396,14 +396,7 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) + + std::string cmPolicies::GetPolicyDeprecatedWarning(cmPolicies::PolicyID id) + { +- return cmStrCat( +- "The OLD behavior for policy ", idToString(id), +- " " +- "will be removed from a future version of CMake.\n" +- "The cmake-policies(7) manual explains that the OLD behaviors of all " +- "policies are deprecated and that a policy should be set to OLD only " +- "under specific short-term circumstances. Projects should be ported " +- "to the NEW behavior and not rely on setting a policy to OLD."); ++ return cmStrCat("Suppressed harmless CMake policy deprecation warning for ", idToString(id), "\n"); + } + + bool cmPolicies::IsRemoved(cmPolicies::PolicyID id) diff --git a/spack-repos/externals/packages/cyrus-sasl/cyrus-fix-time-headers.patch b/spack-repos/externals/packages/cyrus-sasl/cyrus-fix-time-headers.patch new file mode 100644 index 000000000..8712e98cc --- /dev/null +++ b/spack-repos/externals/packages/cyrus-sasl/cyrus-fix-time-headers.patch @@ -0,0 +1,57 @@ +From 266f0acf7f5e029afbb3e263437039e50cd6c262 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Wed, 23 Feb 2022 00:45:15 +0000 +Subject: [PATCH] Fix check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We're conditionally including based on HAVE_TIME_H in a bunch of places, +but we're not actually checking for time.h, so that's never going to be defined. + +While at it, add in a missing include in the cram plugin. + +This fixes a bunch of implicit declaration warnings: +``` + * cyrus-sasl-2.1.28/lib/saslutil.c:280:3: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration] + * cyrus-sasl-2.1.28/lib/saslutil.c:364:41: warning: implicit declaration of function ‘clock’ [-Wimplicit-function-declaration] + * cyrus-sasl-2.1.28/plugins/cram.c:132:7: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration] + * cyrus-sasl-2.1.28/lib/saslutil.c:280:3: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration] + * cyrus-sasl-2.1.28/lib/saslutil.c:364:41: warning: implicit declaration of function ‘clock’ [-Wimplicit-function-declaration] + * cyrus-sasl-2.1.28/plugins/cram.c:132:7: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration] +``` + +Signed-off-by: Sam James +--- + configure.ac | 2 +- + plugins/cram.c | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index e1bf53b62d007a1bb54c1378f1729a7614e95cd4..ad78183046124082142baba44ae6a1aee367c212 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1290,7 +1290,7 @@ AC_CHECK_HEADERS_ONCE([sys/time.h]) + + AC_HEADER_DIRENT + AC_HEADER_SYS_WAIT +-AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h) ++AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h time.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h) + + IPv6_CHECK_SS_FAMILY() + IPv6_CHECK_SA_LEN() +diff --git a/plugins/cram.c b/plugins/cram.c +index d02e9baa734cc39e6b70e23f6971de17388482c6..695aaa91869e74e91b71f02e17f9457e39a47054 100644 +--- a/plugins/cram.c ++++ b/plugins/cram.c +@@ -53,6 +53,10 @@ + #endif + #include + ++#ifdef HAVE_TIME_H ++#include ++#endif ++ + #include + #include + #include diff --git a/spack-repos/externals/packages/cyrus-sasl/dunedaq-cyrus-fix-time-headers.patch b/spack-repos/externals/packages/cyrus-sasl/dunedaq-cyrus-fix-time-headers.patch new file mode 100644 index 000000000..b3c437caf --- /dev/null +++ b/spack-repos/externals/packages/cyrus-sasl/dunedaq-cyrus-fix-time-headers.patch @@ -0,0 +1,12 @@ +diff --git a/plugins/cram.c b/plugins/cram.c +index d02e9baa..f9adf9ca 100644 +--- a/plugins/cram.c ++++ b/plugins/cram.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + #ifndef macintosh + #include + #endif diff --git a/spack-repos/externals/packages/cyrus-sasl/package.py b/spack-repos/externals/packages/cyrus-sasl/package.py index 282514600..ca4d0af5c 100644 --- a/spack-repos/externals/packages/cyrus-sasl/package.py +++ b/spack-repos/externals/packages/cyrus-sasl/package.py @@ -13,15 +13,24 @@ class CyrusSasl(AutotoolsPackage): homepage = "https://github.com/cyrusimap/cyrus-sasl" url = "https://github.com/cyrusimap/cyrus-sasl/archive/cyrus-sasl-2.1.27.tar.gz" + git = "https://github.com/cyrusimap/cyrus-sasl.git" license("custom") version("2.1.28", sha256="3e38933a30b9ce183a5488b4f6a5937a702549cde0d3287903d80968ad4ec341") - version("2.1.27", sha256="b564d773803dc4cff42d2bdc04c80f2b105897a724c247817d4e4a99dd6b9976") - version("2.1.26", sha256="7c14d1b5bd1434adf2dd79f70538617e6aa2a7bde447454b90b84ac5c4d034ba") - version("2.1.25", sha256="8bfd4fa4def54c760e5061f2a74c278384c3b9807f02c4b07dab68b5894cc7c1") - version("2.1.24", sha256="1df15c492f7ecb90be49531a347b3df21b041c2e0325dcc4fc5a6e98384c40dd") - version("2.1.23", sha256="b1ec43f62d68446a6a5879925c63d94e26089c5a46cd83e061dd685d014c7d1f") + + # JCF, Jan-7-2026: this patch is needed since gcc 14.x is less + # forgiving than earlier gcc versions of the time.h header being + # incorrectly left out + + patch("dunedaq-cyrus-fix-time-headers.patch", sha256="de9c4d2bd940ad6473bb5c3b407c4243e8c45d0fac375c46d7da4237178f0cc9", when="@2.1.28") + + # JCF, Jan-7-2026: Also, thanks to some obsolete tests during the + # configuration phase, cyrus-sasl incorrectly thinks that it + # doesn't have time.h available, so manually override this + + def setup_build_environment(self, env): + env.append_flags('CPPFLAGS', '-DHAVE_TIME_H=1') depends_on("m4", type="build") depends_on("autoconf", type="build") diff --git a/spack-repos/externals/packages/double-conversion/package.py b/spack-repos/externals/packages/double-conversion/package.py new file mode 100644 index 000000000..f0d720368 --- /dev/null +++ b/spack-repos/externals/packages/double-conversion/package.py @@ -0,0 +1,39 @@ +# Copyright 2013-2024 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 DoubleConversion(CMakePackage): + """This project (double-conversion) provides binary-decimal and decimal-binary + routines for IEEE doubles. + + The library consists of efficient conversion routines that have been + extracted from the V8 JavaScript engine. The code has been refactored + and improved so that it can be used more easily in other projects. + + There is extensive documentation in src/double-conversion.h. Other examples + can be found in test/cctest/test-conversions.cc. + """ + + homepage = "https://github.com/google/double-conversion" + url = "https://github.com/google/double-conversion/archive/v2.0.1.zip" + + license("BSD-3-Clause") + + version("3.3.0", sha256="4080014235f90854ffade6d1c423940b314bbca273a338235f049da296e47183") + version("3.2.1", sha256="55aa41b463346b1032585c04fe7d0adec9db56598d8d699841cdadeb3597e909") + version("3.1.5", sha256="72c0e3925a1214095afc6f1c214faecbec20e8526cf6b8a541cf72195a11887f") + version("2.0.2", sha256="7a0ae55ec9f75c22607808d091bae050a38d4a7728c52273c89d25dd5b78fcdd") + version("2.0.1", sha256="476aefbdc2051bbcca0d5919ebc293c90a7ad2c0cb6c4ad877d6e665f469146b") + version("2.0.0", sha256="437df89059bfa6c1c0f8703693c2584a57f75289ed7020d801c9befb23f46a26") + version("1.1.5", sha256="496fd3354fa0ff17562907632f5560c1d444ea98b6069f1436fa573949b94fb0") + version("1.1.4", sha256="24b5edce8c88f0f632c83e60e0bde11252656dc3b714ba195619c1798ff28834") + version("1.1.3", sha256="f0d1b8621592a3cf010c04c3e1c0f08455fc0fc7ee22e1583e2a63dc6d3e3871") + + patch("update_cmake_minimum_required.patch", when="@3.3.0", sha256="051f136b43b2d0fdb7fe0a4c062c4df240674cfbadd0a0e673375f85426547a5") + + def cmake_args(self): + return ["-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true"] diff --git a/spack-repos/externals/packages/double-conversion/update_cmake_minimum_required.patch b/spack-repos/externals/packages/double-conversion/update_cmake_minimum_required.patch new file mode 100644 index 000000000..48d968ba9 --- /dev/null +++ b/spack-repos/externals/packages/double-conversion/update_cmake_minimum_required.patch @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 644d8b6..2b4c956 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.0) ++cmake_minimum_required(VERSION 3.26.3) + project(double-conversion VERSION 3.3.0) + + option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF) diff --git a/spack-repos/externals/packages/felix-software/package.py b/spack-repos/externals/packages/felix-software/package.py index 4e46ec110..c551ac8fc 100644 --- a/spack-repos/externals/packages/felix-software/package.py +++ b/spack-repos/externals/packages/felix-software/package.py @@ -19,7 +19,7 @@ class FelixSoftware(Package): depends_on('boost', type='build') depends_on('python', type='build') - depends_on('cmake', type='build') + depends_on('cmake@3.26.3', type='build') depends_on('yaml-cpp', type=('build', 'link')) depends_on('czmq', type='build') depends_on('cppzmq', type='build') diff --git a/spack-repos/externals/packages/folly/package.py b/spack-repos/externals/packages/folly/package.py index 368e528b8..b7b36b390 100755 --- a/spack-repos/externals/packages/folly/package.py +++ b/spack-repos/externals/packages/folly/package.py @@ -20,6 +20,7 @@ class Folly(CMakePackage): homepage = "https://github.com/facebook/folly" url = "https://github.com/facebook/folly/releases/download/v2021.05.24.00/folly-v2021.05.24.00.tar.gz" + version("2025.11.24.00", sha256="46fec61b588637f90a1e4f1da07473ec25f6a9d38f11a92bbc4ae25dcade7cf7") version("2024.12.02.00", sha256="c6656ebdcade0f98925754d02a270b5c3b1d5a3a7cf16b468455fe2fc907569c") version('2021.12.13.00', sha256='87f87f5c6bf101ef15322c7351039747fb73640504d3d6de1fb719428fb0a5bc') version('2021.05.24.00', sha256='9d308adefe4670637f5c7d96309b3b394ac3fa129bc954f5dfbdd8b741c02aad') diff --git a/spack-repos/externals/packages/gcc/darwin/apfs.patch b/spack-repos/externals/packages/gcc/darwin/apfs.patch new file mode 100755 index 000000000..d1f9d5666 --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/apfs.patch @@ -0,0 +1,12 @@ +diff -uNr gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in gcc-7.2.0/libstdc++-v3/include/Makefile.in +--- gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in 2017-07-25 14:05:07.000000000 -0400 ++++ gcc-7.2.0/libstdc++-v3/include/Makefile.in 2017-09-02 12:22:08.000000000 -0400 +@@ -1764,6 +1764,8 @@ + @GLIBCXX_HOSTED_TRUE@install-data-local: install-headers + @GLIBCXX_HOSTED_FALSE@install-data-local: install-freestanding-headers + ++.NOTPARALLEL: install-headers ++ + # This is a subset of the full install-headers rule. We only need , + # , , , , , , , + # , , , , , diff --git a/spack-repos/externals/packages/gcc/darwin/clang13.patch b/spack-repos/externals/packages/gcc/darwin/clang13.patch new file mode 100755 index 000000000..ac3bfcbe2 --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/clang13.patch @@ -0,0 +1,32 @@ +--- a/gcc/genconditions.c 2019-01-01 12:37:19.064943662 +0100 ++++ b/gcc/genconditions.c 2019-10-11 10:57:11.464595789 +0200 +@@ -57,8 +57,9 @@ write_header (void) + \n\ + /* It is necessary, but not entirely safe, to include the headers below\n\ + in a generator program. As a defensive measure, don't do so when the\n\ +- table isn't going to have anything in it. */\n\ +-#if GCC_VERSION >= 3001\n\ ++ table isn't going to have anything in it.\n\ ++ Clang 9 is buggy and doesn't handle __builtin_constant_p correctly. */\n\ ++#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\ + \n\ + /* Do not allow checking to confuse the issue. */\n\ + #undef CHECKING_P\n\ +@@ -170,7 +171,7 @@ struct c_test\n\ + vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\ + optimizing. */\n\ + \n\ +-#if GCC_VERSION >= 3001\n\ ++#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\ + static const struct c_test insn_conditions[] = {\n"); + + traverse_c_tests (write_one_condition, 0); +@@ -191,7 +192,7 @@ write_writer (void) + " unsigned int i;\n" + " const char *p;\n" + " puts (\"(define_conditions [\");\n" +- "#if GCC_VERSION >= 3001\n" ++ "#if GCC_VERSION >= 3001 && __clang_major__ < 9\n" + " for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n" + " {\n" + " printf (\" (%d \\\"\", insn_conditions[i].value);\n" diff --git a/spack-repos/externals/packages/gcc/darwin/gcc-4.9.patch1 b/spack-repos/externals/packages/gcc/darwin/gcc-4.9.patch1 new file mode 100755 index 000000000..444e29278 --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/gcc-4.9.patch1 @@ -0,0 +1,42 @@ +diff --git a/gcc/configure b/gcc/configure +index 9523773..52b0bf7 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -24884,7 +24884,7 @@ if test "${gcc_cv_as_ix86_filds+set}" = set; then : + else + gcc_cv_as_ix86_filds=no + if test x$gcc_cv_as != x; then +- $as_echo 'filds mem; fists mem' > conftest.s ++ $as_echo 'filds (%ebp); fists (%ebp)' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 +@@ -24915,7 +24915,7 @@ if test "${gcc_cv_as_ix86_fildq+set}" = set; then : + else + gcc_cv_as_ix86_fildq=no + if test x$gcc_cv_as != x; then +- $as_echo 'fildq mem; fistpq mem' > conftest.s ++ $as_echo 'fildq (%ebp); fistpq (%ebp)' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 +diff --git a/gcc/configure.ac b/gcc/configure.ac +index 68b0ee8..bd53978 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -3869,13 +3869,13 @@ foo: nop + + gcc_GAS_CHECK_FEATURE([filds and fists mnemonics], + gcc_cv_as_ix86_filds,,, +- [filds mem; fists mem],, ++ [filds (%ebp); fists (%ebp)],, + [AC_DEFINE(HAVE_AS_IX86_FILDS, 1, + [Define if your assembler uses filds and fists mnemonics.])]) + + gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics], + gcc_cv_as_ix86_fildq,,, +- [fildq mem; fistpq mem],, ++ [fildq (%ebp); fistpq (%ebp)],, + [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1, + [Define if your assembler uses fildq and fistq mnemonics.])]) + diff --git a/spack-repos/externals/packages/gcc/darwin/gcc-4.9.patch2 b/spack-repos/externals/packages/gcc/darwin/gcc-4.9.patch2 new file mode 100755 index 000000000..b065997f4 --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/gcc-4.9.patch2 @@ -0,0 +1,28 @@ +From 82f81877458ea372176eabb5de36329431dce99b Mon Sep 17 00:00:00 2001 +From: Iain Sandoe +Date: Sat, 21 Dec 2013 00:30:18 +0000 +Subject: [PATCH] don't try to mark local symbols as no-dead-strip + +--- + gcc/config/darwin.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c +index 40804b8..0080299 100644 +--- a/gcc/config/darwin.c ++++ b/gcc/config/darwin.c +@@ -1259,6 +1259,11 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED) + void + darwin_mark_decl_preserved (const char *name) + { ++ /* Actually we shouldn't mark any local symbol this way, but for now ++ this only happens with ObjC meta-data. */ ++ if (darwin_label_is_anonymous_local_objc_name (name)) ++ return; ++ + fprintf (asm_out_file, "\t.no_dead_strip "); + assemble_name (asm_out_file, name); + fputc ('\n', asm_out_file); +-- +2.2.1 + diff --git a/spack-repos/externals/packages/gcc/darwin/gcc-6.1.0-jit.patch b/spack-repos/externals/packages/gcc/darwin/gcc-6.1.0-jit.patch new file mode 100755 index 000000000..8cc4405de --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/gcc-6.1.0-jit.patch @@ -0,0 +1,21 @@ +# Fix for libgccjit.so linkage on Darwin +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089 +# https://github.com/Homebrew/homebrew-core/issues/1872#issuecomment-225625332 +# https://github.com/Homebrew/homebrew-core/issues/1872#issuecomment-225626490 + +# Stolen from Homebrew: +# https://raw.githubusercontent.com/Homebrew/formula-patches/e9e0ee09389a54cc4c8fe1c24ebca3cd765ed0ba/gcc/6.1.0-jit.patch +diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in +index 44d0750..4df2a9c 100644 +--- a/gcc/jit/Make-lang.in ++++ b/gcc/jit/Make-lang.in +@@ -85,8 +85,7 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \ + $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \ + $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \ + $(EXTRA_GCC_OBJS) \ +- -Wl,--version-script=$(srcdir)/jit/libgccjit.map \ +- -Wl,-soname,$(LIBGCCJIT_SONAME) ++ -Wl,-install_name,$(LIBGCCJIT_SONAME) + + $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME) + ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK) diff --git a/spack-repos/externals/packages/gcc/darwin/gcc-7.1.0-headerpad.patch b/spack-repos/externals/packages/gcc/darwin/gcc-7.1.0-headerpad.patch new file mode 100755 index 000000000..11ca2d0e4 --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/gcc-7.1.0-headerpad.patch @@ -0,0 +1,19 @@ +# Use -headerpad_max_install_names in the build, +# otherwise lto1 load commands cannot be edited on El Capitan + +# Stolen from Homebrew: +# https://raw.githubusercontent.com/Homebrew/formula-patches/32cf103/gcc/7.1.0-headerpad.patch + +diff --git a/config/mh-darwin b/config/mh-darwin +index 148b730..c2318b5 100644 +--- a/config/mh-darwin ++++ b/config/mh-darwin +@@ -16,7 +16,7 @@ DARWIN_GCC_MDYNAMIC_NO_PIC := \ + DARWIN_NO_PIE := `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;` + + BOOT_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC) +-BOOT_LDFLAGS += $(DARWIN_NO_PIE) ++BOOT_LDFLAGS += $(DARWIN_NO_PIE) -Wl,-headerpad_max_install_names + + # Similarly, for cross-compilation. + STAGE1_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC) diff --git a/spack-repos/externals/packages/gcc/darwin/headers-10.13-fix.patch b/spack-repos/externals/packages/gcc/darwin/headers-10.13-fix.patch new file mode 100755 index 000000000..3dbfde025 --- /dev/null +++ b/spack-repos/externals/packages/gcc/darwin/headers-10.13-fix.patch @@ -0,0 +1,127 @@ +diff -pur fixincludes/fixincl.x gcc-5.5.0/fixincludes/fixincl.x +--- a/fixincludes/fixincl.x 2017-01-30 17:08:42.000000000 +0100 ++++ b/fixincludes/fixincl.x 2017-12-21 14:34:35.000000000 +0100 +@@ -1,12 +1,12 @@ + /* -*- buffer-read-only: t -*- vi: set ro: +- * ++ * + * DO NOT EDIT THIS FILE (fixincl.x) +- * +- * It has been AutoGen-ed January 5, 2017 at 06:05:06 PM by AutoGen 5.16.2 ++ * ++ * It has been AutoGen-ed December 21, 2017 at 02:34:35 PM by AutoGen 5.18.7 + * From the definitions inclhack.def + * and the template file fixincl + */ +-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan 5 18:05:06 CET 2017 ++/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Dec 21 14:34:35 CET 2017 + * + * You must regenerate it. Use the ./genfixes script. + * +@@ -15,7 +15,7 @@ + * certain ANSI-incompatible system header files which are fixed to work + * correctly with ANSI C and placed in a directory that GNU C will search. + * +- * This file contains 240 fixup descriptions. ++ * This file contains 241 fixup descriptions. + * + * See README for more information. + * +@@ -2579,6 +2579,43 @@ extern \"C\" {\n\ + + /* * * * * * * * * * * * * * * * * * * * * * * * * * + * ++ * Description of Darwin_Osavailability fix ++ */ ++tSCC zDarwin_OsavailabilityName[] = ++ "darwin_osavailability"; ++ ++/* ++ * File name selection pattern ++ */ ++tSCC zDarwin_OsavailabilityList[] = ++ "os/availability.h\0"; ++/* ++ * Machine/OS name selection pattern ++ */ ++tSCC* apzDarwin_OsavailabilityMachs[] = { ++ "*-*-darwin*", ++ (const char*)NULL }; ++ ++/* ++ * content selection pattern - do fix if pattern found ++ */ ++tSCC zDarwin_OsavailabilitySelect0[] = ++ "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)"; ++ ++#define DARWIN_OSAVAILABILITY_TEST_CT 1 ++static tTestDesc aDarwin_OsavailabilityTests[] = { ++ { TT_EGREP, zDarwin_OsavailabilitySelect0, (regex_t*)NULL }, }; ++ ++/* ++ * Fix Command Arguments for Darwin_Osavailability ++ */ ++static const char* apzDarwin_OsavailabilityPatch[] = { ++ "format", ++ "#define %1(...)", ++ (char*)NULL }; ++ ++/* * * * * * * * * * * * * * * * * * * * * * * * * * ++ * + * Description of Darwin_9_Long_Double_Funcs_2 fix + */ + tSCC zDarwin_9_Long_Double_Funcs_2Name[] = +@@ -9818,9 +9855,9 @@ static const char* apzX11_SprintfPatch[] + * + * List of all fixes + */ +-#define REGEX_COUNT 276 ++#define REGEX_COUNT 277 + #define MACH_LIST_SIZE_LIMIT 187 +-#define FIX_COUNT 240 ++#define FIX_COUNT 241 + + /* + * Enumerate the fixes +@@ -9885,6 +9922,7 @@ typedef enum { + CTRL_QUOTES_DEF_FIXIDX, + CTRL_QUOTES_USE_FIXIDX, + CXX_UNREADY_FIXIDX, ++ DARWIN_OSAVAILABILITY_FIXIDX, + DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, + DARWIN_EXTERNC_FIXIDX, + DARWIN_GCC4_BREAKAGE_FIXIDX, +@@ -10364,6 +10402,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { + CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aCxx_UnreadyTests, apzCxx_UnreadyPatch, 0 }, + ++ { zDarwin_OsavailabilityName, zDarwin_OsavailabilityList, ++ apzDarwin_OsavailabilityMachs, ++ DARWIN_OSAVAILABILITY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, ++ aDarwin_OsavailabilityTests, apzDarwin_OsavailabilityPatch, 0 }, ++ + { zDarwin_9_Long_Double_Funcs_2Name, zDarwin_9_Long_Double_Funcs_2List, + apzDarwin_9_Long_Double_Funcs_2Machs, + DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, +diff -pur fixincludes/inclhack.def gcc-5.5.0/fixincludes/inclhack.def +--- a/fixincludes/inclhack.def 2017-01-30 17:08:42.000000000 +0100 ++++ b/fixincludes/inclhack.def 2017-12-21 14:34:28.000000000 +0100 +@@ -1337,6 +1337,18 @@ fix = { + test_text = "extern void* malloc( size_t );"; + }; + ++fix = { ++ hackname = darwin_osavailability; ++ mach = "*-*-darwin*"; ++ files = os/availability.h; ++ select = "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)"; ++ c_fix = format; ++ c_fix_arg = "#define %1(...)"; ++ ++ test_text = "#define __API_AVAILABLE(...)\n" ++ "#define API_AVAILABLE(...)\n"; ++}; ++ + /* + * For the AAB_darwin7_9_long_double_funcs fix to be useful, + * you have to not use "" includes. diff --git a/spack-repos/externals/packages/gcc/detection_test.yaml b/spack-repos/externals/packages/gcc/detection_test.yaml new file mode 100755 index 000000000..7269c0301 --- /dev/null +++ b/spack-repos/externals/packages/gcc/detection_test.yaml @@ -0,0 +1,96 @@ +paths: +# Ubuntu 20.04, system compilers without Fortran. This +# test also covers which flags are expected to be used +# during the detection of gcc. +- layout: + - executables: + - "bin/gcc" + - "bin/g++" + script: | + if [ "$1" = "-dumpversion" ] ; then + echo "9" + elif [ "$1" = "-dumpfullversion" ] ; then + echo "9.4.0" + elif [ "$1" = "--version" ] ; then + echo "gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0" + echo "Copyright (C) 2019 Free Software Foundation, Inc." + echo "This is free software; see the source for copying conditions. There is NO" + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + else + echo "mock executable got an unexpected flag: $1" + exit 1 + fi + platforms: ["darwin", "linux"] + results: + - spec: "gcc@9.4.0 languages=c,c++" + extra_attributes: + compilers: + c: ".*/bin/gcc" + cxx: ".*/bin/g++" + +# Mock a version < 7 of GCC that requires -dumpversion and +# errors with -dumpfullversion +- layout: + - executables: + - "bin/gcc-5" + - "bin/g++-5" + - "bin/gfortran-5" + script: | + if [ "$1" = "-dumpversion" ] ; then + echo "5.5.0" + else + echo "gcc-5: fatal error: no input files" + echo "compilation terminated." + exit 1 + fi + platforms: ["darwin", "linux"] + results: + - spec: "gcc@5.5.0 languages=c,c++,fortran" + extra_attributes: + compilers: + c: ".*/bin/gcc-5$" + cxx: ".*/bin/g[+][+]-5$" + fortran: ".*/bin/gfortran-5$" + +# Multiple compilers present at the same time +- layout: + - executables: + - "bin/x86_64-linux-gnu-gcc-6" + script: 'echo 6.5.0' + - executables: + - "bin/x86_64-linux-gnu-gcc-10" + - "bin/x86_64-linux-gnu-g++-10" + script: "echo 10.1.0" + platforms: [darwin, linux] + results: + - spec: "gcc@6.5.0 languages=c" + extra_attributes: + compilers: + c: ".*/bin/x86_64-linux-gnu-gcc-6$" + - spec: "gcc@10.1.0 languages=c,c++" + extra_attributes: + compilers: + c: ".*/bin/x86_64-linux-gnu-gcc-10$" + cxx: ".*/bin/x86_64-linux-gnu-g[+][+]-10$" + +# Apple clang under disguise as gcc should not be detected +- layout: + - executables: + - "bin/gcc" + script: | + if [ "$1" = "-dumpversion" ] ; then + echo "15.0.0" + elif [ "$1" = "-dumpfullversion" ] ; then + echo "clang: error: no input files" >&2 + exit 1 + elif [ "$1" = "--version" ] ; then + echo "Apple clang version 15.0.0 (clang-1500.3.9.4)" + echo "Target: x86_64-apple-darwin23.4.0" + echo "Thread model: posix" + echo "InstalledDir: /Library/Developer/CommandLineTools/usr/bin" + else + echo "mock executable got an unexpected flag: $1" + exit 1 + fi + platforms: ["darwin"] + results: [] diff --git a/spack-repos/externals/packages/gcc/gcc-backport.patch b/spack-repos/externals/packages/gcc/gcc-backport.patch new file mode 100755 index 000000000..f9fab68f2 --- /dev/null +++ b/spack-repos/externals/packages/gcc/gcc-backport.patch @@ -0,0 +1,138 @@ +2016-02-20 Bernd Edlinger + + Backported from mainline + 2016-02-19 Jakub Jelinek + Bernd Edlinger + + * Make-lang.in: Invoke gperf with -L C++. + * cfns.gperf: Remove prototypes for hash and libc_name_p + inlines. + * cfns.h: Regenerated. + * except.c (nothrow_libfn_p): Adjust. + +Index: gcc/cp/Make-lang.in +=================================================================== +--- a/gcc/cp/Make-lang.in (revision 233574) ++++ b/gcc/cp/Make-lang.in (working copy) +@@ -111,7 +111,7 @@ else + # deleting the $(srcdir)/cp/cfns.h file. + $(srcdir)/cp/cfns.h: + endif +- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \ ++ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \ + $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h + + # +Index: gcc/cp/cfns.gperf +=================================================================== +--- a/gcc/cp/cfns.gperf (revision 233574) ++++ b/gcc/cp/cfns.gperf (working copy) +@@ -1,3 +1,5 @@ ++%language=C++ ++%define class-name libc_name + %{ + /* Copyright (C) 2000-2015 Free Software Foundation, Inc. + +@@ -16,14 +18,6 @@ for more details. + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ +-#ifdef __GNUC__ +-__inline +-#endif +-static unsigned int hash (const char *, unsigned int); +-#ifdef __GNUC__ +-__inline +-#endif +-const char * libc_name_p (const char *, unsigned int); + %} + %% + # The standard C library functions, for feeding to gperf; the result is used +Index: gcc/cp/cfns.h +=================================================================== +--- a/gcc/cp/cfns.h (revision 233574) ++++ b/gcc/cp/cfns.h (working copy) +@@ -1,5 +1,5 @@ +-/* ANSI-C code produced by gperf version 3.0.3 */ +-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */ ++/* C++ code produced by gperf version 3.0.4 */ ++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */ + + #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ +@@ -28,7 +28,7 @@ + #error "gperf generated tables don't work with this execution character set. Please report a bug to ." + #endif + +-#line 1 "cfns.gperf" ++#line 3 "cfns.gperf" + + /* Copyright (C) 2000-2015 Free Software Foundation, Inc. + +@@ -47,26 +47,19 @@ for more details. + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ +-#ifdef __GNUC__ +-__inline +-#endif +-static unsigned int hash (const char *, unsigned int); +-#ifdef __GNUC__ +-__inline +-#endif +-const char * libc_name_p (const char *, unsigned int); + /* maximum key range = 391, duplicates = 0 */ + +-#ifdef __GNUC__ +-__inline +-#else +-#ifdef __cplusplus +-inline +-#endif +-#endif +-static unsigned int +-hash (register const char *str, register unsigned int len) ++class libc_name + { ++private: ++ static inline unsigned int hash (const char *str, unsigned int len); ++public: ++ static const char *libc_name_p (const char *str, unsigned int len); ++}; ++ ++inline unsigned int ++libc_name::hash (register const char *str, register unsigned int len) ++{ + static const unsigned short asso_values[] = + { + 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, +@@ -122,14 +115,8 @@ along with GCC; see the file COPYING3. If not see + return hval + asso_values[(unsigned char)str[len - 1]]; + } + +-#ifdef __GNUC__ +-__inline +-#ifdef __GNUC_STDC_INLINE__ +-__attribute__ ((__gnu_inline__)) +-#endif +-#endif + const char * +-libc_name_p (register const char *str, register unsigned int len) ++libc_name::libc_name_p (register const char *str, register unsigned int len) + { + enum + { +Index: gcc/cp/except.c +=================================================================== +--- a/gcc/cp/except.c (revision 233574) ++++ b/gcc/cp/except.c (working copy) +@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn) + unless the system headers are playing rename tricks, and if + they are, we don't want to be confused by them. */ + id = DECL_NAME (fn); +- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id)); ++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id), ++ IDENTIFIER_LENGTH (id)); + } + + /* Returns nonzero if an exception of type FROM will be caught by a diff --git a/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-1-gcc-6.patch b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-1-gcc-6.patch new file mode 100755 index 000000000..4187b812d --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-1-gcc-6.patch @@ -0,0 +1,39 @@ +From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Fri, 8 Nov 2019 19:53:18 +0100 +Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm + bootstrap due to libsanitizer) + + Backported from mainline + 2019-10-22 Tamar Christina + Backported for version 5.3.0 <= gcc <= 6.5.0 + 2020-06-05 John L. Jolly + + PR sanitizer/92154 + * sanitizer_common/sanitizer_platform_limits_posix.cc: + Cherry-pick compiler-rt revision r375220. + +From-SVN: r277981 +--- + libsanitizer/ChangeLog | 9 +++++++++ + .../sanitizer_common/sanitizer_platform_limits_posix.cc | 6 +++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 6cd4a5bac8b0..06a605ff4670 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1130,8 +1130,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + #ifndef __GLIBC_PREREQ + #define __GLIBC_PREREQ(x, y) 0 + #endif +-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) ++#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \ ++ !defined(__arm__) + /* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ ++/* On Arm glibc 2.31 and later provide a different mode field, this field is ++ never used by libsanitizer so we can simply ignore this assert for all glibc ++ versions. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + diff --git a/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-1.patch b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-1.patch new file mode 100755 index 000000000..96037707d --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-1.patch @@ -0,0 +1,37 @@ +From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Fri, 8 Nov 2019 19:53:18 +0100 +Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm + bootstrap due to libsanitizer) + + Backported from mainline + 2019-10-22 Tamar Christina + + PR sanitizer/92154 + * sanitizer_common/sanitizer_platform_limits_posix.cc: + Cherry-pick compiler-rt revision r375220. + +From-SVN: r277981 +--- + libsanitizer/ChangeLog | 9 +++++++++ + .../sanitizer_common/sanitizer_platform_limits_posix.cc | 6 +++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 6cd4a5bac8b0..06a605ff4670 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1156,8 +1156,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + CHECK_SIZE_AND_OFFSET(ipc_perm, gid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); +-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) ++#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \ ++ !defined(__arm__) + /* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ ++/* On Arm glibc 2.31 and later provide a different mode field, this field is ++ never used by libsanitizer so we can simply ignore this assert for all glibc ++ versions. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + diff --git a/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2-gcc-6.patch b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2-gcc-6.patch new file mode 100755 index 000000000..755db173f --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2-gcc-6.patch @@ -0,0 +1,69 @@ +From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Fri, 20 Dec 2019 17:58:35 +0100 +Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm + bootstrap due to libsanitizer) + + Backported from mainline + 2019-11-26 Jakub Jelinek + Backported for version 5.3.0 <= gcc <= 6.5.0 + 2020-06-05 John L. Jolly + + PR sanitizer/92154 + * sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick + llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce. + * sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise. + +From-SVN: r279653 +--- + libsanitizer/ChangeLog | 10 ++++++++++ + .../sanitizer_platform_limits_posix.cc | 9 +++------ + .../sanitizer_platform_limits_posix.h | 15 +-------------- + 3 files changed, 14 insertions(+), 20 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 06a605ff4670..d823a12190c0 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1130,12 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + #ifndef __GLIBC_PREREQ + #define __GLIBC_PREREQ(x, y) 0 + #endif +-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \ +- !defined(__arm__) +-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ +-/* On Arm glibc 2.31 and later provide a different mode field, this field is +- never used by libsanitizer so we can simply ignore this assert for all glibc +- versions. */ ++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) ++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit ++ on many architectures. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index 73af92af1e8f..6a673a7c9959 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -211,20 +211,13 @@ namespace __sanitizer { + unsigned long __unused1; + unsigned long __unused2; + #elif defined(__sparc__) +-# if defined(__arch64__) + unsigned mode; +- unsigned short __pad1; +-# else +- unsigned short __pad1; +- unsigned short mode; + unsigned short __pad2; +-# endif + unsigned short __seq; + unsigned long long __unused1; + unsigned long long __unused2; + #else +- unsigned short mode; +- unsigned short __pad1; ++ unsigned int mode; + unsigned short __seq; + unsigned short __pad2; + #if defined(__x86_64__) && !defined(_LP64) diff --git a/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2-gcc-7.patch b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2-gcc-7.patch new file mode 100755 index 000000000..07cbb3fdb --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2-gcc-7.patch @@ -0,0 +1,69 @@ +From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Fri, 20 Dec 2019 17:58:35 +0100 +Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm + bootstrap due to libsanitizer) + + Backported from mainline + 2019-11-26 Jakub Jelinek + Backported for version 7.1.0 <= gcc <= 7.4.0 + 2020-06-05 John L. Jolly + + PR sanitizer/92154 + * sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick + llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce. + * sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise. + +From-SVN: r279653 +--- + libsanitizer/ChangeLog | 10 ++++++++++ + .../sanitizer_platform_limits_posix.cc | 9 +++------ + .../sanitizer_platform_limits_posix.h | 15 +-------------- + 3 files changed, 14 insertions(+), 20 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 06a605ff4670..d823a12190c0 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + CHECK_SIZE_AND_OFFSET(ipc_perm, gid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); +-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \ +- !defined(__arm__) +-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ +-/* On Arm glibc 2.31 and later provide a different mode field, this field is +- never used by libsanitizer so we can simply ignore this assert for all glibc +- versions. */ ++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) ++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit ++ on many architectures. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index 73af92af1e8f..6a673a7c9959 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -211,20 +211,13 @@ namespace __sanitizer { + unsigned long __unused1; + unsigned long __unused2; + #elif defined(__sparc__) +-# if defined(__arch64__) + unsigned mode; +- unsigned short __pad1; +-# else +- unsigned short __pad1; +- unsigned short mode; + unsigned short __pad2; +-# endif + unsigned short __seq; + unsigned long long __unused1; + unsigned long long __unused2; + #else +- unsigned short mode; +- unsigned short __pad1; ++ unsigned int mode; + unsigned short __seq; + unsigned short __pad2; + #if defined(__x86_64__) && !defined(_LP64) diff --git a/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2.patch b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2.patch new file mode 100755 index 000000000..75234436e --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-2.patch @@ -0,0 +1,73 @@ +From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Fri, 20 Dec 2019 17:58:35 +0100 +Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm + bootstrap due to libsanitizer) + + Backported from mainline + 2019-11-26 Jakub Jelinek + + PR sanitizer/92154 + * sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick + llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce. + * sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise. + +From-SVN: r279653 +--- + libsanitizer/ChangeLog | 10 ++++++++++ + .../sanitizer_platform_limits_posix.cc | 9 +++------ + .../sanitizer_platform_limits_posix.h | 15 +-------------- + 3 files changed, 14 insertions(+), 20 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 06a605ff4670..d823a12190c0 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + CHECK_SIZE_AND_OFFSET(ipc_perm, gid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); +-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \ +- !defined(__arm__) +-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ +-/* On Arm glibc 2.31 and later provide a different mode field, this field is +- never used by libsanitizer so we can simply ignore this assert for all glibc +- versions. */ ++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) ++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit ++ on many architectures. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index 73af92af1e8f..6a673a7c9959 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -211,26 +211,13 @@ namespace __sanitizer { + u64 __unused1; + u64 __unused2; + #elif defined(__sparc__) +-#if defined(__arch64__) + unsigned mode; +- unsigned short __pad1; +-#else +- unsigned short __pad1; +- unsigned short mode; + unsigned short __pad2; +-#endif + unsigned short __seq; + unsigned long long __unused1; + unsigned long long __unused2; +-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) +- unsigned int mode; +- unsigned short __seq; +- unsigned short __pad1; +- unsigned long __unused1; +- unsigned long __unused2; + #else +- unsigned short mode; +- unsigned short __pad1; ++ unsigned int mode; + unsigned short __seq; + unsigned short __pad2; + #if defined(__x86_64__) && !defined(_LP64) diff --git a/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-3-gcc-5.patch b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-3-gcc-5.patch new file mode 100755 index 000000000..e1df265aa --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.31-libsanitizer-3-gcc-5.patch @@ -0,0 +1,81 @@ +diff -ru a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2014-09-23 17:59:53.000000000 +0000 ++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2021-10-30 19:48:38.690007561 +0000 +@@ -358,15 +358,6 @@ + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE +- _(CYGETDEFTHRESH, WRITE, sizeof(int)); +- _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +- _(CYGETMON, WRITE, struct_cyclades_monitor_sz); +- _(CYGETTHRESH, WRITE, sizeof(int)); +- _(CYGETTIMEOUT, WRITE, sizeof(int)); +- _(CYSETDEFTHRESH, NONE, 0); +- _(CYSETDEFTIMEOUT, NONE, 0); +- _(CYSETTHRESH, NONE, 0); +- _(CYSETTIMEOUT, NONE, 0); + _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); + _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); + _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); +diff -ru a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2021-10-30 19:40:51.805824323 +0000 ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2021-10-30 19:51:13.640403192 +0000 +@@ -143,7 +143,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -392,7 +391,6 @@ + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); +- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); + #if EV_VERSION > (0x010000) + unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); + #else +@@ -759,15 +757,6 @@ + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; +- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; +- unsigned IOCTL_CYGETMON = CYGETMON; +- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; +- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; +- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; +- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; +- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; +- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; + unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; + unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; + unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; +diff -ru a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2021-10-30 19:40:51.698824053 +0000 ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2021-10-30 19:51:39.680469814 +0000 +@@ -875,7 +875,6 @@ + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + extern unsigned struct_ax25_parms_struct_sz; +- extern unsigned struct_cyclades_monitor_sz; + extern unsigned struct_input_keymap_entry_sz; + extern unsigned struct_ipx_config_data_sz; + extern unsigned struct_kbdiacrs_sz; +@@ -1220,15 +1219,6 @@ + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- extern unsigned IOCTL_CYGETDEFTHRESH; +- extern unsigned IOCTL_CYGETDEFTIMEOUT; +- extern unsigned IOCTL_CYGETMON; +- extern unsigned IOCTL_CYGETTHRESH; +- extern unsigned IOCTL_CYGETTIMEOUT; +- extern unsigned IOCTL_CYSETDEFTHRESH; +- extern unsigned IOCTL_CYSETDEFTIMEOUT; +- extern unsigned IOCTL_CYSETTHRESH; +- extern unsigned IOCTL_CYSETTIMEOUT; + extern unsigned IOCTL_EQL_EMANCIPATE; + extern unsigned IOCTL_EQL_ENSLAVE; + extern unsigned IOCTL_EQL_GETMASTRCFG; diff --git a/spack-repos/externals/packages/gcc/glibc-2.36-libsanitizer-gcc-10-12.patch b/spack-repos/externals/packages/gcc/glibc-2.36-libsanitizer-gcc-10-12.patch new file mode 100755 index 000000000..90df6b048 --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.36-libsanitizer-gcc-10-12.patch @@ -0,0 +1,27 @@ +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +index badf6a401cc..b43733033a6 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -72,7 +72,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -822,10 +821,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT; + unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT; + #endif +- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS; +- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION; +- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS; +- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION; ++ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long); ++ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long); ++ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long); ++ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long); + unsigned IOCTL_GIO_CMAP = GIO_CMAP; + unsigned IOCTL_GIO_FONT = GIO_FONT; + unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP; diff --git a/spack-repos/externals/packages/gcc/glibc-2.36-libsanitizer-gcc-5-9.patch b/spack-repos/externals/packages/gcc/glibc-2.36-libsanitizer-gcc-5-9.patch new file mode 100755 index 000000000..2cd2bc4e5 --- /dev/null +++ b/spack-repos/externals/packages/gcc/glibc-2.36-libsanitizer-gcc-5-9.patch @@ -0,0 +1,27 @@ +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index e8fce8a02..5122baa46 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -65,7 +65,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -846,10 +845,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT; + unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT; + #endif +- unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS; +- unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION; +- unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS; +- unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION; ++ unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long); ++ unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long); ++ unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long); ++ unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long); + unsigned IOCTL_GIO_CMAP = GIO_CMAP; + unsigned IOCTL_GIO_FONT = GIO_FONT; + unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP; diff --git a/spack-repos/externals/packages/gcc/package.py b/spack-repos/externals/packages/gcc/package.py new file mode 100755 index 000000000..cddb182d0 --- /dev/null +++ b/spack-repos/externals/packages/gcc/package.py @@ -0,0 +1,1200 @@ +# Copyright 2013-2024 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 glob +import itertools +import os +import sys + +from archspec.cpu import UnsupportedMicroarchitecture + +import llnl.util.tty as tty +from llnl.util.symlink import readlink + +import spack.platforms +import spack.util.executable +import spack.util.libc +from spack.operating_systems.mac_os import macos_sdk_path, macos_version +from spack.package import * + + +class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage): + """The GNU Compiler Collection includes front ends for C, C++, Objective-C, + Fortran, Ada, and Go, as well as libraries for these languages.""" + + homepage = "https://gcc.gnu.org" + gnu_mirror_path = "gcc/gcc-9.2.0/gcc-9.2.0.tar.xz" + git = "git://gcc.gnu.org/git/gcc.git" + list_url = "https://ftp.gnu.org/gnu/gcc/" + list_depth = 1 + keep_werror = "all" + + maintainers("michaelkuhn", "alalazo") + + license("GPL-2.0-or-later AND LGPL-2.1-or-later") + + version("master", branch="master") + + version("15.2.0", sha256="438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e") + + version("14.3.0", sha256="e0dc77297625631ac8e50fa92fffefe899a4eb702592da5c32ef04e2293aca3a") + version("14.2.0", sha256="a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9") + version("14.1.0", sha256="e283c654987afe3de9d8080bc0bd79534b5ca0d681a73a11ff2b5d3767426840") + version("13.3.0", sha256="0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083") + version("13.2.0", sha256="e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da") + version("13.1.0", sha256="61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86") + + version("12.4.0", sha256="704f652604ccbccb14bdabf3478c9511c89788b12cb3bbffded37341916a9175") + version("12.3.0", sha256="949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b") + version("12.2.0", sha256="e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff") + version("12.1.0", sha256="62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b") + + version("11.4.0", sha256="3f2db222b007e8a4a23cd5ba56726ef08e8b1f1eb2055ee72c1402cea73a8dd9") + version("11.3.0", sha256="b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39") + version("11.2.0", sha256="d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b") + version("11.1.0", sha256="4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf") + + version("10.5.0", sha256="25109543fdf46f397c347b5d8b7a2c7e5694a5a51cce4b9c6e1ea8a71ca307c1") + version("10.4.0", sha256="c9297d5bcd7cb43f3dfc2fed5389e948c9312fd962ef6a4ce455cff963ebe4f1") + version("10.3.0", sha256="64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344") + version("10.2.0", sha256="b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c") + version("10.1.0", sha256="b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2") + + version("9.5.0", sha256="27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f") + version("9.4.0", sha256="c95da32f440378d7751dd95533186f7fc05ceb4fb65eb5b85234e6299eb9838e") + version("9.3.0", sha256="71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1") + version("9.2.0", sha256="ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206") + version("9.1.0", sha256="79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0") + + version("8.5.0", sha256="d308841a511bb830a6100397b0042db24ce11f642dab6ea6ee44842e5325ed50") + version("8.4.0", sha256="e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4") + version("8.3.0", sha256="64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c") + version("8.2.0", sha256="196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080") + version("8.1.0", sha256="1d1866f992626e61349a1ccd0b8d5253816222cdc13390dcfaa74b093aa2b153") + + version("7.5.0", sha256="b81946e7f01f90528a1f7352ab08cc602b9ccc05d4e44da4bd501c5a189ee661") + version("7.4.0", sha256="eddde28d04f334aec1604456e536416549e9b1aa137fc69204e65eb0c009fe51") + version("7.3.0", sha256="832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c") + version("7.2.0", sha256="1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a") + version("7.1.0", sha256="8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17") + + version("6.5.0", sha256="7ef1796ce497e89479183702635b14bb7a46b53249209a5e0f999bebf4740945") + version("6.4.0", sha256="850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4") + version("6.3.0", sha256="f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f") + version("6.2.0", sha256="9944589fc722d3e66308c0ce5257788ebd7872982a718aa2516123940671b7c5") + version("6.1.0", sha256="09c4c85cabebb971b1de732a0219609f93fc0af5f86f6e437fd8d7f832f1a351") + + version("5.5.0", sha256="530cea139d82fe542b358961130c69cfde8b3d14556370b65823d2f91f0ced87") + version("5.4.0", sha256="608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a") + version("5.3.0", sha256="b84f5592e9218b73dbae612b5253035a7b34a9a1f7688d2e1bfaaf7267d5c4db") + version("5.2.0", sha256="5f835b04b5f7dd4f4d2dc96190ec1621b8d89f2dc6f638f9f8bc1b1014ba8cad") + version("5.1.0", sha256="b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89dca5ad") + + version("4.9.4", sha256="6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092") + version("4.9.3", sha256="2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e") + version("4.9.2", sha256="2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd") + version("4.9.1", sha256="d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e") + version("4.8.5", sha256="22fb1e7e0f68a63cee631d85b20461d1ea6bda162f03096350e38c8d427ecf23") + version("4.8.4", sha256="4a80aa23798b8e9b5793494b8c976b39b8d9aa2e53cd5ed5534aff662a7f8695") + version("4.7.4", sha256="92e61c6dc3a0a449e62d72a38185fda550168a86702dea07125ebd3ec3996282") + version("4.6.4", sha256="35af16afa0b67af9b8eb15cafb76d2bc5f568540552522f5dc2c88dd45d977e8") + version("4.5.4", sha256="eef3f0456db8c3d992cbb51d5d32558190bc14f3bc19383dd93acc27acc6befc") + + # We specifically do not add 'all' variant here because: + # (i) Ada, D, Go, Jit, and Objective-C++ are not default languages. + # In that respect, the name 'all' is rather misleading. + # (ii) Languages other than c,c++,fortran are prone to configure bug in GCC + # For example, 'java' appears to ignore custom location of zlib + # (iii) meaning of 'all' changes with GCC version, i.e. 'java' is not part + # of gcc7. Correctly specifying conflicts() and depends_on() in such a + # case is a PITA. + # + # Also note that some languages get enabled by the configure scripts even if not listed in the + # arguments. For example, c++ is enabled when the bootstrapping is enabled and lto is enabled + # when the link time optimization support is enabled. + variant( + "languages", + default="c,c++,fortran", + values=( + "ada", + "brig", + "c", + "c++", + "d", + "fortran", + "go", + "java", + "jit", + "lto", + "objc", + "obj-c++", + ), + multi=True, + description="Compilers and runtime libraries to build", + ) + variant("binutils", default=False, description="Build via binutils") + variant( + "piclibs", default=False, description="Build PIC versions of libgfortran.a and libstdc++.a" + ) + variant("strip", default=False, description="Strip executables to reduce installation size") + variant("nvptx", default=False, description="Target nvptx offloading to NVIDIA GPUs") + variant("bootstrap", default=True, description="Enable 3-stage bootstrap") + variant( + "graphite", default=False, description="Enable Graphite loop optimizations (requires ISL)" + ) + variant( + "build_type", + default="RelWithDebInfo", + values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"), + description="CMake-like build type. " + "Debug: -O0 -g; Release: -O3; " + "RelWithDebInfo: -O2 -g; MinSizeRel: -Os", + ) + variant( + "profiled", + default=False, + description="Use Profile Guided Optimization", + when="+bootstrap %gcc", + ) + + depends_on("flex", type="build", when="@master") + + # https://gcc.gnu.org/install/prerequisites.html + depends_on("gmp@4.3.2:") + # mawk is not sufficient for go support + depends_on("gawk@3.1.5:", type="build") + depends_on("texinfo@4.7:", type="build") + depends_on("libtool", type="build") + # dependencies required for git versions + depends_on("m4@1.4.6:", when="@master", type="build") + depends_on("automake@1.15.1:", when="@master", type="build") + depends_on("autoconf@2.69:", when="@master", type="build") + + depends_on("gmake@3.80:", type="build") + depends_on("perl@5", type="build") + + # GCC 7.3 does not compile with newer releases on some platforms, see + # https://github.com/spack/spack/issues/6902#issuecomment-433030376 + depends_on("mpfr@2.4.2:3.1.6", when="@:9.9") + depends_on("mpfr@3.1.0:", when="@10:") + depends_on("mpc@1.0.1:", when="@4.5:") + # Already released GCC versions do not support any newer version of ISL + # GCC 5.4 https://github.com/spack/spack/issues/6902#issuecomment-433072097 + # GCC 7.3 https://github.com/spack/spack/issues/6902#issuecomment-433030376 + # GCC 9+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 + with when("+graphite"): + depends_on("isl@0.14", when="@5.0:5.2") + depends_on("isl@0.15", when="@5.3:5.9") + depends_on("isl@0.15:0.18", when="@6:8.9") + depends_on("isl@0.15:0.20", when="@9:9.9") + depends_on("isl@0.15:", when="@10:") + + depends_on("zlib-api", when="@6:") + depends_on("zstd", when="@10:") + depends_on("diffutils", type="build") + depends_on("iconv", when="platform=darwin") + depends_on("gnat", when="languages=ada") + depends_on( + "binutils+gas+ld+plugins~libiberty", when="+binutils", type=("build", "link", "run") + ) + depends_on("zip", type="build", when="languages=java") + + # The server is sometimes a bit slow to respond + timeout = {"timeout": 60} + + # TODO: integrate these libraries. + # depends_on('ppl') + # depends_on('cloog') + + # https://gcc.gnu.org/install/test.html + depends_on("dejagnu@1.4.4", type="test") + depends_on("expect", type="test") + depends_on("tcl", type="test") + depends_on("autogen@5.5.4:", type="test") + depends_on("guile@1.4.1:", type="test") + + # See https://go.dev/doc/install/gccgo#Releases + with when("languages=go"): + provides("go-or-gccgo-bootstrap@:1.0", when="@4.7.1:") + provides("go-or-gccgo-bootstrap@:1.2", when="@4.9:") + provides("go-or-gccgo-bootstrap@:1.4", when="@5:") + provides("go-or-gccgo-bootstrap@:1.6.1", when="@6:") + provides("go-or-gccgo-bootstrap@:1.8.1", when="@7:") + provides("go-or-gccgo-bootstrap@:1.10.1", when="@8:") + provides("go-or-gccgo-bootstrap@:1.12.2", when="@9:") + provides("go-or-gccgo-bootstrap@:1.14.6", when="@10:") + provides("go-or-gccgo-bootstrap@1.16.3:1.16.5", when="@11:") + + provides("golang@:1.0", when="@4.7.1:") + provides("golang@:1.2", when="@4.9:") + provides("golang@:1.4", when="@5:") + provides("golang@:1.6.1", when="@6:") + provides("golang@:1.8.1", when="@7:") + provides("golang@:1.10.1", when="@8:") + provides("golang@:1.12.2", when="@9:") + provides("golang@:1.14.6", when="@10:") + provides("golang@1.16.3:1.16.5", when="@11:") + + # GCC 4.7.1 added full support for the Go 1.x programming language. + conflicts("@:4.7.0") + + # Go is not supported on macOS + conflicts("platform=darwin", msg="GCC cannot build Go support on MacOS") + + # For a list of valid languages for a specific release, + # run the following command in the GCC source directory: + # $ grep ^language= gcc/*/config-lang.in + # See https://gcc.gnu.org/install/configure.html + + # Support for processing BRIG 1.0 files was added in GCC 7 + # BRIG is a binary format for HSAIL: + # (Heterogeneous System Architecture Intermediate Language). + # See https://gcc.gnu.org/gcc-7/changes.html + conflicts("languages=brig", when="@:6") + + # BRIG does not seem to be supported on macOS + conflicts("languages=brig", when="platform=darwin") + + # GCC 4.8 added a 'c' language. I'm sure C was always built, + # but this is the first version that accepts 'c' as a valid language. + conflicts("languages=c", when="@:4.7") + + # The GCC Java frontend and associated libjava runtime library + # have been removed from GCC as of GCC 7. + # See https://gcc.gnu.org/gcc-7/changes.html + conflicts("languages=java", when="@7:") + + # GCC 5 added the ability to build GCC as a Just-In-Time compiler. + # See https://gcc.gnu.org/gcc-5/changes.html + conflicts("languages=jit", when="@:4") + + with when("languages=d"): + # The very first version of GDC that became part of GCC already supported version 2.076 of + # the language and runtime. + # See https://wiki.dlang.org/GDC#Status + provides("D@2") + + # Support for the D programming language has been added to GCC 9. + # See https://gcc.gnu.org/gcc-9/changes.html#d + conflicts("@:8", msg="support for D has been added in GCC 9.1") + + # Versions of GDC prior to 12 can be built with an ISO C++11 compiler. Starting version 12, + # the D frontend requires a working GDC. Moreover, it is strongly recommended to use an + # older version of GDC to build GDC. + # See https://gcc.gnu.org/install/prerequisites.html#GDC-prerequisite + with when("@12:"): + # All versions starting 12 have to be built GCC: + requires("%gcc") + + # And it has to be GCC older than the version we build: + vv = ["11", "12.1.0", "12.2.0"] + for prev_v, curr_v in zip(vv, vv[1:]): + conflicts( + "%gcc@{0}:".format(curr_v), + when="@{0}".format(curr_v), + msg="'gcc@{0} languages=d' requires '%gcc@:{1}' " + "with the D language support".format(curr_v, prev_v), + ) + + # In principle, it is possible to have GDC even with GCC 5. + # See https://github.com/D-Programming-GDC/gdc + # We, however, require at least the oldest version that officially supports GDC. It is + # also a good opportunity to tell the users that they need a working GDC: + conflicts( + "%gcc@:8", + msg="'gcc@12: languages=d' requires '%gcc@9:' with the D language support", + ) + + with when("+nvptx"): + depends_on("cuda") + resource( + name="newlib", + url="ftp://sourceware.org/pub/newlib/newlib-3.0.0.20180831.tar.gz", + sha256="3ad3664f227357df15ff34e954bfd9f501009a647667cd307bf0658aefd6eb5b", + destination="newlibsource", + fetch_options=timeout, + ) + + nvptx_tools_ver = "2023-09-13" + depends_on("nvptx-tools@" + nvptx_tools_ver, type="build") + + # NVPTX offloading supported in 7 and later by limited languages + conflicts("@:6", msg="NVPTX only supported in gcc 7 and above") + conflicts("languages=ada") + conflicts("languages=brig") + conflicts("languages=go") + conflicts("languages=java") + conflicts("languages=jit") + conflicts("languages=objc") + conflicts("languages=obj-c++") + conflicts("languages=d") + # NVPTX build disables bootstrap + conflicts("+bootstrap") + + # Binutils can't build ld on macOS + conflicts("+binutils", when="platform=darwin") + + # Bootstrap comparison failure: + # see https://github.com/spack/spack/issues/23296 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100340 + # on XCode 12.5 + conflicts("+bootstrap", when="@:11.1 %apple-clang@12.0.5") + + # aarch64/M1 is supported in GCC 11.3-12.2 and 13 + requires( + "@11.3,12.2,13.1:", + when="target=aarch64: platform=darwin", + msg="Only GCC 11.3-12.2, 13.1+ support macOS M1 (aarch64)", + ) + + # Newer binutils than RHEL's is required to run `as` on some instructions + # generated by new GCC (see https://github.com/spack/spack/issues/12235) + conflicts("~binutils", when="@7: os=rhel6", msg="New GCC cannot use system assembler on RHEL6") + # Ditto for RHEL7/8: OpenBLAS uses flags which the RHEL system-binutils don't have: + # https://github.com/xianyi/OpenBLAS/issues/3805#issuecomment-1319878852 + conflicts( + "~binutils", when="@10: os=rhel7", msg="gcc: Add +binutils - preinstalled as might be old" + ) + conflicts( + "~binutils", when="@10: os=rhel8", msg="gcc: Add +binutils - preinstalled as might be old" + ) + + # GCC 11 requires GCC 4.8 or later (https://gcc.gnu.org/gcc-11/changes.html) + conflicts("%gcc@:4.7", when="@11:") + + # https://github.com/iains/gcc-12-branch/issues/6 + conflicts("@:12", when="%apple-clang@14:14.0") + + if sys.platform == "darwin": + # Fix parallel build on APFS filesystem + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797 + if macos_version() >= Version("10.13"): + patch("darwin/apfs.patch", when="@5.5.0,6.1:6.4,7.1:7.3") + # from homebrew via macports + # https://trac.macports.org/ticket/56502#no1 + # see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83531 + patch("darwin/headers-10.13-fix.patch", when="@5.5.0") + if macos_version() >= Version("10.14"): + # Fix system headers for Mojave SDK: + # https://github.com/Homebrew/homebrew-core/pull/39041 + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/b8b8e65e/gcc/8.3.0-xcode-bug-_Atomic-fix.patch", + sha256="33ee92bf678586357ee8ab9d2faddf807e671ad37b97afdd102d5d153d03ca84", + when="@6:8.3", + ) + if macos_version() >= Version("10.15"): + # Fix system headers for Catalina SDK + # (otherwise __OSX_AVAILABLE_STARTING ends up undefined) + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/b8b8e65e/gcc/9.2.0-catalina.patch", + sha256="0b8d14a7f3c6a2f0d2498526e86e088926671b5da50a554ffa6b7f73ac4f132b", + when="@9.2.0", + ) + + # See https://raw.githubusercontent.com/Homebrew/homebrew-core/3b7db4457ac64a31e3bbffc54b04c4bd824a4a4a/Formula/gcc.rb + patch( + "https://github.com/iains/gcc-darwin-arm64/commit/20f61faaed3b335d792e38892d826054d2ac9f15.patch?full_index=1", + sha256="c0605179a856ca046d093c13cea4d2e024809ec2ad4bf3708543fc3d2e60504b", + when="@11.2.0", + ) + + # Apple M1 support, created from branch of Darwin maintainer for GCC: + # https://github.com/iains/gcc-11-branch + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/22dec3fc/gcc/gcc-11.3.0-arm.diff", + sha256="e02006b7ec917cc1390645d95735a6a866caed0dfe506d5bef742f7862cab218", + when="@11.3.0 target=aarch64:", + ) + # https://github.com/iains/gcc-12-branch + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/76677f2b/gcc/gcc-12.1.0-arm.diff", + sha256="a000f1d9cb1dd98c7c4ef00df31435cd5d712d2f9d037ddc044f8bf82a16cf35", + when="@12.1.0 target=aarch64:", + ) + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff", + sha256="a7843b5c6bf1401e40c20c72af69c8f6fc9754ae980bb4a5f0540220b3dcb62d", + when="@12.2.0 target=aarch64:", + ) + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/5c206c47/gcc/gcc-13.1.0.diff", + sha256="cb4e8a89387f748a744da0273025d0dc2e3c76780cc390b18ada704676afea11", + when="@13.1.0 target=aarch64:", + ) + patch( + "https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff", + sha256="2df7ef067871a30b2531a2013b3db661ec9e61037341977bfc451e30bf2c1035", + when="@13.2.0 target=aarch64:", + ) + conflicts("+bootstrap", when="@11.3.0,13.1: target=aarch64:") + + # Use -headerpad_max_install_names in the build, + # otherwise updated load commands won't fit in the Mach-O header. + # This is needed because `gcc` avoids the superenv shim. + patch("darwin/gcc-7.1.0-headerpad.patch", when="@5:11.2") + patch("darwin/gcc-6.1.0-jit.patch", when="@5:7") + patch("darwin/gcc-4.9.patch1", when="@4.9.0:4.9.3") + patch("darwin/gcc-4.9.patch2", when="@4.9.0:4.9.3") + + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92061 + patch("darwin/clang13.patch", when="@:11.1 %apple-clang@13") + + patch("piclibs.patch", when="+piclibs") + patch("gcc-backport.patch", when="@4.7:4.9.3,5:5.3") + + # Backport libsanitizer patch for glibc >= 2.31 and 5.3.0 <= gcc <= 9.2.0 + # https://bugs.gentoo.org/708346 + patch("glibc-2.31-libsanitizer-1.patch", when="@7.1.0:7.5.0,8.1.0:8.3.0,9.0.0:9.2.0") + patch("glibc-2.31-libsanitizer-1-gcc-6.patch", when="@5.3.0:5.5.0,6.1.0:6.5.0") + patch("glibc-2.31-libsanitizer-2.patch", when="@8.1.0:8.3.0,9.0.0:9.2.0") + patch("glibc-2.31-libsanitizer-2-gcc-6.patch", when="@5.3.0:5.5.0,6.1.0:6.5.0") + patch("glibc-2.31-libsanitizer-2-gcc-7.patch", when="@7.1.0:7.5.0") + patch( + "patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch", + when="@6.5.0,7.4.0:7.5.0,8.2.0:9.3.0", + ) + patch("patch-745dae5923aba02982563481d75a21595df22ff8.patch", when="@10.1.0:10.3.0,11.1.0") + + # Backport libsanitizer patch for glibc >= 2.36 + # https://reviews.llvm.org/D129471 + patch("glibc-2.36-libsanitizer-gcc-5-9.patch", when="@5:9") + patch("glibc-2.36-libsanitizer-gcc-10-12.patch", when="@10:10.4,11:11.3,12.1.0") + + # Older versions do not compile with newer versions of glibc + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712 + patch("ucontext_t.patch", when="@4.9,5.1:5.4,6.1:6.4,7.1") + patch("ucontext_t-java.patch", when="@4.9,5.1:5.4,6.1:6.4 languages=java") + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066 + patch("stack_t-4.9.patch", when="@4.9") + patch("stack_t.patch", when="@5.1:5.4,6.1:6.4,7.1") + # https://bugs.busybox.net/show_bug.cgi?id=10061 + patch("signal.patch", when="@4.9,5.1:5.4") + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85835 + patch("sys_ustat.h.patch", when="@5.0:6.4,7.0:7.3,8.1") + patch("sys_ustat-4.9.patch", when="@4.9") + + # this patch removes cylades support from gcc-5 and allows gcc-5 to be built + # with newer glibc versions. + patch("glibc-2.31-libsanitizer-3-gcc-5.patch", when="@5.3.0:5.5.0") + + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005 + patch("zstd.patch", when="@10") + + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100102 + patch("patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch", when="@10.1:10.3") + patch("patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch", when="@11.1") + + # libstdc++: Fix inconsistent noexcept-specific for valarray begin/end + patch( + "https://github.com/gcc-mirror/gcc/commit/423cd47cfc9640ba3d6811b780e8a0b94b704dcb.patch?full_index=1", + sha256="0d136226eb07bc43f1b15284f48bd252e3748a0426b5d7ac9084ebc406e15490", + when="@9.5.0:10.4.0,11.1.0:11.2.0", + ) + + # patch ICE on aarch64 in tree-vect-slp, cf: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111478 + # patch taken from releases/gcc-12 branch + patch( + "https://github.com/gcc-mirror/gcc/commit/9d033155254ac6df5f47ab32896dbf336f991589.patch?full_index=1", + sha256="8b76fe575ef095b48ac45e8b56544c331663f840ce4b63abdb61510bf3647597", + when="@12.3.0 target=aarch64:", + ) + # patch taken from releases/gcc-13 branch + patch( + "https://github.com/gcc-mirror/gcc/commit/7c67939ec384425a3d7383dfb4fb39aa7e9ad20a.patch?full_index=1", + sha256="f0826d7a9c9808af40f3434918f24ad942f1c6a6daec73f11cf52c544cf5fc01", + when="@13.2.0 target=aarch64:", + ) + + build_directory = "spack-build" + + compiler_languages = ["c", "cxx", "fortran", "d", "go"] + + @property + def supported_languages(self): + # This weirdness is because it could be called on an abstract spec + if "languages" not in self.spec.variants: + return self.compiler_languages + return [x for x in self.compiler_languages if x in self.spec.variants["languages"].value] + + c_names = ["gcc"] + cxx_names = ["g++"] + fortran_names = ["gfortran"] + d_names = ["gdc"] + go_names = ["gccgo"] + compiler_prefixes = [r"\w+-\w+-\w+-"] + compiler_suffixes = [r"-mp-\d+(?:\.\d+)?", r"-\d+(?:\.\d+)?", r"\d\d"] + compiler_version_regex = r"(? clan[g++] + ] + if any(x in basename for x in substring_to_be_filtered): + continue + # Filter out links in favor of real executables on + # all systems but Cray + host_platform = str(spack.platforms.host()) + if os.path.islink(exe) and host_platform != "cray": + continue + + result.append(exe) + + return result + + @classmethod + def determine_variants(cls, exes, version_str): + compilers = cls.determine_compiler_paths(exes=exes) + + languages = set() + translation = {"cxx": "c++"} + for lang, compiler in compilers.items(): + languages.add(translation.get(lang, lang)) + variant_str = "languages={0}".format(",".join(languages)) + return variant_str, {"compilers": compilers} + + @classmethod + def validate_detected_spec(cls, spec, extra_attributes): + # For GCC 'compilers' is a mandatory attribute + msg = 'the extra attribute "compilers" must be set for ' 'the detected spec "{0}"'.format( + spec + ) + assert "compilers" in extra_attributes, msg + + compilers = extra_attributes["compilers"] + for constraint, key in { + "languages=c": "c", + "languages=c++": "cxx", + "languages=d": "d", + "languages=fortran": "fortran", + }.items(): + if spec.satisfies(constraint): + msg = "{0} not in {1}" + assert key in compilers, msg.format(key, spec) + + @property + def cc(self): + msg = "cannot retrieve C compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("c", None) + result = None + if "languages=c" in self.spec: + result = str(self.spec.prefix.bin.gcc) + return result + + @property + def cxx(self): + msg = "cannot retrieve C++ compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("cxx", None) + result = None + if "languages=c++" in self.spec: + result = os.path.join(self.spec.prefix.bin, "g++") + return result + + @property + def fortran(self): + msg = "cannot retrieve Fortran compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("fortran", None) + result = None + if "languages=fortran" in self.spec: + result = str(self.spec.prefix.bin.gfortran) + return result + + def url_for_version(self, version): + # This function will be called when trying to fetch from url, before + # mirrors are tried. It takes care of modifying the suffix of gnu + # mirror path so that Spack will also look for the correct file in + # the mirrors + if (version < Version("6.4.0") and version != Version("5.5.0")) or version == Version( + "7.1.0" + ): + self.gnu_mirror_path = self.gnu_mirror_path.replace("xz", "bz2") + return super().url_for_version(version) + + def patch(self): + spec = self.spec + prefix = self.spec.prefix + + # Fix a standard header file for OS X Yosemite that + # is GCC incompatible by replacing non-GCC compliant macros + if "yosemite" in spec.architecture: + if os.path.isfile("/usr/include/dispatch/object.h"): + new_dispatch_dir = join_path(prefix, "include", "dispatch") + mkdirp(new_dispatch_dir) + new_header = join_path(new_dispatch_dir, "object.h") + install("/usr/include/dispatch/object.h", new_header) + filter_file( + r"typedef void \(\^dispatch_block_t\)\(void\)", + "typedef void* dispatch_block_t", + new_header, + ) + + # Use installed libz + if self.version >= Version("6"): + filter_file( + "@zlibdir@", "-L{0}".format(spec["zlib-api"].prefix.lib), "gcc/Makefile.in" + ) + filter_file( + "@zlibinc@", "-I{0}".format(spec["zlib-api"].prefix.include), "gcc/Makefile.in" + ) + + if spec.satisfies("+nvptx"): + # backport of 383400a6078d upstream to allow support of cuda@11: + filter_file( + '#define ASM_SPEC "%{misa=*:-m %*}"', + '#define ASM_SPEC "%{misa=*:-m %*; :-m sm_35}"', + "gcc/config/nvptx/nvptx.h", + string=True, + ) + filter_file( + "Target RejectNegative ToLower Joined " + "Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM30)", + "Target RejectNegative ToLower Joined " + "Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM35)", + "gcc/config/nvptx/nvptx.opt", + string=True, + ) + self.build_optimization_config() + + def get_common_target_flags(self, spec): + """Get the right (but pessimistic) architecture specific flags supported by + both host gcc and to-be-built gcc. For example: gcc@7 %gcc@12 target=znver3 + should pick -march=znver1, since that's what gcc@7 supports.""" + microarchitectures = [spec.target] + spec.target.ancestors + for uarch in microarchitectures: + try: + return uarch.optimization_flags("gcc", str(spec.version)) + except UnsupportedMicroarchitecture: + pass + # no arch specific flags in common, unlikely to happen. + return "" + + def build_optimization_config(self): + """Write a config/spack.mk file with sensible optimization flags, taking into + account bootstrapping subtleties.""" + build_type_flags = { + "Debug": "-O0 -g", + "Release": "-O3", + "RelWithDebInfo": "-O2 -g", + "MinSizeRel": "-Os", + } + + # Generic optimization flags. + flags = build_type_flags[self.spec.variants["build_type"].value] + + # Pessimistic target specific flags. For example, when building + # gcc@11 %gcc@7 on znver3, Spack will fix the target to znver1 during + # concretization, so we'll stick to that. The other way around however can + # result in compilation errors, when gcc@7 is built with gcc@11, and znver3 + # is taken as a the target, which gcc@7 doesn't support. + # Note we're not adding this for aarch64 because of + # https://github.com/spack/spack/issues/31184 + if "+bootstrap %gcc" in self.spec and self.spec.target.family != "aarch64": + flags += " " + self.get_common_target_flags(self.spec) + + if "+bootstrap" in self.spec: + variables = ["BOOT_CFLAGS", "CFLAGS_FOR_TARGET", "CXXFLAGS_FOR_TARGET"] + else: + variables = ["CFLAGS", "CXXFLAGS"] + + # Redefine a few variables without losing other defaults: + # BOOT_CFLAGS = $(filter-out -O% -g%, $(BOOT_CFLAGS)) -O3 + # This makes sure that build_type=Release is really -O3, not -O3 -g. + fmt_string = "{} := $(filter-out -O% -g%, $({})) {}\n" + with open("config/spack.mk", "w") as f: + for var in variables: + f.write(fmt_string.format(var, var, flags)) + # Improve the build time for stage 2 a bit by enabling -O1 in stage 1. + # Note: this is ignored under ~bootstrap. + f.write("STAGE1_CFLAGS += -O1\n") + + # https://gcc.gnu.org/install/configure.html + def configure_args(self): + spec = self.spec + + # Generic options to compile GCC + options = [ + # Distributor options + "--with-pkgversion=Spack GCC", + "--with-bugurl=https://github.com/spack/spack/issues", + # Xcode 10 dropped 32-bit support + "--disable-multilib", + "--enable-languages={0}".format(",".join(spec.variants["languages"].value)), + # Drop gettext dependency + "--disable-nls", + ] + + # Avoid excessive realpath/stat calls for every system header + # by making -fno-canonical-system-headers the default. + if self.version >= Version("4.8.0"): + options.append("--disable-canonical-system-headers") + + # Use installed libz + if self.version >= Version("6"): + options.append("--with-system-zlib") + + if "zstd" in spec: + options.append("--with-zstd-include={0}".format(spec["zstd"].headers.directories[0])) + options.append("--with-zstd-lib={0}".format(spec["zstd"].libs.directories[0])) + + # Enabling language "jit" requires --enable-host-shared. + if "languages=jit" in spec: + options.append("--enable-host-shared") + + # Binutils + if spec.satisfies("+binutils"): + binutils = spec["binutils"].prefix.bin + options.extend( + [ + "--with-gnu-ld", + "--with-ld=" + binutils.ld, + "--with-gnu-as", + "--with-as=" + binutils.join("as"), + ] + ) + elif spec.satisfies("%apple-clang@15:"): + # https://github.com/iains/gcc-darwin-arm64/issues/117 + # https://github.com/iains/gcc-12-branch/issues/22 + # https://github.com/iains/gcc-13-branch/issues/8 + options.append("--with-ld=/Library/Developer/CommandLineTools/usr/bin/ld-classic") + + # enable_bootstrap + if spec.satisfies("+bootstrap"): + options.extend(["--enable-bootstrap"]) + else: + options.extend(["--disable-bootstrap"]) + + # Configure include and lib directories explicitly for these + # dependencies since the short GCC option assumes that libraries + # are installed in "/lib" which might not be true on all OS + # (see #10842) + # + # More info at: https://gcc.gnu.org/install/configure.html + for dep_str in ("mpfr", "gmp", "mpc", "isl"): + if dep_str not in spec: + options.append("--without-{0}".format(dep_str)) + continue + + dep_spec = spec[dep_str] + include_dir = dep_spec.headers.directories[0] + lib_dir = dep_spec.libs.directories[0] + options.extend( + [ + "--with-{0}-include={1}".format(dep_str, include_dir), + "--with-{0}-lib={1}".format(dep_str, lib_dir), + ] + ) + + # nvptx-none offloading for host compiler + if spec.satisfies("+nvptx"): + options.extend( + [ + "--enable-offload-targets=nvptx-none", + "--with-cuda-driver-include={0}".format(spec["cuda"].prefix.include), + "--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]), + "--disable-bootstrap", + "--disable-multilib", + ] + ) + + if sys.platform == "darwin": + options.extend( + [ + "--with-native-system-header-dir=/usr/include", + "--with-sysroot={0}".format(macos_sdk_path()), + "--with-libiconv-prefix={0}".format(spec["iconv"].prefix), + ] + ) + + # enable appropriate bootstrapping flags + stage1_ldflags = str(self.rpath_args) + boot_ldflags = stage1_ldflags + " -static-libstdc++ -static-libgcc" + options.append("--with-stage1-ldflags=" + stage1_ldflags) + options.append("--with-boot-ldflags=" + boot_ldflags) + options.append("--with-build-config=spack") + + if "languages=d" in spec: + # Phobos is the standard library for the D Programming Language. The documentation says + # that on some targets, 'libphobos' is not enabled by default, but compiles and works + # if '--enable-libphobos' is used. Specifics are documented for affected targets. + # See https://gcc.gnu.org/install/prerequisites.html#GDC-prerequisite + # Unfortunately, it is unclear where exactly the aforementioned specifics are + # documented but GDC seems to be unusable without the library, therefore we enable it + # explicitly: + options.append("--enable-libphobos") + if spec.satisfies("@12:"): + options.append("GDC={0}".format(self.detect_gdc())) + + return options + + # Copy nvptx-tools into the GCC install prefix + def copy_nvptx_tools(self): + nvptx_tools_bin_path = self.spec["nvptx-tools"].prefix.bin + gcc_bin_path = self.prefix.bin + mkdirp(gcc_bin_path) + copy_list = ["as", "ld", "nm", "run", "run-single"] + for file in copy_list: + fullname = f"nvptx-none-{file}" + copy(join_path(nvptx_tools_bin_path, fullname), join_path(gcc_bin_path, fullname)) + link_list = ["ar", "ranlib"] + for file in link_list: + fullname = f"nvptx-none-{file}" + orig_target = readlink(join_path(nvptx_tools_bin_path, fullname)) + symlink(orig_target, join_path(gcc_bin_path, fullname)) + util_dir_path = join_path(self.prefix, "nvptx-none", "bin") + mkdirp(util_dir_path) + util_list = ["ar", "as", "ld", "nm", "ranlib"] + for file in util_list: + rel_target = join_path("..", "..", "bin", f"nvptx-none-{file}") + dest_link = join_path(util_dir_path, file) + symlink(rel_target, dest_link) + + # run configure/make/make(install) for the nvptx-none target + # before running the host compiler phases + @run_before("configure") + def nvptx_install(self): + spec = self.spec + prefix = self.prefix + + if not spec.satisfies("+nvptx"): + return + + # config.guess returns the host triple, e.g. "x86_64-pc-linux-gnu" + guess = Executable("./config.guess") + targetguess = guess(output=str).rstrip("\n") + + options = getattr(self, "configure_flag_args", []) + options += ["--prefix={0}".format(prefix)] + + options += [ + "--with-cuda-driver-include={0}".format(spec["cuda"].prefix.include), + "--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]), + ] + + self.copy_nvptx_tools() + + pattern = join_path(self.stage.source_path, "newlibsource", "*") + files = glob.glob(pattern) + + if files: + symlink(join_path(files[0], "newlib"), "newlib") + + # self.build_directory = 'spack-build-nvptx' + with working_dir("spack-build-nvptx", create=True): + options = [ + "--prefix={0}".format(prefix), + "--enable-languages={0}".format(",".join(spec.variants["languages"].value)), + "--with-mpfr={0}".format(spec["mpfr"].prefix), + "--with-gmp={0}".format(spec["gmp"].prefix), + "--target=nvptx-none", + "--with-build-time-tools={0}".format(join_path(prefix, "nvptx-none", "bin")), + "--enable-as-accelerator-for={0}".format(targetguess), + "--disable-sjlj-exceptions", + "--enable-newlib-io-long-long", + ] + + configure = Executable("../configure") + configure(*options) + make() + make("install") + + @property + def build_targets(self): + if "+profiled" in self.spec: + return ["profiledbootstrap"] + return [] + + @property + def install_targets(self): + if "+strip" in self.spec: + return ["install-strip"] + return ["install"] + + @property + def spec_dir(self): + # e.g. lib/gcc/x86_64-unknown-linux-gnu/4.9.2 + spec_dir = glob.glob(f"{self.prefix.lib}/gcc/*/*") + return spec_dir[0] if spec_dir else None + + @run_after("install") + def write_specs_file(self): + """(1) inject an rpath to its runtime library dir, (2) add a default programs search path + to /bin.""" + if not self.spec_dir: + tty.warn(f"Could not install specs for {self.spec.format('{name}{@version}')}.") + return + + # Find which directories have shared libraries + for dir in ["lib64", "lib"]: + libdir = join_path(self.prefix, dir) + if glob.glob(join_path(libdir, "libgcc_s.*")): + rpath_dir = libdir + break + else: + tty.warn("No dynamic libraries found in lib/lib64") + rpath_dir = None + + specs_file = join_path(self.spec_dir, "specs") + with open(specs_file, "w") as f: + # can't extend the builtins without dumping them first + f.write(self.spec["gcc"].command("-dumpspecs", output=str, error=os.devnull).strip()) + + f.write("\n\n# Generated by Spack\n\n") + + # rpath + if rpath_dir: + f.write(f"*link_libgcc:\n+ -rpath={rpath_dir}\n\n") + + # programs search path + if self.spec.satisfies("+binutils"): + f.write(f"*self_spec:\n+ -B{self.spec['binutils'].prefix.bin}\n\n") + set_install_permissions(specs_file) + tty.info(f"Wrote new spec file to {specs_file}") + + def setup_run_environment(self, env): + # Search prefix directory for possibly modified compiler names + from spack.compilers.gcc import Gcc as Compiler + + # Get the contents of the installed binary directory + bin_path = self.spec.prefix.bin + + if not os.path.isdir(bin_path): + return + + bin_contents = os.listdir(bin_path) + + # Find the first non-symlink compiler binary present for each language + for lang in ["cc", "cxx", "fc", "f77"]: + for filename, regexp in itertools.product(bin_contents, Compiler.search_regexps(lang)): + if not regexp.match(filename): + continue + + abspath = os.path.join(bin_path, filename) + + # Skip broken symlinks (https://github.com/spack/spack/issues/41327) + if not os.path.exists(abspath): + continue + + # Set the proper environment variable + env.set(lang.upper(), abspath) + # Stop searching filename/regex combos for this language + break + + def detect_gdc(self): + """Detect and return the path to GDC that belongs to the same instance of GCC that is used + by self.compiler. + + If the path cannot be detected, raise InstallError with recommendations for the users on + how to circumvent the problem. + + Should be use only if self.spec.satisfies("@12: languages=d") + """ + # Detect GCC package in the directory of the GCC compiler + # or in the $PATH if self.compiler.cc is not an absolute path: + from spack.detection import by_path + + compiler_dir = os.path.dirname(self.compiler.cc) + detected_packages = by_path( + [self.name], path_hints=([compiler_dir] if os.path.isdir(compiler_dir) else None) + ) + + # We consider only packages that satisfy the following constraint: + required_spec = Spec("languages=c,c++,d") + candidate_specs = [ + p.spec + for p in filter( + lambda p: p.spec.satisfies(required_spec), detected_packages.get(self.name, ()) + ) + ] + + if candidate_specs: + # We now need to filter specs that match the compiler version: + compiler_spec = Spec(repr(self.compiler.spec)) + + # First, try to filter specs that satisfy the compiler spec: + new_candidate_specs = list( + filter(lambda s: s.satisfies(compiler_spec), candidate_specs) + ) + + # The compiler version might be more specific than what we can detect. For example, the + # user might have "gcc@10.2.1-sys" as the compiler spec in compilers.yaml. In that + # case, we end up with an empty list of candidates. To circumvent the problem, we try + # to filter specs that are satisfied by the compiler spec: + if not new_candidate_specs: + new_candidate_specs = list( + filter(lambda s: compiler_spec.satisfies(s), candidate_specs) + ) + + candidate_specs = new_candidate_specs + + error_nl = "\n " # see SpackError.__str__() + + if not candidate_specs: + raise InstallError( + "Cannot detect GDC", + long_msg="Starting version 12, the D frontend requires a working GDC." + "{0}You can install it with Spack by running:" + "{0}{0}spack install gcc@9:11 languages=c,c++,d" + "{0}{0}Once that has finished, you will need to add it to your compilers.yaml file" + "{0}and use it to install this spec (i.e. {1} ...).".format( + error_nl, self.spec.format("{name}{@version} {variants.languages}") + ), + ) + elif len(candidate_specs) == 0: + return candidate_specs[0].extra_attributes["compilers"]["d"] + else: + # It is rather unlikely to end up here but let us try to resolve the ambiguity: + candidate_gdc = candidate_specs[0].extra_attributes["compilers"]["d"] + if all( + candidate_gdc == s.extra_attributes["compilers"]["d"] for s in candidate_specs[1:] + ): + # It does not matter which one we take if they are all the same: + return candidate_gdc + else: + raise InstallError( + "Cannot resolve ambiguity when detecting GDC that belongs to " + "%{0}".format(self.compiler.spec), + long_msg="The candidates are:{0}{0}{1}{0}".format( + error_nl, + error_nl.join( + "{0} (cc: {1})".format( + s.extra_attributes["compilers"]["d"], + s.extra_attributes["compilers"]["c"], + ) + for s in candidate_specs + ), + ), + ) + + @classmethod + def runtime_constraints(cls, *, spec, pkg): + """Callback function to inject runtime-related rules into the solver. + + Rule-injection is obtained through method calls of the ``pkg`` argument. + + Documentation for this function is temporary. When the API will be in its final state, + we'll document the behavior at https://spack.readthedocs.io/en/latest/ + + Args: + spec: spec that will inject runtime dependencies + pkg: object used to forward information to the solver + """ + pkg("*").depends_on( + "gcc-runtime", + when="%gcc", + type="link", + description="If any package uses %gcc, it depends on gcc-runtime", + ) + pkg("*").depends_on( + f"gcc-runtime@{str(spec.version)}:", + when=f"%{str(spec)}", + type="link", + description=f"If any package uses %{str(spec)}, " + f"it depends on gcc-runtime@{str(spec.version)}:", + ) + + gfortran_str = "libgfortran@5" + if spec.satisfies("gcc@:6"): + gfortran_str = "libgfortran@3" + elif spec.satisfies("gcc@7"): + gfortran_str = "libgfortran@4" + + for fortran_virtual in ("fortran-rt", gfortran_str): + pkg("*").depends_on( + fortran_virtual, + when=f"%{str(spec)}", + languages=["fortran"], + type="link", + description=f"Add a dependency on '{gfortran_str}' for nodes compiled with " + f"{str(spec)} and using the 'fortran' language", + ) + # The version of gcc-runtime is the same as the %gcc used to "compile" it + pkg("gcc-runtime").requires(f"@={str(spec.version)}", when=f"%{str(spec)}") + + def _post_buildcache_install_hook(self): + if not self.spec.satisfies("platform=linux"): + return + + # Setting up the runtime environment shouldn't be necessary here. + relocation_args = [] + gcc = self.spec["gcc"].command + specs_file = os.path.join(self.spec_dir, "specs") + dryrun = gcc("test.c", "-###", output=os.devnull, error=str).strip() + if not dryrun: + tty.warn(f"Cannot relocate {specs_file}, compiler might not be working properly") + return + dynamic_linker = spack.util.libc.parse_dynamic_linker(dryrun) + if not dynamic_linker: + tty.warn(f"Cannot relocate {specs_file}, compiler might not be working properly") + return + + libc = spack.util.libc.libc_from_dynamic_linker(dynamic_linker) + + # We search for crt1.o ourselves because `gcc -print-prile-name=crt1.o` can give a rather + # convoluted relative path from a different prefix. + startfile_prefix = spack.util.libc.startfile_prefix(libc.external_path, dynamic_linker) + + gcc_can_locate = lambda p: os.path.isabs( + gcc(f"-print-file-name={p}", output=str, error=os.devnull).strip() + ) + + if not gcc_can_locate("crt1.o"): + relocation_args.append(f"-B{startfile_prefix}") + + # libc headers may also be in a multiarch subdir. + header_dir = spack.util.libc.libc_include_dir_from_startfile_prefix( + libc.external_path, startfile_prefix + ) + if header_dir and all( + os.path.exists(os.path.join(header_dir, h)) + for h in libc.package_class.representative_headers + ): + relocation_args.append(f"-idirafter {header_dir}") + else: + tty.warn( + f"Cannot relocate {specs_file} include directories, " + f"compiler might not be working properly" + ) + + # Delete current spec files. + try: + os.unlink(specs_file) + except OSError: + pass + + # Write a new one and append flags for libc + self.write_specs_file() + + if relocation_args: + with open(specs_file, "a") as f: + f.write(f"*self_spec:\n+ {' '.join(relocation_args)}\n\n") diff --git a/spack-repos/externals/packages/gcc/patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch b/spack-repos/externals/packages/gcc/patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch new file mode 100755 index 000000000..3d76c47b3 --- /dev/null +++ b/spack-repos/externals/packages/gcc/patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch @@ -0,0 +1,121 @@ +From 2b40941d23b1570cdd90083b58fa0f66aa58c86e Mon Sep 17 00:00:00 2001 +From: Tamar Christina +Date: Fri, 21 May 2021 12:16:56 +0100 +Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer + +The Linux kernel has removed the interface to cyclades from +the latest kernel headers[1] due to them being orphaned for the +past 13 years. + +libsanitizer uses this header when compiling against glibc, but +glibcs itself doesn't seem to have any references to cyclades. + +Further more it seems that the driver is broken in the kernel and +the firmware doesn't seem to be available anymore. + +As such since this is breaking the build of libsanitizer (and so the +GCC bootstrap[2]) I propose to remove this. + +[1] https://lkml.org/lkml/2021/3/2/153 +[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379 + +libsanitizer/ChangeLog: + + PR sanitizer/100379 + * sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick + llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135. + * sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise. + * sanitizer_common/sanitizer_platform_limits_posix.h: Likewise. +--- + .../sanitizer_common_interceptors_ioctl.inc | 9 --------- + .../sanitizer_platform_limits_posix.cc | 11 ----------- + .../sanitizer_platform_limits_posix.h | 10 ---------- + 3 files changed, 30 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +index 5408ea17c59..7a9cd3f5968 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc ++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +@@ -365,15 +365,6 @@ static void ioctl_table_fill() { + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE +- _(CYGETDEFTHRESH, WRITE, sizeof(int)); +- _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +- _(CYGETMON, WRITE, struct_cyclades_monitor_sz); +- _(CYGETTHRESH, WRITE, sizeof(int)); +- _(CYGETTIMEOUT, WRITE, sizeof(int)); +- _(CYSETDEFTHRESH, NONE, 0); +- _(CYSETDEFTIMEOUT, NONE, 0); +- _(CYSETTHRESH, NONE, 0); +- _(CYSETTIMEOUT, NONE, 0); + _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); + _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); + _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index d823a12190c..e8fce8a0287 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t; + # include + #endif + #include +-#include + #include + #include + #include +@@ -466,7 +465,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); +- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); + #if EV_VERSION > (0x010000) + unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); + #else +@@ -833,15 +831,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; +- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; +- unsigned IOCTL_CYGETMON = CYGETMON; +- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; +- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; +- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; +- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; +- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; +- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; + unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; + unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; + unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index 6a673a7c995..f921bf2b5b5 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -1040,7 +1040,6 @@ struct __sanitizer_cookie_io_functions_t { + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + extern unsigned struct_ax25_parms_struct_sz; +- extern unsigned struct_cyclades_monitor_sz; + extern unsigned struct_input_keymap_entry_sz; + extern unsigned struct_ipx_config_data_sz; + extern unsigned struct_kbdiacrs_sz; +@@ -1385,15 +1384,6 @@ struct __sanitizer_cookie_io_functions_t { + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- extern unsigned IOCTL_CYGETDEFTHRESH; +- extern unsigned IOCTL_CYGETDEFTIMEOUT; +- extern unsigned IOCTL_CYGETMON; +- extern unsigned IOCTL_CYGETTHRESH; +- extern unsigned IOCTL_CYGETTIMEOUT; +- extern unsigned IOCTL_CYSETDEFTHRESH; +- extern unsigned IOCTL_CYSETDEFTIMEOUT; +- extern unsigned IOCTL_CYSETTHRESH; +- extern unsigned IOCTL_CYSETTIMEOUT; + extern unsigned IOCTL_EQL_EMANCIPATE; + extern unsigned IOCTL_EQL_ENSLAVE; + extern unsigned IOCTL_EQL_GETMASTRCFG; +-- +2.31.1 + diff --git a/spack-repos/externals/packages/gcc/patch-745dae5923aba02982563481d75a21595df22ff8.patch b/spack-repos/externals/packages/gcc/patch-745dae5923aba02982563481d75a21595df22ff8.patch new file mode 100755 index 000000000..57c51eb23 --- /dev/null +++ b/spack-repos/externals/packages/gcc/patch-745dae5923aba02982563481d75a21595df22ff8.patch @@ -0,0 +1,123 @@ +From 745dae5923aba02982563481d75a21595df22ff8 Mon Sep 17 00:00:00 2001 +From: Tamar Christina +Date: Fri, 21 May 2021 10:30:59 +0100 +Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer + +The Linux kernel has removed the interface to cyclades from +the latest kernel headers[1] due to them being orphaned for the +past 13 years. + +libsanitizer uses this header when compiling against glibc, but +glibcs itself doesn't seem to have any references to cyclades. + +Further more it seems that the driver is broken in the kernel and +the firmware doesn't seem to be available anymore. + +As such since this is breaking the build of libsanitizer (and so the +GCC bootstrap[2]) I propose to remove this. + +[1] https://lkml.org/lkml/2021/3/2/153 +[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379 + +(cherry picked from commit f7c5351552387bd43f6ca3631016d7f0dfe0f135) + +libsanitizer/ChangeLog: + + PR sanitizer/100379 + * sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick + llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135. + * sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise. + * sanitizer_common/sanitizer_platform_limits_posix.h: Likewise. +--- + .../sanitizer_common_interceptors_ioctl.inc | 9 --------- + .../sanitizer_platform_limits_posix.cpp | 11 ----------- + .../sanitizer_platform_limits_posix.h | 10 ---------- + 3 files changed, 30 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +index 7f181258eab..b7da6598755 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc ++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +@@ -370,15 +370,6 @@ static void ioctl_table_fill() { + + #if SANITIZER_GLIBC + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE +- _(CYGETDEFTHRESH, WRITE, sizeof(int)); +- _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +- _(CYGETMON, WRITE, struct_cyclades_monitor_sz); +- _(CYGETTHRESH, WRITE, sizeof(int)); +- _(CYGETTIMEOUT, WRITE, sizeof(int)); +- _(CYSETDEFTHRESH, NONE, 0); +- _(CYSETDEFTIMEOUT, NONE, 0); +- _(CYSETTHRESH, NONE, 0); +- _(CYSETTIMEOUT, NONE, 0); + _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); + _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); + _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +index 35a690cba5c..6e5c330b98e 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t; + # include + #endif + #include +-#include + #include + #include + #include +@@ -460,7 +459,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + + #if SANITIZER_GLIBC + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); +- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); + #if EV_VERSION > (0x010000) + unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); + #else +@@ -824,15 +822,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + #endif // SANITIZER_LINUX + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; +- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; +- unsigned IOCTL_CYGETMON = CYGETMON; +- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; +- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; +- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; +- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; +- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; +- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; + unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; + unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; + unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index ad358eef8b7..cba41ba5494 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz; + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + extern unsigned struct_ax25_parms_struct_sz; +-extern unsigned struct_cyclades_monitor_sz; + extern unsigned struct_input_keymap_entry_sz; + extern unsigned struct_ipx_config_data_sz; + extern unsigned struct_kbdiacrs_sz; +@@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE; + #endif // SANITIZER_LINUX + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +-extern unsigned IOCTL_CYGETDEFTHRESH; +-extern unsigned IOCTL_CYGETDEFTIMEOUT; +-extern unsigned IOCTL_CYGETMON; +-extern unsigned IOCTL_CYGETTHRESH; +-extern unsigned IOCTL_CYGETTIMEOUT; +-extern unsigned IOCTL_CYSETDEFTHRESH; +-extern unsigned IOCTL_CYSETDEFTIMEOUT; +-extern unsigned IOCTL_CYSETTHRESH; +-extern unsigned IOCTL_CYSETTIMEOUT; + extern unsigned IOCTL_EQL_EMANCIPATE; + extern unsigned IOCTL_EQL_ENSLAVE; + extern unsigned IOCTL_EQL_GETMASTRCFG; +-- +2.31.1 + diff --git a/spack-repos/externals/packages/gcc/patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch b/spack-repos/externals/packages/gcc/patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch new file mode 100755 index 000000000..2448be074 --- /dev/null +++ b/spack-repos/externals/packages/gcc/patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch @@ -0,0 +1,133 @@ +From f1feb74046e0feb0596b93bbb822fae02940a90e Mon Sep 17 00:00:00 2001 +From: Patrick Palka +Date: Fri, 4 Jun 2021 13:46:53 -0400 +Subject: [PATCH] c++: tsubst_function_decl and excess arg levels [PR100102] + +Here, when instantiating the dependent alias template +duration::__is_harmonic with args={{T,U},{int}}, we find ourselves +substituting the function decl _S_gcd. Since we have more arg levels +than _S_gcd has parm levels, an old special case in tsubst_function_decl +causes us to unwantedly reduce args to its innermost level, yielding +args={int}, which leads to a nonsensical substitution into the decl +context and eventually a crash. + +The comment for this special case refers to three examples for which we +ought to see more arg levels than parm levels here, but none of the +examples actually demonstrate this. In the first example, when +defining S::f(U) parms_depth is 2 and args_depth is 1, and +later when instantiating say S::f both depths are 2. In the +second example, when substituting the template friend declaration +parms_depth is 2 and args_depth is 1, and later when instantiating f +both depths are 1. Finally, the third example is invalid since we can't +specialize a member template of an unspecialized class template like +that. + +Given that this reduction code seems no longer relevant for its +documented purpose and that it causes problems as in the PR, this patch +just removes it. Note that as far as bootstrap/regtest is concerned, +this code is dead; the below two tests would be the first to reach it. + + PR c++/100102 + +gcc/cp/ChangeLog: + + * pt.c (tsubst_function_decl): Remove old code for reducing + args when it has excess levels. + +gcc/testsuite/ChangeLog: + + * g++.dg/cpp0x/alias-decl-72.C: New test. + * g++.dg/cpp0x/alias-decl-72a.C: New test. + +(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f) +--- + gcc/cp/pt.c | 39 --------------------- + gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C | 9 +++++ + gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C | 9 +++++ + 3 files changed, 18 insertions(+), 39 deletions(-) + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C + +diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c +index 1434beb80f4..1761a902218 100644 +--- a/gcc/cp/pt.c ++++ b/gcc/cp/pt.c +@@ -13954,45 +13954,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, + if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash)) + return spec; + } +- +- /* We can see more levels of arguments than parameters if +- there was a specialization of a member template, like +- this: +- +- template struct S { template void f(); } +- template <> template void S::f(U); +- +- Here, we'll be substituting into the specialization, +- because that's where we can find the code we actually +- want to generate, but we'll have enough arguments for +- the most general template. +- +- We also deal with the peculiar case: +- +- template struct S { +- template friend void f(); +- }; +- template void f() {} +- template S; +- template void f(); +- +- Here, the ARGS for the instantiation of will be {int, +- double}. But, we only need as many ARGS as there are +- levels of template parameters in CODE_PATTERN. We are +- careful not to get fooled into reducing the ARGS in +- situations like: +- +- template struct S { template void f(U); } +- template template <> void S::f(int) {} +- +- which we can spot because the pattern will be a +- specialization in this case. */ +- int args_depth = TMPL_ARGS_DEPTH (args); +- int parms_depth = +- TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t))); +- +- if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t)) +- args = get_innermost_template_args (args, parms_depth); + } + else + { +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +new file mode 100644 +index 00000000000..8009756dcba +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template struct ratio; ++template struct duration { ++ static constexpr int _S_gcd(); ++ template using __is_harmonic = ratio<_S_gcd>; ++ using type = __is_harmonic; ++}; +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +new file mode 100644 +index 00000000000..a4443e18f9d +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template struct ratio; ++template struct duration { ++ static constexpr int _S_gcd(); ++ template using __is_harmonic = ratio<(duration::_S_gcd)()>; ++ using type = __is_harmonic; ++}; +-- +2.31.1 + diff --git a/spack-repos/externals/packages/gcc/patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch b/spack-repos/externals/packages/gcc/patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch new file mode 100755 index 000000000..27e5a2b5b --- /dev/null +++ b/spack-repos/externals/packages/gcc/patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch @@ -0,0 +1,133 @@ +From fc930b3010bd0de899a3da3209eab20664ddb703 Mon Sep 17 00:00:00 2001 +From: Patrick Palka +Date: Fri, 4 Jun 2021 13:46:53 -0400 +Subject: [PATCH] c++: tsubst_function_decl and excess arg levels [PR100102] + +Here, when instantiating the dependent alias template +duration::__is_harmonic with args={{T,U},{int}}, we find ourselves +substituting the function decl _S_gcd. Since we have more arg levels +than _S_gcd has parm levels, an old special case in tsubst_function_decl +causes us to unwantedly reduce args to its innermost level, yielding +args={int}, which leads to a nonsensical substitution into the decl +context and eventually a crash. + +The comment for this special case refers to three examples for which we +ought to see more arg levels than parm levels here, but none of the +examples actually demonstrate this. In the first example, when +defining S::f(U) parms_depth is 2 and args_depth is 1, and +later when instantiating say S::f both depths are 2. In the +second example, when substituting the template friend declaration +parms_depth is 2 and args_depth is 1, and later when instantiating f +both depths are 1. Finally, the third example is invalid since we can't +specialize a member template of an unspecialized class template like +that. + +Given that this reduction code seems no longer relevant for its +documented purpose and that it causes problems as in the PR, this patch +just removes it. Note that as far as bootstrap/regtest is concerned, +this code is dead; the below two tests would be the first to reach it. + + PR c++/100102 + +gcc/cp/ChangeLog: + + * pt.c (tsubst_function_decl): Remove old code for reducing + args when it has excess levels. + +gcc/testsuite/ChangeLog: + + * g++.dg/cpp0x/alias-decl-72.C: New test. + * g++.dg/cpp0x/alias-decl-72a.C: New test. + +(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f) +--- + gcc/cp/pt.c | 39 --------------------- + gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C | 9 +++++ + gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C | 9 +++++ + 3 files changed, 18 insertions(+), 39 deletions(-) + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C + create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C + +diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c +index 5a957141ba3..7ce9ac234f8 100644 +--- a/gcc/cp/pt.c ++++ b/gcc/cp/pt.c +@@ -13811,45 +13811,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, + if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash)) + return spec; + } +- +- /* We can see more levels of arguments than parameters if +- there was a specialization of a member template, like +- this: +- +- template struct S { template void f(); } +- template <> template void S::f(U); +- +- Here, we'll be substituting into the specialization, +- because that's where we can find the code we actually +- want to generate, but we'll have enough arguments for +- the most general template. +- +- We also deal with the peculiar case: +- +- template struct S { +- template friend void f(); +- }; +- template void f() {} +- template S; +- template void f(); +- +- Here, the ARGS for the instantiation of will be {int, +- double}. But, we only need as many ARGS as there are +- levels of template parameters in CODE_PATTERN. We are +- careful not to get fooled into reducing the ARGS in +- situations like: +- +- template struct S { template void f(U); } +- template template <> void S::f(int) {} +- +- which we can spot because the pattern will be a +- specialization in this case. */ +- int args_depth = TMPL_ARGS_DEPTH (args); +- int parms_depth = +- TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t))); +- +- if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t)) +- args = get_innermost_template_args (args, parms_depth); + } + else + { +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +new file mode 100644 +index 00000000000..8009756dcba +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template struct ratio; ++template struct duration { ++ static constexpr int _S_gcd(); ++ template using __is_harmonic = ratio<_S_gcd>; ++ using type = __is_harmonic; ++}; +diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +new file mode 100644 +index 00000000000..a4443e18f9d +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C +@@ -0,0 +1,9 @@ ++// PR c++/100102 ++// { dg-do compile { target c++11 } } ++ ++template struct ratio; ++template struct duration { ++ static constexpr int _S_gcd(); ++ template using __is_harmonic = ratio<(duration::_S_gcd)()>; ++ using type = __is_harmonic; ++}; +-- +2.31.1 + diff --git a/spack-repos/externals/packages/gcc/piclibs.patch b/spack-repos/externals/packages/gcc/piclibs.patch new file mode 100755 index 000000000..0ecb79306 --- /dev/null +++ b/spack-repos/externals/packages/gcc/piclibs.patch @@ -0,0 +1,62 @@ +diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in +index 62b9f7a..7666fdb 100644 +--- a/libgfortran/Makefile.in ++++ b/libgfortran/Makefile.in +@@ -357,11 +357,11 @@ AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ +-CFLAGS = @CFLAGS@ ++CFLAGS = @CFLAGS@ -fPIC + CPP = @CPP@ +-CPPFLAGS = @CPPFLAGS@ ++CPPFLAGS = @CPPFLAGS@ -fPIC + CYGPATH_W = @CYGPATH_W@ +-DEFS = @DEFS@ ++DEFS = @DEFS@ -fPIC + DEPDIR = @DEPDIR@ + DSYMUTIL = @DSYMUTIL@ + DUMPBIN = @DUMPBIN@ +@@ -371,7 +371,7 @@ ECHO_T = @ECHO_T@ + EGREP = @EGREP@ + EXEEXT = @EXEEXT@ + FC = @FC@ +-FCFLAGS = @FCFLAGS@ ++FCFLAGS = @FCFLAGS@ -fPIC + FGREP = @FGREP@ + FPU_HOST_HEADER = @FPU_HOST_HEADER@ + GREP = @GREP@ +diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in +index bede542..9b3e442 100644 +--- a/libstdc++-v3/Makefile.in ++++ b/libstdc++-v3/Makefile.in +@@ -115,7 +115,7 @@ CC = @CC@ + CCODECVT_CC = @CCODECVT_CC@ + CCOLLATE_CC = @CCOLLATE_CC@ + CCTYPE_CC = @CCTYPE_CC@ +-CFLAGS = @CFLAGS@ ++CFLAGS = @CFLAGS@ -fPIC + CLOCALE_CC = @CLOCALE_CC@ + CLOCALE_H = @CLOCALE_H@ + CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@ +@@ -124,7 +124,7 @@ CMESSAGES_H = @CMESSAGES_H@ + CMONEY_CC = @CMONEY_CC@ + CNUMERIC_CC = @CNUMERIC_CC@ + CPP = @CPP@ +-CPPFLAGS = @CPPFLAGS@ ++CPPFLAGS = @CPPFLAGS@ -fPIC + CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@ + CPU_OPT_BITS_RANDOM = @CPU_OPT_BITS_RANDOM@ + CPU_OPT_EXT_RANDOM = @CPU_OPT_EXT_RANDOM@ +@@ -139,7 +139,7 @@ CYGPATH_W = @CYGPATH_W@ + C_INCLUDE_DIR = @C_INCLUDE_DIR@ + DBLATEX = @DBLATEX@ + DEBUG_FLAGS = @DEBUG_FLAGS@ +-DEFS = @DEFS@ ++DEFS = @DEFS@ -fPIC + DOT = @DOT@ + DOXYGEN = @DOXYGEN@ + DSYMUTIL = @DSYMUTIL@ +-- +2.8.3 + diff --git a/spack-repos/externals/packages/gcc/signal.patch b/spack-repos/externals/packages/gcc/signal.patch new file mode 100755 index 000000000..21bf9e030 --- /dev/null +++ b/spack-repos/externals/packages/gcc/signal.patch @@ -0,0 +1,28 @@ +From 6c709b6262e8b6441b1e94526d6d65d4ce7a7dec Mon Sep 17 00:00:00 2001 +From: doko +Date: Thu, 7 Sep 2017 07:18:57 +0000 +Subject: [PATCH] 2017-09-07 Matthias Klose + + * asan/asan_linux.cc: Include + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251830 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libsanitizer/asan/asan_linux.cc | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc +index c504168..59087b9 100644 +--- a/libsanitizer/asan/asan_linux.cc ++++ b/libsanitizer/asan/asan_linux.cc +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.9.3 + diff --git a/spack-repos/externals/packages/gcc/stack_t-4.9.patch b/spack-repos/externals/packages/gcc/stack_t-4.9.patch new file mode 100755 index 000000000..b894557c8 --- /dev/null +++ b/spack-repos/externals/packages/gcc/stack_t-4.9.patch @@ -0,0 +1,80 @@ +From 833e00c01e96f61e24cd7ec97b93fad212dc914b Mon Sep 17 00:00:00 2001 +From: doko +Date: Thu, 7 Sep 2017 07:17:17 +0000 +Subject: [PATCH] 2017-09-07 Matthias Klose + + Backported from mainline + 2017-07-14 Jakub Jelinek + + PR sanitizer/81066 + * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. + * sanitizer_common/sanitizer_linux.cc: Likewise. + * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. + * tsan/tsan_platform_linux.cc: Likewise. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251829 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libsanitizer/sanitizer_common/sanitizer_linux.cc | 3 +-- + libsanitizer/sanitizer_common/sanitizer_linux.h | 4 +--- + .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +- + libsanitizer/tsan/tsan_platform_linux.cc | 2 +- + 5 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc +index 9feb307..821b26d 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc +@@ -514,8 +514,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { + } + #endif + +-uptr internal_sigaltstack(const struct sigaltstack *ss, +- struct sigaltstack *oss) { ++uptr internal_sigaltstack(const void *ss, void *oss) { + return internal_syscall(__NR_sigaltstack, (uptr)ss, (uptr)oss); + } + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h +index 086834c..3a6f4cd 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.h ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.h +@@ -27,8 +26,7 @@ struct linux_dirent; + // Syscall wrappers. + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); + uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5); +-uptr internal_sigaltstack(const struct sigaltstack* ss, +- struct sigaltstack* oss); ++uptr internal_sigaltstack(const void* ss, void* oss); + uptr internal_sigaction(int signum, const __sanitizer_kernel_sigaction_t *act, + __sanitizer_kernel_sigaction_t *oldact); + uptr internal_sigprocmask(int how, __sanitizer_kernel_sigset_t *set, +diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +index 5881202..c54894d 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +@@ -234,7 +234,7 @@ static int TracerThread(void* argument) { + + // Alternate stack for signal handling. + InternalScopedBuffer handler_stack_memory(kHandlerStackSize); +- struct sigaltstack handler_stack; ++ stack_t handler_stack; + internal_memset(&handler_stack, 0, sizeof(handler_stack)); + handler_stack.ss_sp = handler_stack_memory.data(); + handler_stack.ss_size = kHandlerStackSize; +diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc +index 3259131..b8e9078 100644 +--- a/libsanitizer/tsan/tsan_platform_linux.cc ++++ b/libsanitizer/tsan/tsan_platform_linux.cc +@@ -377,7 +377,7 @@ bool IsGlobalVar(uptr addr) { + int ExtractResolvFDs(void *state, int *fds, int nfd) { + #if SANITIZER_LINUX + int cnt = 0; +- __res_state *statp = (__res_state*)state; ++ struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { + if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) + fds[cnt++] = statp->_u._ext.nssocks[i]; +-- +2.9.3 + diff --git a/spack-repos/externals/packages/gcc/stack_t.patch b/spack-repos/externals/packages/gcc/stack_t.patch new file mode 100755 index 000000000..48a5a47ad --- /dev/null +++ b/spack-repos/externals/packages/gcc/stack_t.patch @@ -0,0 +1,88 @@ +From 833e00c01e96f61e24cd7ec97b93fad212dc914b Mon Sep 17 00:00:00 2001 +From: doko +Date: Thu, 7 Sep 2017 07:17:17 +0000 +Subject: [PATCH] 2017-09-07 Matthias Klose + + Backported from mainline + 2017-07-14 Jakub Jelinek + + PR sanitizer/81066 + * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. + * sanitizer_common/sanitizer_linux.cc: Likewise. + * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. + * tsan/tsan_platform_linux.cc: Likewise. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251829 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libsanitizer/sanitizer_common/sanitizer_linux.cc | 3 +-- + libsanitizer/sanitizer_common/sanitizer_linux.h | 4 +--- + .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +- + libsanitizer/tsan/tsan_platform_linux.cc | 2 +- + 5 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc +index 9feb307..821b26d 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc +@@ -514,8 +514,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { + } + #endif + +-uptr internal_sigaltstack(const struct sigaltstack *ss, +- struct sigaltstack *oss) { ++uptr internal_sigaltstack(const void *ss, void *oss) { + return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); + } + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h +index 086834c..3a6f4cd 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.h ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.h +@@ -18,7 +18,6 @@ + #include "sanitizer_platform_limits_posix.h" + + struct link_map; // Opaque type returned by dlopen(). +-struct sigaltstack; + + namespace __sanitizer { + // Dirent structure for getdents(). Note that this structure is different from +@@ -27,8 +26,7 @@ struct linux_dirent; + + // Syscall wrappers. + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); +-uptr internal_sigaltstack(const struct sigaltstack* ss, +- struct sigaltstack* oss); ++uptr internal_sigaltstack(const void* ss, void* oss); + uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, + __sanitizer_sigset_t *oldset); + void internal_sigfillset(__sanitizer_sigset_t *set); +diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +index 5881202..c54894d 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +@@ -234,7 +234,7 @@ static int TracerThread(void* argument) { + + // Alternate stack for signal handling. + InternalScopedBuffer handler_stack_memory(kHandlerStackSize); +- struct sigaltstack handler_stack; ++ stack_t handler_stack; + internal_memset(&handler_stack, 0, sizeof(handler_stack)); + handler_stack.ss_sp = handler_stack_memory.data(); + handler_stack.ss_size = kHandlerStackSize; +diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc +index 3259131..b8e9078 100644 +--- a/libsanitizer/tsan/tsan_platform_linux.cc ++++ b/libsanitizer/tsan/tsan_platform_linux.cc +@@ -377,7 +377,7 @@ bool IsGlobalVar(uptr addr) { + int ExtractResolvFDs(void *state, int *fds, int nfd) { + #if SANITIZER_LINUX + int cnt = 0; +- __res_state *statp = (__res_state*)state; ++ struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { + if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) + fds[cnt++] = statp->_u._ext.nssocks[i]; +-- +2.9.3 + diff --git a/spack-repos/externals/packages/gcc/sys_ustat-4.9.patch b/spack-repos/externals/packages/gcc/sys_ustat-4.9.patch new file mode 100755 index 000000000..75453af33 --- /dev/null +++ b/spack-repos/externals/packages/gcc/sys_ustat-4.9.patch @@ -0,0 +1,34 @@ +The sys_ustat.h patch modified for gcc 4.9.x. + +diff -Naurb gcc-4.9.4.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +--- gcc-4.9.4.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2013-12-19 06:54:11.000000000 -0600 ++++ gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-12-11 15:57:46.901800462 -0600 +@@ -81,7 +81,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -163,7 +162,19 @@ + unsigned struct_old_utsname_sz = sizeof(struct old_utsname); + unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname); + unsigned struct_itimerspec_sz = sizeof(struct itimerspec); +- unsigned struct_ustat_sz = sizeof(struct ustat); ++ // Use pre-computed size of struct ustat to avoid which ++ // has been removed from glibc 2.28. ++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ ++ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ ++ || defined(__x86_64__) ++#define SIZEOF_STRUCT_USTAT 32 ++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ ++ || defined(__powerpc__) || defined(__s390__) ++#define SIZEOF_STRUCT_USTAT 20 ++#else ++#error Unknown size of struct ustat ++#endif ++ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; + #endif // SANITIZER_LINUX + + #if SANITIZER_LINUX && !SANITIZER_ANDROID diff --git a/spack-repos/externals/packages/gcc/sys_ustat.h.patch b/spack-repos/externals/packages/gcc/sys_ustat.h.patch new file mode 100755 index 000000000..c65757b4e --- /dev/null +++ b/spack-repos/externals/packages/gcc/sys_ustat.h.patch @@ -0,0 +1,63 @@ +From 9569b61168b963a6cea7b782fd350dee489ad42c Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" +Date: Mon, 21 May 2018 13:17:55 -0700 +Subject: [PATCH] libsanitizer: Use pre-computed size of struct ustat for Linux + +Cherry-pick compiler-rt revision 333213: + + has been removed from glibc 2.28 by: + +commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7 +Author: Adhemerval Zanella +Date: Sun Mar 18 11:28:59 2018 +0800 + + Deprecate ustat syscall interface + +This patch uses pre-computed size of struct ustat for Linux. + + PR sanitizer/85835 + * sanitizer_common/sanitizer_platform_limits_posix.cc: Don't + include for Linux. + (SIZEOF_STRUCT_USTAT): New. + (struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux. +--- + .../sanitizer_platform_limits_posix.cc | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 858bb218450..de18e56d11c 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t; + # include + #endif + #include +-#include + #include + #include + #include +@@ -250,7 +249,19 @@ namespace __sanitizer { + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + + #if SANITIZER_LINUX && !SANITIZER_ANDROID +- unsigned struct_ustat_sz = sizeof(struct ustat); ++ // Use pre-computed size of struct ustat to avoid which ++ // has been removed from glibc 2.28. ++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ ++ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ ++ || defined(__x86_64__) ++#define SIZEOF_STRUCT_USTAT 32 ++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ ++ || defined(__powerpc__) || defined(__s390__) ++#define SIZEOF_STRUCT_USTAT 20 ++#else ++#error Unknown size of struct ustat ++#endif ++ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; + unsigned struct_rlimit64_sz = sizeof(struct rlimit64); + unsigned struct_statvfs64_sz = sizeof(struct statvfs64); + #endif // SANITIZER_LINUX && !SANITIZER_ANDROID +-- +2.17.0 + + diff --git a/spack-repos/externals/packages/gcc/ucontext_t-java.patch b/spack-repos/externals/packages/gcc/ucontext_t-java.patch new file mode 100755 index 000000000..a43e0b5aa --- /dev/null +++ b/spack-repos/externals/packages/gcc/ucontext_t-java.patch @@ -0,0 +1,60 @@ +From 9b9287cde20ea57578cf07efb2a96ed4cc0da36f Mon Sep 17 00:00:00 2001 +From: doko +Date: Thu, 7 Sep 2017 07:22:07 +0000 +Subject: [PATCH] 2017-09-07 Matthias Klose + + * include/x86_64-signal.h (HANDLE_DIVIDE_OVERFLOW): Replace + 'struct ucontext' with ucontext_t. + * include/i386-signal.h (HANDLE_DIVIDE_OVERFLOW): Likewise. + * include/s390-signal.h (HANDLE_DIVIDE_OVERFLOW): Likewise. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251832 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libjava/include/i386-signal.h | 2 +- + libjava/include/s390-signal.h | 2 +- + libjava/include/x86_64-signal.h | 2 +- + 4 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h +index c2409b0..ef77e7e 100644 +--- a/libjava/include/i386-signal.h ++++ b/libjava/include/i386-signal.h +@@ -29,7 +29,7 @@ static void _Jv_##_name (int, siginfo_t *, \ + #define HANDLE_DIVIDE_OVERFLOW \ + do \ + { \ +- struct ucontext *_uc = (struct ucontext *)_p; \ ++ ucontext_t *_uc = (ucontext_t *)_p; \ + gregset_t &_gregs = _uc->uc_mcontext.gregs; \ + unsigned char *_eip = (unsigned char *)_gregs[REG_EIP]; \ + \ +diff --git a/libjava/include/s390-signal.h b/libjava/include/s390-signal.h +index 4ca4c10..9261b52 100644 +--- a/libjava/include/s390-signal.h ++++ b/libjava/include/s390-signal.h +@@ -51,7 +51,7 @@ do \ + struct \ + { \ + unsigned long int uc_flags; \ +- struct ucontext *uc_link; \ ++ ucontext_t *uc_link; \ + stack_t uc_stack; \ + mcontext_t uc_mcontext; \ + unsigned long sigmask[2]; \ +diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h +index 12383b5..e36c5a3 100644 +--- a/libjava/include/x86_64-signal.h ++++ b/libjava/include/x86_64-signal.h +@@ -28,7 +28,7 @@ static void _Jv_##_name (int, siginfo_t *, \ + #define HANDLE_DIVIDE_OVERFLOW \ + do \ + { \ +- struct ucontext *_uc = (struct ucontext *)_p; \ ++ ucontext_t *_uc = (ucontext_t *)_p; \ + gregset_t &_gregs = _uc->uc_mcontext.gregs; \ + unsigned char *_rip = (unsigned char *)_gregs[REG_RIP]; \ + \ +-- +2.9.3 + diff --git a/spack-repos/externals/packages/gcc/ucontext_t.patch b/spack-repos/externals/packages/gcc/ucontext_t.patch new file mode 100755 index 000000000..a4f04b471 --- /dev/null +++ b/spack-repos/externals/packages/gcc/ucontext_t.patch @@ -0,0 +1,189 @@ +From ecf0d1a107133c715763940c2b197aa814710e1b Mon Sep 17 00:00:00 2001 +From: jsm28 +Date: Tue, 4 Jul 2017 10:25:10 +0000 +Subject: [PATCH] Use ucontext_t not struct ucontext in linux-unwind.h files. + +Current glibc no longer gives the ucontext_t type the tag struct +ucontext, to conform with POSIX namespace rules. This requires +various linux-unwind.h files in libgcc, that were previously using +struct ucontext, to be fixed to use ucontext_t instead. This is +similar to the removal of the struct siginfo tag from siginfo_t some +years ago. + +This patch changes those files to use ucontext_t instead. As the +standard name that should be unconditionally safe, so this is not +restricted to architectures supported by glibc, or conditioned on the +glibc version. + +Tested compilation together with current glibc with glibc's +build-many-glibcs.py. + + * config/aarch64/linux-unwind.h (aarch64_fallback_frame_state), + config/alpha/linux-unwind.h (alpha_fallback_frame_state), + config/bfin/linux-unwind.h (bfin_fallback_frame_state), + config/i386/linux-unwind.h (x86_64_fallback_frame_state, + x86_fallback_frame_state), config/m68k/linux-unwind.h (struct + uw_ucontext), config/nios2/linux-unwind.h (struct nios2_ucontext), + config/pa/linux-unwind.h (pa32_fallback_frame_state), + config/sh/linux-unwind.h (sh_fallback_frame_state), + config/tilepro/linux-unwind.h (tile_fallback_frame_state), + config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Use + ucontext_t instead of struct ucontext. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@249958 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + libgcc/config/aarch64/linux-unwind.h | 2 +- + libgcc/config/alpha/linux-unwind.h | 2 +- + libgcc/config/bfin/linux-unwind.h | 2 +- + libgcc/config/i386/linux-unwind.h | 4 ++-- + libgcc/config/m68k/linux-unwind.h | 2 +- + libgcc/config/nios2/linux-unwind.h | 2 +- + libgcc/config/pa/linux-unwind.h | 2 +- + libgcc/config/sh/linux-unwind.h | 2 +- + libgcc/config/tilepro/linux-unwind.h | 2 +- + libgcc/config/xtensa/linux-unwind.h | 2 +- + 11 files changed, 25 insertions(+), 11 deletions(-) + +diff --git a/libgcc/config/aarch64/linux-unwind.h b/libgcc/config/aarch64/linux-unwind.h +index 86d17b1..909f68f 100644 +--- a/libgcc/config/aarch64/linux-unwind.h ++++ b/libgcc/config/aarch64/linux-unwind.h +@@ -52,7 +52,7 @@ aarch64_fallback_frame_state (struct _Unwind_Context *context, + struct rt_sigframe + { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + }; + + struct rt_sigframe *rt_; +diff --git a/libgcc/config/alpha/linux-unwind.h b/libgcc/config/alpha/linux-unwind.h +index d65474f..9a226b1 100644 +--- a/libgcc/config/alpha/linux-unwind.h ++++ b/libgcc/config/alpha/linux-unwind.h +@@ -51,7 +51,7 @@ alpha_fallback_frame_state (struct _Unwind_Context *context, + { + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + sc = &rt_->uc.uc_mcontext; + } +diff --git a/libgcc/config/bfin/linux-unwind.h b/libgcc/config/bfin/linux-unwind.h +index 0c270e4..7fa95d2 100644 +--- a/libgcc/config/bfin/linux-unwind.h ++++ b/libgcc/config/bfin/linux-unwind.h +@@ -52,7 +52,7 @@ bfin_fallback_frame_state (struct _Unwind_Context *context, + void *puc; + char retcode[8]; + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + + /* The void * cast is necessary to avoid an aliasing warning. +diff --git a/libgcc/config/i386/linux-unwind.h b/libgcc/config/i386/linux-unwind.h +index e54bf73..d35fc45 100644 +--- a/libgcc/config/i386/linux-unwind.h ++++ b/libgcc/config/i386/linux-unwind.h +@@ -58,7 +58,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context, + if (*(unsigned char *)(pc+0) == 0x48 + && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL) + { +- struct ucontext *uc_ = context->cfa; ++ ucontext_t *uc_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem + because it does not alias anything. */ +@@ -138,7 +138,7 @@ x86_fallback_frame_state (struct _Unwind_Context *context, + siginfo_t *pinfo; + void *puc; + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem +diff --git a/libgcc/config/m68k/linux-unwind.h b/libgcc/config/m68k/linux-unwind.h +index fb79a4d..b2f5ea4 100644 +--- a/libgcc/config/m68k/linux-unwind.h ++++ b/libgcc/config/m68k/linux-unwind.h +@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + /* is unfortunately broken right now. */ + struct uw_ucontext { + unsigned long uc_flags; +- struct ucontext *uc_link; ++ ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + unsigned long uc_filler[80]; +diff --git a/libgcc/config/nios2/linux-unwind.h b/libgcc/config/nios2/linux-unwind.h +index dff1c20..1d88afe 100644 +--- a/libgcc/config/nios2/linux-unwind.h ++++ b/libgcc/config/nios2/linux-unwind.h +@@ -38,7 +38,7 @@ struct nios2_mcontext { + + struct nios2_ucontext { + unsigned long uc_flags; +- struct ucontext *uc_link; ++ ucontext_t *uc_link; + stack_t uc_stack; + struct nios2_mcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +diff --git a/libgcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h +index 0149468..9157535 100644 +--- a/libgcc/config/pa/linux-unwind.h ++++ b/libgcc/config/pa/linux-unwind.h +@@ -80,7 +80,7 @@ pa32_fallback_frame_state (struct _Unwind_Context *context, + struct sigcontext *sc; + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *frame; + + /* rt_sigreturn trampoline: +diff --git a/libgcc/config/sh/linux-unwind.h b/libgcc/config/sh/linux-unwind.h +index e63091f..67033f0 100644 +--- a/libgcc/config/sh/linux-unwind.h ++++ b/libgcc/config/sh/linux-unwind.h +@@ -180,7 +180,7 @@ sh_fallback_frame_state (struct _Unwind_Context *context, + { + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem +diff --git a/libgcc/config/tilepro/linux-unwind.h b/libgcc/config/tilepro/linux-unwind.h +index fd83ba7..e3c9ef0 100644 +--- a/libgcc/config/tilepro/linux-unwind.h ++++ b/libgcc/config/tilepro/linux-unwind.h +@@ -61,7 +61,7 @@ tile_fallback_frame_state (struct _Unwind_Context *context, + struct rt_sigframe { + unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_; + + /* Return if this is not a signal handler. */ +diff --git a/libgcc/config/xtensa/linux-unwind.h b/libgcc/config/xtensa/linux-unwind.h +index 9a67b5d..98b7ea6 100644 +--- a/libgcc/config/xtensa/linux-unwind.h ++++ b/libgcc/config/xtensa/linux-unwind.h +@@ -67,7 +67,7 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context, + + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_; + + /* movi a2, __NR_rt_sigreturn; syscall */ +-- +2.9.3 + diff --git a/spack-repos/externals/packages/gcc/zstd.patch b/spack-repos/externals/packages/gcc/zstd.patch new file mode 100755 index 000000000..8fb7583a0 --- /dev/null +++ b/spack-repos/externals/packages/gcc/zstd.patch @@ -0,0 +1,43 @@ +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -1075,7 +1075,8 @@ GNATMAKE = @GNATMAKE@ + # Libs needed (at present) just for jcf-dump. + LDEXP_LIB = @LDEXP_LIB@ + +-ZSTD_LIB = @ZSTD_LIB@ ++ZSTD_INC = @ZSTD_CPPFLAGS@ ++ZSTD_LIB = @ZSTD_LDFLAGS@ @ZSTD_LIB@ + + # Likewise, for use in the tools that must run on this machine + # even if we are cross-building GCC. +@@ -2275,7 +2276,7 @@ CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \ + version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE) + + # lto-compress.o needs $(ZLIBINC) added to the include flags. +-CFLAGS-lto-compress.o += $(ZLIBINC) ++CFLAGS-lto-compress.o += $(ZLIBINC) $(ZSTD_INC) + + CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\" + +--- a/gcc/configure ++++ b/gcc/configure +@@ -786,6 +786,8 @@ LTLIBICONV + LIBICONV + ZSTD_LIB + ZSTD_INCLUDE ++ZSTD_LDFLAGS ++ZSTD_CPPFLAGS + DL_LIB + LDEXP_LIB + EXTRA_GCC_LIBS +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -1339,6 +1339,8 @@ AC_SUBST(ZSTD_INCLUDE) + AC_SUBST(ZSTD_LIB) + ZSTD_CPPFLAGS= + ZSTD_LDFLAGS= ++AC_SUBST(ZSTD_CPPFLAGS) ++AC_SUBST(ZSTD_LDFLAGS) + AC_ARG_WITH(zstd, + [AS_HELP_STRING([--with-zstd=PATH], + [specify prefix directory for installed zstd library. diff --git a/spack-repos/externals/packages/gdb/gdb-libintl-10.patch b/spack-repos/externals/packages/gdb/gdb-libintl-10.patch new file mode 100644 index 000000000..5d990d630 --- /dev/null +++ b/spack-repos/externals/packages/gdb/gdb-libintl-10.patch @@ -0,0 +1,12 @@ +diff -Naur gdbserver/Makefile.in gdbserver/Makefile.in +--- gdbserver/Makefile.in 2020-10-24 06:23:02.000000000 +0200 ++++ gdbserver/Makefile.in 2021-02-15 13:41:31.732000000 +0100 +@@ -388,7 +388,7 @@ + $(SILENCE) rm -f $(IPA_LIB) + $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \ + -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ +- -o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread ++ -o $(IPA_LIB) ${IPA_OBJS} $(INTL) -ldl -pthread + + # Put the proper machine-specific files first, so M-. on a machine + # specific routine gets the one for the correct machine. diff --git a/spack-repos/externals/packages/gdb/gdb-libintl-11.patch b/spack-repos/externals/packages/gdb/gdb-libintl-11.patch new file mode 100644 index 000000000..0354dd6cc --- /dev/null +++ b/spack-repos/externals/packages/gdb/gdb-libintl-11.patch @@ -0,0 +1,12 @@ +diff -Naur gdbserver/Makefile.in gdbserver/Makefile.in +--- gdbserver/Makefile.in 2021-07-03 13:41:11.000000000 -0400 ++++ gdbserver/Makefile.in 2021-09-13 14:53:13.402962333 -0400 +@@ -404,7 +404,7 @@ + $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \ + -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ + $(CXXFLAGS) \ +- -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread ++ -o $(IPA_LIB) ${IPA_OBJS} $(INTL) $(LIBIBERTY_FOR_SHLIB) -ldl -pthread + + # Put the proper machine-specific files first, so M-. on a machine + # specific routine gets the one for the correct machine. diff --git a/spack-repos/externals/packages/gdb/importlib.patch b/spack-repos/externals/packages/gdb/importlib.patch new file mode 100644 index 000000000..e0f866367 --- /dev/null +++ b/spack-repos/externals/packages/gdb/importlib.patch @@ -0,0 +1,18 @@ +diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py +index 84ec728ea21..9a0e9891cc5 100644 +--- a/gdb/python/lib/gdb/__init__.py ++++ b/gdb/python/lib/gdb/__init__.py +@@ -18,8 +18,10 @@ import os + import sys + import _gdb + +-if sys.version_info[0] > 2: +- # Python 3 moved "reload" ++# Python 3 moved "reload" ++if sys.version_info >= (3, 4): ++ from importlib import reload ++elif sys.version_info[0] > 2: + from imp import reload + + from _gdb import * +-- diff --git a/spack-repos/externals/packages/gdb/package.py b/spack-repos/externals/packages/gdb/package.py new file mode 100644 index 000000000..40537fef5 --- /dev/null +++ b/spack-repos/externals/packages/gdb/package.py @@ -0,0 +1,141 @@ +# Copyright 2013-2024 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 Gdb(AutotoolsPackage, GNUMirrorPackage): + """GDB, the GNU Project debugger, allows you to see what is going on + 'inside' another program while it executes -- or what another + program was doing at the moment it crashed. + """ + + homepage = "https://www.gnu.org/software/gdb" + gnu_mirror_path = "gdb/gdb-11.2.tar.gz" + + maintainers("robertu94") + + license("GPL-3.0-or-later AND LGPL-3.0-or-later") + + version("16.2", sha256="bdc1da4a033280ac752e7d34b0418efaa45bed093235cb88e62ea961752a37f8") + version("15.2", sha256="9d16bc2539a2a20dc3ef99b48b8414d51c51305c8577eb7a1da00996f6dea223") + version("14.2", sha256="2de5174762e959a5e529e20c20d88a04735469d8fffd98f61664e70b341dc47c") + version("14.1", sha256="683e63182fb72bd5d8db32ab388143796370a8e3e71c26bc264effb487db7927") + version("13.2", sha256="7ead13d9e19fa0c57bb19104e1a5f67eefa9fc79f2e6360de491e8fddeda1e30") + version("13.1", sha256="4cc3d7143d6d54d289d227b1e7289dbc0fa4cbd46131ab87136e1ea831cf46d4") + version("12.1", sha256="87296a3a9727356b56712c793704082d5df0ff36a34ca9ec9734fc9a8bdfdaab") + version("11.2", sha256="b558b66084835e43b6361f60d60d314c487447419cdf53adf83a87020c367290") + version("11.1", sha256="cc2903474e965a43d09c3b263952d48ced39dd22ce2d01968f3aa181335fcb9c") + version("10.2", sha256="b33ad58d687487a821ec8d878daab0f716be60d0936f2e3ac5cf08419ce70350") + version("10.1", sha256="f12f388b99e1408c01308c3f753313fafa45517740c81ab7ed0d511b13e2cf55") + version("9.2", sha256="38ef247d41ba7cc3f6f93a612a78bab9484de9accecbe3b0150a3c0391a3faf0") + version("9.1", sha256="fcda54d4f35bc53fb24b50009a71ca98410d71ff2620942e3c829a7f5d614252") + version("8.3.1", sha256="26ce655216cd03f4611518a7a1c31d80ec8e884c16715e9ba8b436822e51434b") + version("8.3", sha256="b2266ec592440d0eec18ee1790f8558b3b8a2845b76cc83a872e39b501ce8a28") + version("8.2.1", sha256="0107985f1edb8dddef6cdd68a4f4e419f5fec0f488cc204f0b7d482c0c6c9282") + version("8.2", sha256="847e4b65e5a7b872e86019dd59659029e2b06cae962e0ef345f169dcb4b851b8") + version("8.1", sha256="e54a2322da050e4b00785370a282b9b8f0b25861ec7cfbbce0115e253eea910e") + version("8.0.1", sha256="52017d33cab5b6a92455a1a904046d075357abf24153470178c0aadca2d479c5") + version("8.0", sha256="8968a19e14e176ee026f0ca777657c43456514ad41bb2bc7273e8c4219555ac9") + version("7.12.1", sha256="142057eacecfb929d52b561eb47a1103c7d504cec3f659dd8a5ae7bc378f7e77") + version("7.11.1", sha256="57e9e9aa3172ee16aa1e9c66fef08b4393b51872cc153e3f1ffdf18a57440586") + version("7.10.1", sha256="ff14f8050e6484508c73cbfa63731e57901478490ca1672dc0b5e2b03f6af622") + + variant("python", default=True, description="Compile with Python support", when="@8.2:") + variant("xz", default=True, description="Compile with lzma support") + variant("source-highlight", default=False, description="Compile with source-highlight support") + variant("lto", default=False, description="Enable lto") + variant("quad", default=False, description="Enable quad") + variant("gold", default=False, description="Enable gold linker") + variant("ld", default=False, description="Enable ld") + variant("tui", default=False, description="Enable tui") + variant("debuginfod", default=True, description="Enable debuginfod support", when="@10.1:") + + # Resolves the undefined references to libintl_gettext while linking gdbserver + # https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined + patch("gdb-libintl-10.patch", level=0, when="@10.1:11.0") + patch("gdb-libintl-11.patch", level=0, when="@11.1:") + + # Upstream patch and backport to fix build with glibc@2.25: + # http://lists.busybox.net/pipermail/buildroot/2017-March/188055.html + patch( + "https://git.buildroot.net/buildroot/plain/package/gdb/7.11.1/0002-Sync-proc_service-definition-with-GLIBC.patch?id=a8a2e5288ed4704907383b10bab704fca211f5db", + sha256="f2648907cc22f7d02551d0018d44848f9db9fc5cdfda4fea65906a372f4f551b", + when="@7.11.1", + ) + patch( + "https://git.buildroot.net/buildroot/plain/package/gdb/7.10.1/0007-Sync-proc_service-definition-with-GLIBC.patch?id=a8a2e5288ed4704907383b10bab704fca211f5db", + sha256="6bfa89d9989d70167b307e6b0aa5f72dd0bc3d124553c4b54b270f8c4adf5fdc", + when="@7.10.1", + ) + + # Silence warnings about imp being deprecated on new python versions + # https://sourceware.org/pipermail/gdb-patches/2021-February/176622.html + patch("importlib.patch", when="@8.3.1:10.2 ^python@3.4:") + + # Required dependency + depends_on("texinfo", type="build") + + # Optional dependencies + depends_on("python", when="+python", type=("build", "link", "run")) + + # JCF, Dec-10-2025: the following relevant constraint is manually taken from the spack-packages repo + # pyOS_ReadlineTState became private API in cpython commit + # d228825e08883fc13f35eb91435f95d32524931c + depends_on("python@:3.12", when="@:14.2") + + # gdb@9.2 will segmentation fault if it builds with python@3.9. + # https://bugzilla.redhat.com/show_bug.cgi?id=1829702 + depends_on("python@:3.8", when="@:9.2+python", type=("build", "link", "run")) + depends_on("xz", when="+xz") + depends_on("zlib-api") + depends_on("zstd", when="@13.1:") + depends_on("pkgconfig", type="build", when="@13.1:") + depends_on("source-highlight", when="+source-highlight") + depends_on("ncurses", when="+tui") + depends_on("gmp", when="@11.1:") + depends_on("elfutils@0.179:+debuginfod", when="@10.1:+debuginfod") + depends_on("mpfr@4.2:", when="@14:") + + build_directory = "spack-build" + + def configure_args(self): + args = [ + "--with-system-gdbinit={}".format(self.prefix.etc.gdbinit), + "--with-system-zlib", + *self.enable_or_disable("lto"), + *self.with_or_without("quad"), + *self.enable_or_disable("gold"), + *self.enable_or_disable("ld"), + *self.enable_or_disable("tui"), + *self.with_or_without("debuginfod"), + ] + + if self.spec.satisfies("@13.1:"): + args.append("--with-zstd") + + if self.spec.version >= Version("11.1"): + args.append("--with-gmp={}".format(self.spec["gmp"].prefix)) + + if "+python" in self.spec: + args.append("--with-python={}".format(self.spec["python"].command)) + args.append("LDFLAGS={}".format(self.spec["python"].libs.ld_flags)) + + return args + + @run_after("install") + def gdbinit(self): + if "+python" in self.spec: + tool = self.spec["python"].command.path + "-gdb.py" + if os.path.exists(tool): + mkdir(self.prefix.etc) + with open(self.prefix.etc.gdbinit, "w") as gdbinit: + gdbinit.write("add-auto-load-safe-path {0}\n".format(tool)) + + def check(self): + """The GDB testsuite is extensive and is hard to pass. Skip it for now.""" + pass diff --git a/spack-repos/externals/packages/gflags/package.py b/spack-repos/externals/packages/gflags/package.py new file mode 100644 index 000000000..886822c9b --- /dev/null +++ b/spack-repos/externals/packages/gflags/package.py @@ -0,0 +1,29 @@ +# Copyright 2013-2024 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 Gflags(CMakePackage): + """The gflags package contains a C++ library that implements + commandline flags processing. It includes built-in support for + standard types such as string and the ability to define flags + in the source file in which they are used. Online documentation + available at: https://gflags.github.io/gflags/""" + + homepage = "https://gflags.github.io/gflags" + url = "https://github.com/gflags/gflags/archive/v2.1.2.tar.gz" + + license("BSD-3-Clause") + + version("2.2.2", sha256="34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf") + version("2.1.2", sha256="d8331bd0f7367c8afd5fcb5f5e85e96868a00fd24b7276fa5fcee1e5575c2662") + + depends_on("cmake@2.8.12:", type="build") + + patch("update_cmake_minimum_required.patch", when="@2.2.2", sha256="66242e3161de17c27b09f8e40d63ea44fcdf31f797976c1e51f018944b168b1e") + + def cmake_args(self): + return ["-DBUILD_SHARED_LIBS=ON"] diff --git a/spack-repos/externals/packages/gflags/update_cmake_minimum_required.patch b/spack-repos/externals/packages/gflags/update_cmake_minimum_required.patch new file mode 100644 index 000000000..d01f25114 --- /dev/null +++ b/spack-repos/externals/packages/gflags/update_cmake_minimum_required.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 657a1f4..f2778e1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,7 +70,7 @@ + ## - GFLAGS_INSTALL_SHARED_LIBS + ## - GFLAGS_INSTALL_STATIC_LIBS + +-cmake_minimum_required (VERSION 3.0.2 FATAL_ERROR) ++cmake_minimum_required (VERSION 3.26.3 FATAL_ERROR) + + if (POLICY CMP0042) + cmake_policy (SET CMP0042 NEW) +diff --git a/test/config/CMakeLists.txt b/test/config/CMakeLists.txt +index 6190b25..82fac14 100644 +--- a/test/config/CMakeLists.txt ++++ b/test/config/CMakeLists.txt +@@ -1,6 +1,6 @@ + ## gflags package configuration tests + +-cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required (VERSION 3.26.3 FATAL_ERROR) + + project (gflags_${TEST_NAME}) + +diff --git a/test/nc/CMakeLists.txt b/test/nc/CMakeLists.txt +index d00b07d..ea91ee4 100644 +--- a/test/nc/CMakeLists.txt ++++ b/test/nc/CMakeLists.txt +@@ -1,6 +1,6 @@ + ## gflags negative compilation tests + +-cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required (VERSION 3.26.3 FATAL_ERROR) + + if (NOT TEST_NAME) + message (FATAL_ERROR "Missing TEST_NAME CMake flag") diff --git a/spack-repos/externals/packages/glib/g_date_strftime.patch b/spack-repos/externals/packages/glib/g_date_strftime.patch new file mode 100644 index 000000000..532c74327 --- /dev/null +++ b/spack-repos/externals/packages/glib/g_date_strftime.patch @@ -0,0 +1,34 @@ +From 00148329967adb196138372771052a3f606a6ea3 Mon Sep 17 00:00:00 2001 +From: coypu +Date: Wed, 2 Mar 2016 19:43:10 +0200 +Subject: [PATCH 2/2] gdate: Suppress string format literal warning + +Newer versions of GCC emit an error here, but we know it's safe. +https://bugzilla.gnome.org/761550 +--- + glib/gdate.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/glib/gdate.c b/glib/gdate.c +index 4aece02..92c34d2 100644 +--- a/glib/gdate.c ++++ b/glib/gdate.c +@@ -2439,6 +2439,9 @@ win32_strftime_helper (const GDate *d, + * + * Returns: number of characters written to the buffer, or 0 the buffer was too small + */ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wformat-nonliteral" ++ + gsize + g_date_strftime (gchar *s, + gsize slen, +@@ -2549,3 +2552,5 @@ g_date_strftime (gchar *s, + return retval; + #endif + } ++ ++#pragma GCC diagnostic pop +-- +2.7.1 + diff --git a/spack-repos/externals/packages/glib/meson-gettext-2.66.patch b/spack-repos/externals/packages/glib/meson-gettext-2.66.patch new file mode 100644 index 000000000..2d58f6188 --- /dev/null +++ b/spack-repos/externals/packages/glib/meson-gettext-2.66.patch @@ -0,0 +1,30 @@ +--- a/meson.build ++++ b/meson.build +@@ -2003,9 +2003,10 @@ + # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible + # implementations. This could be extended if issues are found in some platforms. + libintl_deps = [] +-if cc.has_function('ngettext') ++gettext_opt = get_option('gettext') ++if ['auto', 'libc'].contains(gettext_opt) and cc.has_function('ngettext') + have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset') +-else ++elif ['auto', 'external'].contains(gettext_opt) + # First just find the bare library. + libintl = cc.find_library('intl', required : false) + # The bare library probably won't link without help if it's static. +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -9,6 +9,12 @@ + value : 'auto', + description : 'iconv implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libiconv\'; \'auto\' = \'Auto-detect which iconv is available\')') + ++option('gettext', ++ type : 'combo', ++ choices : ['auto', 'libc', 'external'], ++ value : 'auto', ++ description : 'gettext implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libintl\'; \'auto\' = \'Auto-detect which gettext is available\')') ++ + option('charsetalias_dir', + type : 'string', + value : '', diff --git a/spack-repos/externals/packages/glib/meson-gettext-2.70.patch b/spack-repos/externals/packages/glib/meson-gettext-2.70.patch new file mode 100644 index 000000000..de9e4fba6 --- /dev/null +++ b/spack-repos/externals/packages/glib/meson-gettext-2.70.patch @@ -0,0 +1,30 @@ +--- a/meson.build ++++ b/meson.build +@@ -2047,9 +2047,10 @@ endif + # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible + # implementations. This could be extended if issues are found in some platforms. + libintl_deps = [] +-if cc.has_function('ngettext', args : osx_ldflags) ++gettext_opt = get_option('gettext') ++if ['auto', 'libc'].contains(gettext_opt) and cc.has_function('ngettext', args : osx_ldflags) + have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset') +-else ++elif ['auto', 'external'].contains(gettext_opt) + # First just find the bare library. + libintl = cc.find_library('intl', required : false) + # The bare library probably won't link without help if it's static. +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -9,6 +9,12 @@ option('iconv', + value : 'auto', + description : 'iconv implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libiconv\'; \'auto\' = \'Auto-detect which iconv is available\')') + ++option('gettext', ++ type : 'combo', ++ choices : ['auto', 'libc', 'external'], ++ value : 'auto', ++ description : 'gettext implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libintl\'; \'auto\' = \'Auto-detect which gettext is available\')') ++ + option('charsetalias_dir', + type : 'string', + value : '', diff --git a/spack-repos/externals/packages/glib/meson-gettext.patch b/spack-repos/externals/packages/glib/meson-gettext.patch new file mode 100644 index 000000000..c0c13065e --- /dev/null +++ b/spack-repos/externals/packages/glib/meson-gettext.patch @@ -0,0 +1,34 @@ +--- a/meson.build ++++ b/meson.build +@@ -1916,10 +1916,14 @@ endif + # proxy-libintl subproject. + # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible + # implementations. This could be extended if issues are found in some platforms. +-if cc.has_function('ngettext') ++gettext_opt = get_option('gettext') ++found_gettext = false ++if ['auto', 'libc'].contains(gettext_opt) and cc.has_function('ngettext') + libintl = [] + have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset') +-else ++ found_gettext = true ++endif ++if not found_gettext and ['auto', 'external'].contains(gettext_opt) + libintl = cc.find_library('intl', required : false) + if not libintl.found() + libintl = subproject('proxy-libintl').get_variable('intl_dep') +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -9,6 +9,12 @@ option('iconv', + value : 'auto', + description : 'iconv implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libiconv\'; \'auto\' = \'Auto-detect which iconv is available\')') + ++option('gettext', ++ type : 'combo', ++ choices : ['auto', 'libc', 'external'], ++ value : 'auto', ++ description : 'gettext implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libintl\'; \'auto\' = \'Auto-detect which gettext is available\')') ++ + option('charsetalias_dir', + type : 'string', + value : '', diff --git a/spack-repos/externals/packages/glib/no-Werror=format-security.patch b/spack-repos/externals/packages/glib/no-Werror=format-security.patch new file mode 100644 index 000000000..3e70212b9 --- /dev/null +++ b/spack-repos/externals/packages/glib/no-Werror=format-security.patch @@ -0,0 +1,13 @@ +--- a/configure 2017-05-12 16:03:01.000000000 -0500 ++++ b/configure 2017-05-12 16:01:58.000000000 -0500 +@@ -29273,8 +29273,8 @@ + for flag in \ + -Wall -Wstrict-prototypes -Werror=declaration-after-statement \ + -Werror=missing-prototypes -Werror=implicit-function-declaration \ +- -Werror=pointer-arith -Werror=init-self -Werror=format-security \ +- -Werror=format=2 -Werror=missing-include-dirs; do ++ -Werror=pointer-arith -Werror=init-self \ ++ -Werror=missing-include-dirs; do + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports flag $flag in envvar CFLAGS" >&5 + $as_echo_n "checking if $CC supports flag $flag in envvar CFLAGS... " >&6; } diff --git a/spack-repos/externals/packages/glib/old-kernels.patch b/spack-repos/externals/packages/glib/old-kernels.patch new file mode 100644 index 000000000..406141032 --- /dev/null +++ b/spack-repos/externals/packages/glib/old-kernels.patch @@ -0,0 +1,16 @@ +--- a/gio/gfile.c 2018-06-11 15:28:30.527667202 -0500 ++++ b/gio/gfile.c 2018-03-12 11:23:37.000000000 -0500 +@@ -3014,11 +3014,11 @@ + + /* Try a 1MiB buffer for improved throughput. If that fails, use the default + * pipe size. See: https://bugzilla.gnome.org/791457 */ +- buffer_size = fcntl (buffer[1], F_SETPIPE_SZ, 1024 * 1024); ++ buffer_size = -1; + if (buffer_size <= 0) + { + int errsv; +- buffer_size = fcntl (buffer[1], F_GETPIPE_SZ); ++ buffer_size = 65536; + errsv = errno; + + if (buffer_size <= 0) diff --git a/spack-repos/externals/packages/glib/package.py b/spack-repos/externals/packages/glib/package.py new file mode 100644 index 000000000..63cb04fe7 --- /dev/null +++ b/spack-repos/externals/packages/glib/package.py @@ -0,0 +1,382 @@ +# Copyright 2013-2024 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.path + +from spack.package import * +from spack.util.environment import is_system_path + + +class Glib(MesonPackage, AutotoolsPackage): + """GLib provides the core application building blocks for + libraries and applications written in C. + + The GLib package contains a low-level libraries useful for + providing data structure handling for C, portability wrappers + and interfaces for such runtime functionality as an event loop, + threads, dynamic loading and an object system. + """ + + homepage = "https://developer.gnome.org/glib/" + url = "https://download.gnome.org/sources/glib/2.53/glib-2.53.1.tar.xz" + list_url = "https://download.gnome.org/sources/glib" + list_depth = 1 + + maintainers("michaelkuhn") + + license("LGPL-2.1-or-later") + + # Even minor versions are stable, odd minor versions are development, only add even numbers + version("2.86.1", sha256="119d1708ca022556d6d2989ee90ad1b82bd9c0d1667e066944a6d0020e2d5e57") + version("2.84.4", sha256="8a9ea10943c36fc117e253f80c91e477b673525ae45762942858aef57631bb90") + version("2.82.5", sha256="05c2031f9bdf6b5aba7a06ca84f0b4aced28b19bf1b50c6ab25cc675277cbc3f") + version("2.82.2", sha256="ab45f5a323048b1659ee0fbda5cecd94b099ab3e4b9abf26ae06aeb3e781fd63") + version("2.80.5", sha256="9f23a9de803c695bbfde7e37d6626b18b9a83869689dd79019bf3ae66c3e6771") + version("2.78.3", sha256="609801dd373796e515972bf95fc0b2daa44545481ee2f465c4f204d224b2bc21") + version("2.78.0", sha256="44eaab8b720877ce303c5540b657b126f12dc94972d9880b52959f43fb537b30") + version("2.76.6", sha256="1136ae6987dcbb64e0be3197a80190520f7acab81e2bfb937dc85c11c8aa9f04") + version("2.76.4", sha256="5a5a191c96836e166a7771f7ea6ca2b0069c603c7da3cba1cd38d1694a395dda") + version("2.76.3", sha256="c0be444e403d7c3184d1f394f89f0b644710b5e9331b54fa4e8b5037813ad32a") + version("2.76.2", sha256="24f3847857b1d8674cdb0389a36edec0f13c666cd3ce727ecd340eb9da8aca9e") + version("2.76.1", sha256="43dc0f6a126958f5b454136c4398eab420249c16171a769784486e25f2fda19f") + version("2.74.7", sha256="196ab86c27127a61b7a70c3ba6af7b97bdc01c07cd3b21abd5e778b955eccb1b") + version("2.74.6", sha256="069cf7e51cd261eb163aaf06c8d1754c6835f31252180aff5814e5afc7757fbc") + version("2.74.3", sha256="e9bc41ecd9690d9bc6a970cc7380119b828e5b6a4b16c393c638b3dc2b87cbcb") + version("2.74.1", sha256="0ab981618d1db47845e56417b0d7c123f81a3427b2b9c93f5a46ff5bbb964964") + version("2.74.0", sha256="3652c7f072d7b031a6b5edd623f77ebc5dcd2ae698598abcc89ff39ca75add30") + version("2.72.4", sha256="8848aba518ba2f4217d144307a1d6cb9afcc92b54e5c13ac1f8c4d4608e96f0e") + version("2.72.3", sha256="4a39a2f624b8512d500d5840173eda7fa85f51c109052eae806acece85d345f0") + version("2.72.2", sha256="78d599a133dba7fe2036dfa8db8fb6131ab9642783fc9578b07a20995252d2de") + version("2.72.1", sha256="c07e57147b254cef92ce80a0378dc0c02a4358e7de4702e9f403069781095fe2") + version("2.70.5", sha256="f70bf76ebcc84e0705722f038be8e2f9a58d17e1a700810c635fcc18b8974b7e") + version("2.70.4", sha256="ab3d176f3115dcc4e5d02db795984e04e4f4b48d836252e23e8c468e9d423c33") + version("2.70.2", sha256="0551459c85cd3da3d58ddc9016fd28be5af503f5e1615a71ba5b512ac945806f") + version("2.70.0", sha256="200d7df811c5ba634afbf109f14bb40ba7fde670e89389885da14e27c0840742") + version("2.68.4", sha256="62fd061d08a75492617e625a73e2c05e259f831acbb8e1f8b9c81f23f7993a3b") + version("2.68.3", sha256="e7e1a3c20c026109c45c9ec4a31d8dcebc22e86c69486993e565817d64be3138") + version("2.68.2", sha256="ecc7798a9cc034eabdfd7f246e6dd461cdbf1175fcc2e9867cc7da7b7309e0fb") + version("2.66.8", sha256="97bc87dd91365589af5cbbfea2574833aea7a1b71840fd365ecd2852c76b9c8b") + version("2.66.7", sha256="09f158769f6f26b31074e15b1ac80ec39b13b53102dfae66cfe826fb2cc65502") + version("2.66.6", sha256="80fff9c63d2725834328071c42003c311f77f91caf2285195c587c62f5638329") + version("2.66.2", sha256="ec390bed4e8dd0f89e918f385e8d4cfd7470b1ef7c1ce93ec5c4fc6e3c6a17c4") + version("2.64.6", sha256="c36ee07a70164c71f046016fe6aaacd6368333c42590bc0cba47c344ffb853f1") + version("2.64.5", sha256="9cbd5bd2715ead1c28d53c46f7b7b6ff6166f5887b772c1a9e3bf2910cfecc11") + version("2.64.4", sha256="f7e0b325b272281f0462e0f7fff25a833820cac19911ff677251daf6d87bce50") + version("2.64.3", sha256="fe9cbc97925d14c804935f067a3ad77ef55c0bbe9befe68962318f5a767ceb22") + version("2.64.2", sha256="9a2f21ed8f13b9303399de13a0252b7cbcede593d26971378ec6cb90e87f2277") + version("2.64.1", sha256="17967603bcb44b6dbaac47988d80c29a3d28519210b28157c2bd10997595bbc7") + version("2.62.6", sha256="104fa26fbefae8024ff898330c671ec23ad075c1c0bce45c325c6d5657d58b9c") + version("2.60.7", sha256="8b12c0af569afd3b71200556ad751bad4cf4bf7bc4b5f880638459a42ca86310") + version("2.58.3", sha256="8f43c31767e88a25da72b52a40f3301fefc49a665b56dc10ee7cc9565cbe7481") + version( + "2.56.4", + sha256="27f703d125efb07f8a743666b580df0b4095c59fc8750e8890132c91d437504c", + deprecated=True, + ) + version( + "2.56.3", + sha256="a9a4c5b4c81b6c75bc140bdf5e32120ef3ce841b7413214ecf5f987acec74cb2", + deprecated=True, + ) + version( + "2.56.2", + sha256="d64abd16813501c956c4e123ae79f47f1b58de573df9fdd3b0795f1e2c1aa789", + deprecated=True, + ) + version( + "2.56.1", + sha256="40ef3f44f2c651c7a31aedee44259809b6f03d3d20be44545cd7d177221c0b8d", + deprecated=True, + ) + version( + "2.56.0", + sha256="ecef6e17e97b8d9150d0e8a4b3edee1ac37331213b8a2a87a083deea408a0fc7", + deprecated=True, + ) + version( + "2.55.1", + sha256="0cbb3d31c9d181bbcc97cba3d9dbe3250f75e2da25e5f7c8bf5a993fe54baf6a", + deprecated=True, + ) + version( + "2.53.1", + sha256="c8740f1d1a138086eede889b596a511fddda180646ab2f1d98aed4fdb6be7f72", + deprecated=True, + ) + version( + "2.49.7", + sha256="0fd13406ca31d6f654c3be620e0adaaa4f9fb788e164e265e33edf4b21e64ef6", + deprecated=True, + ) + version( + "2.49.4", + sha256="9e914f9d7ebb88f99f234a7633368a7c1133ea21b5cac9db2a33bc25f7a0e0d1", + deprecated=True, + ) + version( + "2.48.1", + sha256="74411bff489cb2a3527bac743a51018841a56a4d896cc1e0d0d54f8166a14612", + deprecated=True, + ) + version( + "2.42.1", + sha256="8f3f0865280e45b8ce840e176ef83bcfd511148918cc8d39df2ee89b67dcf89a", + deprecated=True, + ) + + variant("libmount", default=False, description="Build with libmount support") + variant( + "tracing", + values=any_combination_of("dtrace", "systemtap"), + description="Enable tracing support", + ) + + build_system( + conditional("meson", when="@2.58:"), + conditional("autotools", when="@:2.57"), + default="meson", + ) + + with when("build_system=meson"): + depends_on("meson@0.60.0:", when="@2.73:", type="build") + depends_on("meson@0.52.0:", when="@2.71:2.72", type="build") + depends_on("meson@0.49.2:", when="@2.61.2:2.70", type="build") + depends_on("meson@0.48.0:", when="@:2.61.1", type="build") + + depends_on("py-packaging", type="build") + depends_on("pkgconfig", type="build") + depends_on("libffi") + depends_on("zlib-api") + depends_on("gettext") + depends_on("perl", type=("build", "run")) + + # Uses distutils in gio/gdbus-2.0/codegen/utils.py + + # JCF, Dec-17-2025: add this line from the spack-packages repo version + # of the package.py which allows Python 12 for newer versions of + # glib + depends_on("python@:3.11", type=("build", "run"), when="@:2.78") + depends_on("pcre2", when="@2.73.2:") + depends_on("pcre2@10.34:", when="@2.74:") + depends_on("pcre+utf", when="@2.48:2.73.1") + depends_on("uuid", when="+libmount") + depends_on("util-linux", when="+libmount") + depends_on("iconv") + depends_on("elf") # bin/gresource + + # The following patch is needed for gcc-6.1 + patch("g_date_strftime.patch", when="@2.42.1") + # Clang doesn't seem to acknowledge the pragma lines to disable the -Werror + # around a legitimate usage. + patch("no-Werror=format-security.patch", when="@:2.57") + # Patch to prevent compiler errors in kernels older than 2.6.35 + patch("old-kernels.patch", when="@2.56.0:2.56.1 os=rhel6") + patch("old-kernels.patch", when="@2.56.0:2.56.1 os=centos6") + patch("old-kernels.patch", when="@2.56.0:2.56.1 os=scientific6") + # fix multiple definition error in gio tests for 2.76.1 + patch( + "https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3368.diff", + sha256="fa31180b55a832cbb75cc640bb115b7b092a26d7bcf0f48768de55576f0a38d3", + when="@2.76.1", + ) + + # glib prefers the libc version of gettext, which breaks the build if the + # external version is also found. + patch("meson-gettext.patch", when="@2.58:2.64") + patch("meson-gettext-2.66.patch", when="@2.66:2.68,2.72") + patch("meson-gettext-2.70.patch", when="@2.70") + + # Don't use PTRACE_O_EXITKILL if it's not defined + patch( + "https://gitlab.gnome.org/GNOME/glib/-/commit/bda87264372c006c94e21ffb8ff9c50ecb3e14bd.diff", + sha256="2c25d7b3bf581b3ec992d7af997fa6c769174d49b9350e0320c33f5e048cba99", + when="@2.78.0", + ) + + def url_for_version(self, version): + """Handle glib's version-based custom URLs.""" + url = "https://download.gnome.org/sources/glib" + return url + "/%s/glib-%s.tar.xz" % (version.up_to(2), version) + + def patch(self): + """A few glib tests have external dependencies / try to access the X server""" + # Surgically disable tests which we cannot make pass in a spack build + gio_tests = FileFilter("gio/tests/meson.build") + gio_tests.filter("if not glib_have_cocoa", "if false") + gio_tests.filter("'contenttype' : {},", "") + gio_tests.filter("'file' : {},", "") + gio_tests.filter("'gdbus-peer'", "'file'") + gio_tests.filter("'gdbus-address-get-session' : {},", "") + filter_file("'mkenums.py'( : {})*,*", "", "gobject/tests/meson.build") + filter_file("'fileutils' : {},", "", "glib/tests/meson.build") + + @property + def libs(self): + return find_libraries(["libglib*"], root=self.prefix, recursive=True) + + +class BaseBuilder(metaclass=spack.builder.PhaseCallbacksMeta): + @property + def dtrace_copy_path(self): + return join_path(self.stage.source_path, "dtrace-copy") + + @run_before("install") + def fix_python_path(self): + if not self.spec.satisfies("@2.53.4:"): + return + + files = ["gobject/glib-genmarshal.in", "gobject/glib-mkenums.in"] + + filter_file( + "^#!/usr/bin/env @PYTHON@", + "#!/usr/bin/env {0}".format(os.path.basename(self.spec["python"].command.path)), + *files, + ) + + @run_before("install") + def fix_dtrace_usr_bin_path(self): + if "tracing=dtrace" not in self.spec: + return + + # dtrace may cause glib build to fail because it uses + # '/usr/bin/python' in the shebang. To work around that + # we copy the original script into a temporary folder, and + # change the shebang to '/usr/bin/env python' + dtrace = which("dtrace").path + dtrace_copy = join_path(self.dtrace_copy_path, "dtrace") + + with working_dir(self.dtrace_copy_path, create=True): + copy(dtrace, dtrace_copy) + filter_file( + "^#!/usr/bin/python", + "#!/usr/bin/env {0}".format(os.path.basename(self.spec["python"].command.path)), + dtrace_copy, + ) + + # To have our own copy of dtrace in PATH, we need to + # prepend to PATH the temporary folder where it resides + env["PATH"] = ":".join([self.dtrace_copy_path] + env["PATH"].split(":")) + + @run_after("install") + def filter_sbang(self): + # Revert sbang, so Spack's sbang hook can fix it up (we have to do + # this after install because otherwise the install target will try + # to rebuild files as filter_file updates the timestamps) + if self.spec.satisfies("@2.53.4:"): + pattern = "^#!/usr/bin/env {0}".format( + os.path.basename(self.spec["python"].command.path) + ) + repl = "#!{0}".format(self.spec["python"].command.path) + files = ["glib-genmarshal", "glib-mkenums"] + else: + pattern = "^#! /usr/bin/perl" + repl = "#!{0}".format(self.spec["perl"].command.path) + files = ["glib-mkenums"] + + files = [join_path(self.prefix.bin, file) for file in files] + filter_file(pattern, repl, *files, backup=False) + + @run_after("install") + def gettext_libdir(self): + # Packages that link to glib were also picking up -lintl from glib's + # glib-2.0.pc file. However, packages such as py-pygobject were + # bypassing spack's compiler wrapper for linking and thus not finding + # the gettext library directory. The patch below explicitly adds the + # appropriate -L path. + spec = self.spec + if ( + spec.satisfies("@2.0:2") + and "intl" in self.spec["gettext"].libs.names + and not is_system_path(spec["gettext"].prefix) + ): + pattern = "Libs:" + repl = "Libs: -L{0} -Wl,-rpath={0} ".format(spec["gettext"].libs.directories[0]) + myfile = join_path(self.spec["glib"].libs.directories[0], "pkgconfig", "glib-2.0.pc") + filter_file(pattern, repl, myfile, backup=False) + + +class MesonBuilder(BaseBuilder, spack.build_systems.meson.MesonBuilder): + def meson_args(self): + args = [] + if self.spec.satisfies("@2.63.5:"): + if "+libmount" in self.spec: + args.append("-Dlibmount=enabled") + else: + args.append("-Dlibmount=disabled") + else: + if "+libmount" in self.spec: + args.append("-Dlibmount=true") + else: + args.append("-Dlibmount=false") + if "tracing=dtrace" in self.spec: + args.append("-Ddtrace=true") + else: + args.append("-Ddtrace=false") + if "tracing=systemtap" in self.spec: + args.append("-Dsystemtap=true") + else: + args.append("-Dsystemtap=false") + if self.spec.satisfies("@2.59.0:"): + args.append("-Dselinux=disabled") + else: + args.append("-Dselinux=false") + args.append("-Dgtk_doc=false") + args.append("-Dlibelf=enabled") + + # arguments for older versions + if self.spec.satisfies("@:2.72"): + args.append("-Dgettext=external") + if self.spec.satisfies("@:2.74"): + if self.spec["iconv"].name == "libiconv": + if self.spec.satisfies("@2.61.0:"): + args.append("-Diconv=external") + else: + args.append("-Diconv=gnu") + else: + args.append("-Diconv=libc") + return args + + +class AutotoolsBuilder(BaseBuilder, spack.build_systems.autotools.AutotoolsBuilder): + def configure_args(self): + args = [] + if "+libmount" in self.spec: + args.append("--enable-libmount") + else: + args.append("--disable-libmount") + if self.spec.satisfies("@2.53.4:"): + args.append( + "--with-python={0}".format(os.path.basename(self.spec["python"].command.path)) + ) + if self.spec["iconv"].name == "libiconv": + args.append("--with-libiconv=gnu") + else: + args.append("--with-libiconv=maybe") + if self.spec.satisfies("@2.56:"): + for value in ("dtrace", "systemtap"): + if ("tracing=" + value) in self.spec: + args.append("--enable-" + value) + else: + args.append("--disable-" + value) + else: + if "tracing=dtrace" in self.spec or "tracing=systemtap" in self.spec: + args.append("--enable-tracing") + else: + args.append("--disable-tracing") + # SELinux is not available in Spack, so glib should not use it. + args.append("--disable-selinux") + # glib should not use the globally installed gtk-doc. Otherwise, + # gtk-doc can fail with Python errors such as "ImportError: No module + # named site". This is due to the fact that Spack sets PYTHONHOME, + # which can confuse the global Python installation used by gtk-doc. + args.append("--disable-gtk-doc-html") + # glib uses gtk-doc even though it should be disabled if it can find + # its binaries. Override the checks to use the true binary. + true = which("true") + args.append("GTKDOC_CHECK={0}".format(true)) + args.append("GTKDOC_CHECK_PATH={0}".format(true)) + args.append("GTKDOC_MKPDF={0}".format(true)) + args.append("GTKDOC_REBASE={0}".format(true)) + return args diff --git a/spack-repos/externals/packages/glog/package.py b/spack-repos/externals/packages/glog/package.py new file mode 100644 index 000000000..9e738a57c --- /dev/null +++ b/spack-repos/externals/packages/glog/package.py @@ -0,0 +1,52 @@ +# Copyright 2013-2024 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 Glog(CMakePackage): + """C++ implementation of the Google logging module.""" + + homepage = "https://github.com/google/glog" + url = "https://github.com/google/glog/archive/v0.3.5.tar.gz" + + license("BSD-3-Clause") + + version("0.6.0", sha256="8a83bf982f37bb70825df71a9709fa90ea9f4447fb3c099e1d720a439d88bad6") + version("0.4.0", sha256="f28359aeba12f30d73d9e4711ef356dc842886968112162bc73002645139c39c") + version("0.3.5", sha256="7580e408a2c0b5a89ca214739978ce6ff480b5e7d8d7698a2aa92fadc484d1e0") + version( + "0.3.4", + sha256="ce99d58dce74458f7656a68935d7a0c048fa7b4626566a71b7f4e545920ceb10", + deprecated=True, + ) + version( + "0.3.3", + sha256="544e178644bd9b454768c2c91716c3b8365cc5d47adfbdbaecd8cf3fa17adfcb", + deprecated=True, + ) + + depends_on("gflags") + depends_on("cmake", when="@3.26:", type="build") + + patch( + "update_cmake_minimum_required.patch", + sha256="86f2de72969e76c4132f35eadd2d6da984579e60fba929c5f597348ae1e1a62b" + ) + + def install(self, spec, prefix): + configure(f"--prefix={prefix}") + make() + make("install") + + @when("@0.3.5:") + def install(self, spec, prefix): + cmake_args = ["-DBUILD_SHARED_LIBS=TRUE"] + cmake_args.extend(std_cmake_args) + + with working_dir("spack-build", create=True): + cmake("..", *cmake_args) + make() + make("install") diff --git a/spack-repos/externals/packages/glog/update_cmake_minimum_required.patch b/spack-repos/externals/packages/glog/update_cmake_minimum_required.patch new file mode 100644 index 000000000..7755c5210 --- /dev/null +++ b/spack-repos/externals/packages/glog/update_cmake_minimum_required.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 846b444..4a0e579 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.16) ++cmake_minimum_required (VERSION 3.26) + project (glog + VERSION 0.6.0 + DESCRIPTION "C++ implementation of the Google logging module" +diff --git a/cmake/GetCacheVariables.cmake b/cmake/GetCacheVariables.cmake +index ead3589..7adfedc 100644 +--- a/cmake/GetCacheVariables.cmake ++++ b/cmake/GetCacheVariables.cmake +@@ -1,5 +1,5 @@ + cmake_policy (PUSH) +-cmake_policy (VERSION 3.3) ++cmake_policy (VERSION 3.26) + + include (CMakeParseArguments) + diff --git a/spack-repos/externals/packages/go-bootstrap/package.py b/spack-repos/externals/packages/go-bootstrap/package.py new file mode 100644 index 000000000..d9f1edd99 --- /dev/null +++ b/spack-repos/externals/packages/go-bootstrap/package.py @@ -0,0 +1,120 @@ +# Copyright 2013-2024 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 platform +import re + +from spack.package import * + +# THIS PACKAGE SHOULD NOT EXIST +# it exists to make up for the inability to: +# * use an external go compiler +# * have go depend on itself +# * have a sensible way to find gccgo without a dep on gcc + + +class GoBootstrap(Package): + """Old C-bootstrapped go to bootstrap real go""" + + homepage = "https://golang.org" + url = "https://go.dev/dl/go1.20.1.darwin-amd64.tar.gz" + + extendable = True + + maintainers("alecbcs") + + # JCF, Jan-5-2025 + # git is not needed as a dependency, see https://github.com/spack/spack/pull/45279 + #depends_on("git", type=("build", "link", "run")) + + executables = ["^go$"] + + # List binary go releases for multiple operating systems and architectures. + # These binary versions are not intended to stay up-to-date. Instead we + # should update these binary releases on a yearly schedule as + # bootstrapping requirements are modified by new releases of go. + go_releases = { + "1.20.6": { + "darwin": { + "amd64": "98a09c085b4c385abae7d35b9155195d5e584d14988347ac7f18e4cbe3b5ef3d", + "arm64": "1163be1998835a13f00dfc869a8e3cdebf86984ad41ff2fff43e35ac2a0d8344", + }, + "linux": { + "amd64": "b945ae2bb5db01a0fb4786afde64e6fbab50b67f6fa0eb6cfa4924f16a7ff1eb", + "arm64": "4e15ab37556e979181a1a1cc60f6d796932223a0f5351d7c83768b356f84429b", + "ppc64le": "a1b91a42a40bba54bfd5c96c23d72250e0c424038d0d2b5c7950b828b4905822", + }, + }, + "1.17.13": { + "darwin": { + "amd64": "c101beaa232e0f448fab692dc036cd6b4677091ff89c4889cc8754b1b29c6608", + "arm64": "e4ccc9c082d91eaa0b866078b591fc97d24b91495f12deb3dd2d8eda4e55a6ea", + }, + "linux": { + "amd64": "4cdd2bc664724dc7db94ad51b503512c5ae7220951cac568120f64f8e94399fc", + "arm64": "914daad3f011cc2014dea799bb7490442677e4ad6de0b2ac3ded6cee7e3f493d", + "ppc64le": "bd0763fb130f8412672ffe1e4a8e65888ebe2419e5caa9a67ac21e8c298aa254", + }, + }, + } + + # Normalize architectures returned by platform to those used by the + # Go project. + go_targets = { + "aarch64": "arm64", + "arm64": "arm64", + "ppc64le": "ppc64le", + "amd64": "amd64", + "x86_64": "amd64", + } + + # determine system os and architecture/target + os = platform.system().lower() + target = go_targets.get(platform.machine().lower(), platform.machine().lower()) + + license("BSD-3-Clause") + + # construct releases for current system configuration + for release in go_releases: + if os in go_releases[release] and target in go_releases[release][os]: + version(release, sha256=go_releases[release][os][target]) + provides(f"go-or-gccgo-bootstrap@{release}", when=f"@{release}") + + # When the user adds a go compiler using ``spack external find go-bootstrap``, + # this lets us get the version for packages.yaml. Then, the solver can avoid + # to build the bootstrap go compiler(for aarch64, it's only gccgo) from source: + @classmethod + def determine_version(cls, exe): + """Return the version of an externally provided go executable or ``None``""" + output = Executable(exe)("version", output=str, error=str) + match = re.search(r"go version go(\S+)", output) + return match.group(1) if match else None + + def url_for_version(self, version): + # allow maintainers to checksum multiple architectures via + # `spack checksum go-bootstrap@1.18.9-darwin-arm64` + match = re.search(r"(\S+)-(\S+)-(\S+)", str(version)) + if match: + version = match.group(1) + os = match.group(2) + target = match.group(3) + else: + os = self.os + target = self.target + + url = "https://go.dev/dl/go{0}.{1}-{2}.tar.gz" + return url.format(version, os, target) + + def install(self, spec, prefix): + install_tree(".", prefix) + + def setup_dependent_build_environment(self, env, dependent_spec): + """Set GOROOT_BOOTSTRAP: When using an external compiler, get its GOROOT env""" + if self.spec.external: + # Use the go compiler added by ``spack external find go-bootstrap``: + goroot = Executable(self.spec.prefix.bin.go)("env", "GOROOT", output=str) + else: + goroot = self.spec.prefix + env.set("GOROOT_BOOTSTRAP", goroot) diff --git a/spack-repos/externals/packages/go/misc-cgo-testcshared.patch b/spack-repos/externals/packages/go/misc-cgo-testcshared.patch new file mode 100644 index 000000000..17751df81 --- /dev/null +++ b/spack-repos/externals/packages/go/misc-cgo-testcshared.patch @@ -0,0 +1,11 @@ +--- misc/cgo/testcshared/test.bash.orig 2016-11-19 00:00:11.917000000 +0000 ++++ misc/cgo/testcshared/test.bash 2016-11-19 00:00:22.081000000 +0000 +@@ -107,7 +107,7 @@ + + # test0: exported symbols in shared lib are accessible. + # TODO(iant): using _shared here shouldn't really be necessary. +-$(go env CC) ${GOGCCFLAGS} -I ${installdir} -o testp main0.c libgo.$libext ++$(go env CC) ${GOGCCFLAGS} -I ${installdir} -o testp main0.c ./libgo.$libext + binpush testp + + output=$(run LD_LIBRARY_PATH=. ./testp) diff --git a/spack-repos/externals/packages/go/package.py b/spack-repos/externals/packages/go/package.py new file mode 100644 index 000000000..4fe0dde54 --- /dev/null +++ b/spack-repos/externals/packages/go/package.py @@ -0,0 +1,167 @@ +# Copyright 2013-2024 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 +import re + +from llnl.util import tty + +from spack.package import * + +# - vanilla CentOS 7, and possibly other systems, fail a test: +# TestCloneNEWUSERAndRemapRootDisableSetgroups +# +# The Fix, discussed here: https://github.com/golang/go/issues/16283 +# is to enable "user_namespace". +# +# On a Digital Ocean image, this can be achieved by updating +# `/etc/default/grub` so that the `GRUB_CMDLINE_LINUX` variable +# includes `user_namespace.enable=1`, re-cooking the grub +# configuration with `sudo grub2-mkconfig -o /boot/grub2/grub.cfg`, +# and then rebooting. +# +# - on CentOS 7 systems (and possibly others) you need to have the +# glibc package installed or various static cgo tests fail. +# + + +class Go(Package): + """The golang compiler and build environment""" + + homepage = "https://go.dev" + url = "https://go.dev/dl/go1.20.2.src.tar.gz" + git = "https://go.googlesource.com/go.git" + + extendable = True + executables = ["^go$"] + + maintainers("alecbcs") + + license("BSD-3-Clause") + + version("1.22.2", sha256="374ea82b289ec738e968267cac59c7d5ff180f9492250254784b2044e90df5a9") + version("1.22.1", sha256="79c9b91d7f109515a25fc3ecdaad125d67e6bdb54f6d4d98580f46799caea321") + version("1.22.0", sha256="4d196c3d41a0d6c1dfc64d04e3cc1f608b0c436bd87b7060ce3e23234e1f4d5c") + version("1.21.6", sha256="124926a62e45f78daabbaedb9c011d97633186a33c238ffc1e25320c02046248") + version("1.21.5", sha256="285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19") + + # Deprecated Versions + # https://nvd.nist.gov/vuln/detail/CVE-2023-44487 + version( + "1.21.3", + sha256="186f2b6f8c8b704e696821b09ab2041a5c1ee13dcbc3156a13adcf75931ee488", + deprecated=True, + ) + # https://nvd.nist.gov/vuln/detail/CVE-2023-39533 + version( + "1.20.6", + sha256="62ee5bc6fb55b8bae8f705e0cb8df86d6453626b4ecf93279e2867092e0b7f70", + deprecated=True, + ) + # https://nvd.nist.gov/vuln/detail/CVE-2023-29405 + version( + "1.20.4", + sha256="9f34ace128764b7a3a4b238b805856cc1b2184304df9e5690825b0710f4202d6", + deprecated=True, + ) + version( + "1.20.3", + sha256="e447b498cde50215c4f7619e5124b0fc4e25fb5d16ea47271c47f278e7aa763a", + deprecated=True, + ) + version( + "1.19.11", + sha256="e25c9ab72d811142b7f41ff6da5165fec2d1be5feec3ef2c66bc0bdecb431489", + deprecated=True, + ) + version( + "1.19.9", + sha256="131190a4697a70c5b1d232df5d3f55a3f9ec0e78e40516196ffb3f09ae6a5744", + deprecated=True, + ) + version( + "1.19.8", + sha256="1d7a67929dccafeaf8a29e55985bc2b789e0499cb1a17100039f084e3238da2f", + deprecated=True, + ) + # https://nvd.nist.gov/vuln/detail/CVE-2023-24538 + version( + "1.20.2", + sha256="4d0e2850d197b4ddad3bdb0196300179d095bb3aefd4dfbc3b36702c3728f8ab", + deprecated=True, + ) + version( + "1.19.7", + sha256="775bdf285ceaba940da8a2fe20122500efd7a0b65dbcee85247854a8d7402633", + deprecated=True, + ) + + provides("golang") + + # JCF, Jan-5-2025 + # git is not needed as a dependency, see https://github.com/spack/spack/pull/45279 + #depends_on("git", type="run") + depends_on("go-or-gccgo-bootstrap", type="build") + depends_on("go-or-gccgo-bootstrap@1.17.13:", type="build", when="@1.20:") + depends_on("go-or-gccgo-bootstrap@1.20.6:", type="build", when="@1.22:") + + phases = ["build", "install"] + + def url_for_version(self, version): + return f"https://go.dev/dl/go{version}.src.tar.gz" + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)("version", output=str, error=str) + match = re.search(r"go version go(\S+)", output) + return match.group(1) if match else None + + def setup_build_environment(self, env): + env.set("GOROOT_FINAL", self.spec.prefix) + # We need to set CC/CXX_FOR_TARGET, otherwise cgo will use the + # internal Spack wrappers and fail. + env.set("CC_FOR_TARGET", self.compiler.cc) + env.set("CXX_FOR_TARGET", self.compiler.cxx) + env.set("GOMAXPROCS", make_jobs) + + def build(self, spec, prefix): + bash = which("bash") + + with working_dir("src"): + bash(f"{'all' if self.run_tests else 'make'}.bash") + + def install(self, spec, prefix): + install_tree(".", prefix) + + def setup_dependent_package(self, module, dependent_spec): + """Called before go modules' build(), install() methods. + + In most cases, extensions will only need to set GOPATH and use go:: + + env['GOPATH'] = self.source_path + ':' + env['GOPATH'] + go('get', '', env=env) + install_tree('bin', prefix.bin) + """ + # Add a go command/compiler for extensions + module.go = self.spec["go"].command + + def generate_path_components(self, dependent_spec): + if os.environ.get("GOROOT", False): + tty.warn("GOROOT is set, this is not recommended") + + # Set to include paths of dependencies + path_components = [dependent_spec.prefix] + for d in dependent_spec.traverse(): + if d.package.extends(self.spec): + path_components.append(d.prefix) + return ":".join(path_components) + + def setup_dependent_build_environment(self, env, dependent_spec): + # This *MUST* be first, this is where new code is installed + env.prepend_path("GOPATH", self.generate_path_components(dependent_spec)) + + def setup_dependent_run_environment(self, env, dependent_spec): + # Allow packages to find this when using module files + env.prepend_path("GOPATH", self.generate_path_components(dependent_spec)) diff --git a/spack-repos/externals/packages/go/time_test.patch b/spack-repos/externals/packages/go/time_test.patch new file mode 100644 index 000000000..c3e0697c9 --- /dev/null +++ b/spack-repos/externals/packages/go/time_test.patch @@ -0,0 +1,18 @@ +diff --git a/src/time/time_test.go b/src/time/time_test.go +index 68236fd..2e47d08 100644 +--- a/src/time/time_test.go ++++ b/src/time/time_test.go +@@ -943,8 +943,11 @@ func TestLoadFixed(t *testing.T) { + // but Go and most other systems use "east is positive". + // So GMT+1 corresponds to -3600 in the Go zone, not +3600. + name, offset := Now().In(loc).Zone() +- if name != "GMT+1" || offset != -1*60*60 { +- t.Errorf("Now().In(loc).Zone() = %q, %d, want %q, %d", name, offset, "GMT+1", -1*60*60) ++ // The zone abbreviation is "-01" since tzdata-2016g, and "GMT+1" ++ // on earlier versions; we accept both. (Issue #17276). ++ if !(name == "GMT+1" || name == "-01") || offset != -1*60*60 { ++ t.Errorf("Now().In(loc).Zone() = %q, %d, want %q or %q, %d", ++ name, offset, "GMT+1", "-01", -1*60*60) + } + } + diff --git a/spack-repos/externals/packages/highfive/package.py b/spack-repos/externals/packages/highfive/package.py index acce6a9cd..40e20ccec 100644 --- a/spack-repos/externals/packages/highfive/package.py +++ b/spack-repos/externals/packages/highfive/package.py @@ -28,6 +28,7 @@ class Highfive(CMakePackage): patch('cmake_deps.patch', sha256='84200e200e56f90ce91f0bceb67494ebaf2a1f6c07d1c37d886701292b078d57', when='@2.7.1:') patch('remove_unreliable_warning_daq-release_issue420.patch', sha256='416728b1be85478faa4df752abf54a30b5ddb3ab4cc327e880db850c8d85f7c7') + patch('update_cmake_minimum_required.patch', sha256='18f67cd6b0a47c5421f0a901526c4a64d829d10ca04b76c666188f3d5d5cde66', when="@2.9.0") variant('mpi', default=False, description='Support MPI') variant('boost', default=False, description='Support Boost') diff --git a/spack-repos/externals/packages/highfive/update_cmake_minimum_required.patch b/spack-repos/externals/packages/highfive/update_cmake_minimum_required.patch new file mode 100644 index 000000000..f0c50f345 --- /dev/null +++ b/spack-repos/externals/packages/highfive/update_cmake_minimum_required.patch @@ -0,0 +1,32 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6949600..672e077 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) + if(${CMAKE_VERSION} VERSION_LESS 3.13) + cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) + else() +diff --git a/tests/test_dependent_library/CMakeLists.txt b/tests/test_dependent_library/CMakeLists.txt +index 570dba2..45354a5 100644 +--- a/tests/test_dependent_library/CMakeLists.txt ++++ b/tests/test_dependent_library/CMakeLists.txt +@@ -1,5 +1,5 @@ + # This is a sample library to test integration via add_subdirectory and CMakeConfig +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) + + project(test_project VERSION 0.1) + +diff --git a/tests/test_project/CMakeLists.txt b/tests/test_project/CMakeLists.txt +index 1a8ef09..a9e6733 100644 +--- a/tests/test_project/CMakeLists.txt ++++ b/tests/test_project/CMakeLists.txt +@@ -1,5 +1,5 @@ + # This is a sample project to test integration via add_subdirectory and CMakeConfig +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) + + project(test_project VERSION 0.1) + diff --git a/spack-repos/externals/packages/intel-tbb/disable-tm.patch b/spack-repos/externals/packages/intel-tbb/disable-tm.patch new file mode 100644 index 000000000..7ef0e93b7 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/disable-tm.patch @@ -0,0 +1,15 @@ +Disable transactional memory. This is needed for some AMD or very old +Intel systems. See issue #6090. + +diff -Naurb tbb-2018_U4.orig/include/tbb/tbb_config.h tbb-2018_U4/include/tbb/tbb_config.h +--- tbb-2018_U4.orig/include/tbb/tbb_config.h 2018-05-30 07:35:25.000000000 -0500 ++++ tbb-2018_U4/include/tbb/tbb_config.h 2018-07-24 16:26:11.662673434 -0500 +@@ -98,7 +98,7 @@ + #define __TBB_DEFINE_MIC 1 + #endif + +-#define __TBB_TSX_AVAILABLE ((__TBB_x86_32 || __TBB_x86_64) && !__TBB_DEFINE_MIC) ++#define __TBB_TSX_AVAILABLE 0 + + /** Presence of compiler features **/ + diff --git a/spack-repos/externals/packages/intel-tbb/gcc_13-2021-v2.patch b/spack-repos/externals/packages/intel-tbb/gcc_13-2021-v2.patch new file mode 100644 index 000000000..d1e87cd7c --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/gcc_13-2021-v2.patch @@ -0,0 +1,29 @@ +From b66c3b217f1954e31ea6f40a2416dd3264861c66 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Tue, 21 Feb 2023 09:36:33 +0000 +Subject: [PATCH] test: common: include for abort() (fix build with + GCC 13) + +GCC 13 (as usual for new compiler releases) shuffles around some +internal includes and so etc is no longer transitively included. + +See https://www.gnu.org/software/gcc/gcc-13/porting_to.html. + +Signed-off-by: Sam James +--- + test/common/utils_assert.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/test/common/utils_assert.h b/test/common/utils_assert.h +index 1df8ae72acc49fe38dac4d9bed4e9f4f26affcf5..0123ab881e124a800a5ebf8507050148038747d5 100644 +--- a/test/common/utils_assert.h ++++ b/test/common/utils_assert.h +@@ -20,6 +20,8 @@ + #include "config.h" + #include "utils_report.h" + ++#include ++ + #define REPORT_FATAL_ERROR REPORT + + namespace utils { diff --git a/spack-repos/externals/packages/intel-tbb/gcc_generic-pedantic-2019.patch b/spack-repos/externals/packages/intel-tbb/gcc_generic-pedantic-2019.patch new file mode 100644 index 000000000..760149341 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/gcc_generic-pedantic-2019.patch @@ -0,0 +1,29 @@ +From e125b22536eadcaba3c1f765c83f7bb687f9f51a Mon Sep 17 00:00:00 2001 +From: Chris Green +Date: Thu, 7 Mar 2019 11:16:00 -0600 +Subject: [PATCH] Remove superfluous semicolons to satisfy -pedantic. + +--- + include/tbb/machine/gcc_generic.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/tbb/machine/gcc_generic.h b/include/tbb/machine/gcc_generic.h +index 740cfd3..6a8d4b7 100644 +--- a/include/tbb/machine/gcc_generic.h ++++ b/include/tbb/machine/gcc_generic.h +@@ -216,9 +216,9 @@ struct machine_load_store_seq_cst { + + // __builtin_clz counts the number of leading zeroes + namespace tbb{ namespace internal { namespace gcc_builtins { +- inline int clz(unsigned int x){ return __builtin_clz(x); }; +- inline int clz(unsigned long int x){ return __builtin_clzl(x); }; +- inline int clz(unsigned long long int x){ return __builtin_clzll(x); }; ++ inline int clz(unsigned int x){ return __builtin_clz(x); } ++ inline int clz(unsigned long int x){ return __builtin_clzl(x); } ++ inline int clz(unsigned long long int x){ return __builtin_clzll(x); } + }}} + // logarithm is the index of the most significant non-zero bit + static inline intptr_t __TBB_machine_lg( uintptr_t x ) { +-- +2.20.1 + diff --git a/spack-repos/externals/packages/intel-tbb/gcc_generic-pedantic-4.4.patch b/spack-repos/externals/packages/intel-tbb/gcc_generic-pedantic-4.4.patch new file mode 100644 index 000000000..f86afde30 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/gcc_generic-pedantic-4.4.patch @@ -0,0 +1,29 @@ +From cdea634c02e1549408cf137e2766e8e3ee0c2b14 Mon Sep 17 00:00:00 2001 +From: Chris Green +Date: Thu, 7 Mar 2019 11:34:58 -0600 +Subject: [PATCH] Remove superfluous semicolons to satisfy -pedantic. + +--- + include/tbb/machine/gcc_generic.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/tbb/machine/gcc_generic.h b/include/tbb/machine/gcc_generic.h +index bd698a4..d970653 100644 +--- a/include/tbb/machine/gcc_generic.h ++++ b/include/tbb/machine/gcc_generic.h +@@ -107,9 +107,9 @@ __TBB_MACHINE_DEFINE_ATOMICS(8,int64_t) + #undef __TBB_MACHINE_DEFINE_ATOMICS + + namespace tbb{ namespace internal { namespace gcc_builtins { +- inline int clz(unsigned int x){ return __builtin_clz(x);}; +- inline int clz(unsigned long int x){ return __builtin_clzl(x);}; +- inline int clz(unsigned long long int x){ return __builtin_clzll(x);}; ++ inline int clz(unsigned int x){ return __builtin_clz(x);} ++ inline int clz(unsigned long int x){ return __builtin_clzl(x);} ++ inline int clz(unsigned long long int x){ return __builtin_clzll(x);} + }}} + //gcc __builtin_clz builtin count _number_ of leading zeroes + static inline intptr_t __TBB_machine_lg( uintptr_t x ) { +-- +2.20.1 + diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.2020.3-icx.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.2020.3-icx.patch new file mode 100644 index 000000000..58bc645df --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.2020.3-icx.patch @@ -0,0 +1,21 @@ +diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc +index d820c15d..a20d52ba 100644 +--- a/build/linux.gcc.inc ++++ b/build/linux.gcc.inc +@@ -54,14 +54,14 @@ endif + ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([5-9]|1[0-9])")) + # enable -Wsuggest-override via a pre-included header in order to limit to C++11 and above + INCLUDE_TEST_HEADERS = -include $(tbb_root)/src/test/harness_preload.h +- WARNING_SUPPRESS += -Wno-sized-deallocation ++ #WARNING_SUPPRESS += -Wno-sized-deallocation + endif + + # gcc 6.0 and later have -flifetime-dse option that controls + # elimination of stores done outside the object lifetime + ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9]|1[0-9])")) + # keep pre-contruction stores for zero initialization +- DSE_KEY = -flifetime-dse=1 ++ #DSE_KEY = -flifetime-dse=1 + endif + + ifeq ($(cfg), release) diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch new file mode 100644 index 000000000..beeaa15e7 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch @@ -0,0 +1,41 @@ +diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc +--- spack-src/build/linux.gcc.inc 2018-03-30 11:55:05.000000000 -0400 ++++ spack-src.patched/build/linux.gcc.inc 2021-07-22 10:41:47.712124058 -0400 +@@ -27,7 +27,9 @@ + WARNING_KEY = -Wall + TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor + +-WARNING_SUPPRESS = -Wno-parentheses -Wno-non-virtual-dtor ++# Skip for nvhpc compilers ++# WARNING_SUPPRESS = -Wno-parentheses -Wno-non-virtual-dtor ++WARNING_SUPPRESS = + DYLIB_KEY = -shared + EXPORT_KEY = -Wl,--version-script, + LIBDL = -ldl +@@ -62,10 +64,11 @@ + + # gcc 6.0 and later have -flifetime-dse option that controls + # elimination of stores done outside the object lifetime +-ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])")) +- # keep pre-contruction stores for zero initialization +- DSE_KEY = -flifetime-dse=1 +-endif ++# Skip for nvhpc compilers ++#ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])")) ++# # keep pre-contruction stores for zero initialization ++# DSE_KEY = -flifetime-dse=1 ++#endif + + ifeq ($(cfg), release) + CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD +@@ -148,7 +151,9 @@ + # Setting tbbmalloc data. + #------------------------------------------------------------------------------ + +-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++# Drop -fno-rtti for nvhpc compilers ++#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions + + #------------------------------------------------------------------------------ + # End of setting tbbmalloc data. diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch new file mode 100644 index 000000000..d561a82de --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch @@ -0,0 +1,41 @@ +diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc +--- spack-src/build/linux.gcc.inc 2019-03-21 11:28:21.000000000 -0400 ++++ spack-src.patched/build/linux.gcc.inc 2021-07-28 16:02:11.714975264 -0400 +@@ -29,7 +29,9 @@ + WARNING_KEY = -Wall + TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor + +-WARNING_SUPPRESS = -Wno-parentheses ++# Skip for nvhpc compilers ++#WARNING_SUPPRESS = -Wno-parentheses ++WARNING_SUPPRESS = + DYLIB_KEY = -shared + EXPORT_KEY = -Wl,--version-script, + LIBDL = -ldl +@@ -63,10 +65,11 @@ + + # gcc 6.0 and later have -flifetime-dse option that controls + # elimination of stores done outside the object lifetime +-ifneq (,$(shell $(CONLY) -dumpversion | egrep "^([6-9])")) +- # keep pre-contruction stores for zero initialization +- DSE_KEY = -flifetime-dse=1 +-endif ++# Skip for nvhpc compilers ++#ifneq (,$(shell $(CONLY) -dumpversion | egrep "^([6-9])")) ++# # keep pre-contruction stores for zero initialization ++# DSE_KEY = -flifetime-dse=1 ++#endif + + ifeq ($(cfg), release) + CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD +@@ -149,7 +152,9 @@ + # Setting tbbmalloc data. + #------------------------------------------------------------------------------ + +-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++# Drop -fno-rtti flag for nvhpc compilers ++#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions + + #------------------------------------------------------------------------------ + # End of setting tbbmalloc data. diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch new file mode 100644 index 000000000..e7045f03a --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch @@ -0,0 +1,41 @@ +diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc +--- spack-src/build/linux.gcc.inc 2019-05-23 06:35:29.000000000 -0400 ++++ spack-src.patched/build/linux.gcc.inc 2021-07-28 16:09:17.574383383 -0400 +@@ -25,7 +25,9 @@ + WARNING_KEY = -Wall + TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor + +-WARNING_SUPPRESS = -Wno-parentheses ++# Skip for nvhpc compilers ++#WARNING_SUPPRESS = -Wno-parentheses ++WARNING_SUPPRESS = + DYLIB_KEY = -shared + EXPORT_KEY = -Wl,--version-script, + LIBDL = -ldl +@@ -59,10 +61,11 @@ + + # gcc 6.0 and later have -flifetime-dse option that controls + # elimination of stores done outside the object lifetime +-ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9])")) +- # keep pre-contruction stores for zero initialization +- DSE_KEY = -flifetime-dse=1 +-endif ++# Skip for nvhpc compilers ++#ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9])")) ++# # keep pre-contruction stores for zero initialization ++# DSE_KEY = -flifetime-dse=1 ++#endif + + ifeq ($(cfg), release) + CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD +@@ -145,7 +148,9 @@ + # Setting tbbmalloc data. + #------------------------------------------------------------------------------ + +-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++# Drop -fno-rtti flag for nvhpc compilers ++#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions + + #------------------------------------------------------------------------------ + # End of setting tbbmalloc data. diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch new file mode 100644 index 000000000..4bc846276 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch @@ -0,0 +1,43 @@ +diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc +--- spack-src/build/linux.gcc.inc 2020-07-10 09:18:01.000000000 -0400 ++++ spack-src.patched/build/linux.gcc.inc 2021-07-28 15:32:43.640185318 -0400 +@@ -25,7 +25,9 @@ + WARNING_KEY = -Wall + TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor + +-WARNING_SUPPRESS = -Wno-parentheses ++# Skip for nvhpc compilers ++# WARNING_SUPPRESS = -Wno-parentheses ++WARNING_SUPPRESS = + DYLIB_KEY = -shared + EXPORT_KEY = -Wl,--version-script, + LIBDL = -ldl +@@ -57,12 +59,11 @@ + WARNING_SUPPRESS += -Wno-sized-deallocation + endif + +-# gcc 6.0 and later have -flifetime-dse option that controls +-# elimination of stores done outside the object lifetime +-ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9]|1[0-9])")) +- # keep pre-contruction stores for zero initialization +- DSE_KEY = -flifetime-dse=1 +-endif ++#Skip for nvhpc compilers ++#ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9]|1[0-9])")) ++# # keep pre-contruction stores for zero initialization ++# DSE_KEY = -flifetime-dse=1 ++#endif + + ifeq ($(cfg), release) + # -g is set intentionally in the release mode. It should not affect performance. +@@ -149,7 +150,9 @@ + # Setting tbbmalloc data. + #------------------------------------------------------------------------------ + +-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++# Drop -fno-rtti for nvhpc compilers ++# M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions + + #------------------------------------------------------------------------------ + # End of setting tbbmalloc data. diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch new file mode 100644 index 000000000..eb1ffff9a --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch @@ -0,0 +1,41 @@ +diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc +--- spack-src/build/linux.gcc.inc 2018-08-29 10:37:51.000000000 -0400 ++++ spack-src.patched/build/linux.gcc.inc 2021-07-28 15:52:03.235813820 -0400 +@@ -27,7 +27,9 @@ + WARNING_KEY = -Wall + TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor + +-WARNING_SUPPRESS = -Wno-parentheses ++# Skip for nvhpc compilers ++#WARNING_SUPPRESS = -Wno-parentheses ++WARNING_SUPPRESS = + DYLIB_KEY = -shared + EXPORT_KEY = -Wl,--version-script, + LIBDL = -ldl +@@ -63,10 +65,11 @@ + + # gcc 6.0 and later have -flifetime-dse option that controls + # elimination of stores done outside the object lifetime +-ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])")) +- # keep pre-contruction stores for zero initialization +- DSE_KEY = -flifetime-dse=1 +-endif ++# Skip for nvhpc compilers ++#ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])")) ++# # keep pre-contruction stores for zero initialization ++# DSE_KEY = -flifetime-dse=1 ++#endif + + ifeq ($(cfg), release) + CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD +@@ -149,7 +152,9 @@ + # Setting tbbmalloc data. + #------------------------------------------------------------------------------ + +-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++# Drop -fno-rtti flag for nvhpc compilers ++#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions ++M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions + + #------------------------------------------------------------------------------ + # End of setting tbbmalloc data. diff --git a/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch new file mode 100644 index 000000000..eb5dc4779 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch @@ -0,0 +1,14 @@ +diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc +--- spack-src/build/linux.gcc.inc 2018-03-30 11:55:05.000000000 -0400 ++++ spack-src.patched/build/linux.gcc.inc 2021-07-22 15:58:22.876292608 -0400 +@@ -17,7 +17,9 @@ + # + + COMPILE_ONLY = -c -MMD +-PREPROC_ONLY = -E -x c++ ++# For nvc++, need --no_preincludes as well to avoid issues with ++# pre-included content interfering with version scripts, etc. ++PREPROC_ONLY = -E -x c++ --no_preincludes + INCLUDE_KEY = -I + DEFINE_KEY = -D + OUTPUT_KEY = -o # diff --git a/spack-repos/externals/packages/intel-tbb/macos-arm64.patch b/spack-repos/externals/packages/intel-tbb/macos-arm64.patch new file mode 100644 index 000000000..7169abed3 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/macos-arm64.patch @@ -0,0 +1,32 @@ +From 86f6dcdc17a8f5ef2382faaef860cfa5243984fe Mon Sep 17 00:00:00 2001 +From: Yining Karl Li +Date: Fri, 3 Jul 2020 06:23:18 -0700 +Subject: [PATCH] Add detection of arm64 architecture for macos builds + +This commit adds detection of arm64 for macos builds on arm64 hardware. +The only change necessary is an additional case in the code where +macos.inc queries and detects the system architecture. +--- + build/macos.inc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/build/macos.inc b/build/macos.inc +index dde93216f5e7a9337dd83757df1ec734241d044e..2bdcde7e3042390b871fc601a930b3648ccaa124 100644 +--- a/build/macos.inc ++++ b/build/macos.inc +@@ -36,11 +36,15 @@ ifndef arch + export arch:=ppc32 + endif + else ++ ifeq ($(shell /usr/sbin/sysctl -n hw.machine),arm64) ++ export arch:=arm64 ++ else + ifeq ($(shell /usr/sbin/sysctl -n hw.optional.x86_64 2>/dev/null),1) + export arch:=intel64 + else + export arch:=ia32 + endif ++ endif + endif + endif + diff --git a/spack-repos/externals/packages/intel-tbb/makefile-debug.patch b/spack-repos/externals/packages/intel-tbb/makefile-debug.patch new file mode 100644 index 000000000..8db5e2b98 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/makefile-debug.patch @@ -0,0 +1,42 @@ +The debug targets were removed starting with rev 2020. +This patch restores them. + + +--- tbb-2020/Makefile.orig 2019-12-18 02:42:41.000000000 -0600 ++++ tbb-2020/Makefile 2020-02-09 00:27:17.058452442 -0600 +@@ -26,15 +26,19 @@ + all: tbb tbbmalloc tbbproxy test examples + + tbb: mkdir ++ $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbb cfg=debug + $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbb cfg=release + + tbbmalloc: mkdir ++ $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc + $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc + + tbbproxy: mkdir ++ $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbproxy cfg=debug tbbproxy + $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbproxy cfg=release tbbproxy + + tbbbind: mkdir ++ $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.tbbbind cfg=debug tbbbind + $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.tbbbind cfg=release tbbbind + + test: tbb tbbmalloc $(if $(use_proxy),tbbproxy) +@@ -42,6 +46,7 @@ + -$(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.test cfg=release + + rml: mkdir ++ $(MAKE) -C "$(work_dir)_debug" -r -f $(tbb_root)/build/Makefile.rml cfg=debug + $(MAKE) -C "$(work_dir)_release" -r -f $(tbb_root)/build/Makefile.rml cfg=release + + examples: tbb tbbmalloc +@@ -64,6 +69,7 @@ + $(shell $(MAKE) -s -i -r -C examples -f Makefile tbb_root=.. clean >$(NUL) 2>$(NUL)) + + mkdir: ++ $(shell $(MD) "$(work_dir)_debug" >$(NUL) 2>$(NUL)) + $(shell $(MD) "$(work_dir)_release" >$(NUL) 2>$(NUL)) + @echo Created the $(work_dir)_release directory + diff --git a/spack-repos/externals/packages/intel-tbb/package.py b/spack-repos/externals/packages/intel-tbb/package.py new file mode 100644 index 000000000..3b904abd7 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/package.py @@ -0,0 +1,327 @@ +# Copyright 2013-2024 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 glob +import inspect +import platform +import sys + +import spack.build_systems.cmake +import spack.build_systems.makefile +from spack.package import * + + +class IntelTbb(CMakePackage, MakefilePackage): + """Widely used C++ template library for task parallelism. + Intel Threading Building Blocks (Intel TBB) lets you easily write parallel + C++ programs that take full advantage of multicore performance, that are + portable and composable, and that have future-proof scalability. + """ + + homepage = "https://www.threadingbuildingblocks.org/" + url_prefix = "https://github.com/oneapi-src/oneTBB/" + url = url_prefix + "archive/v2020.1.tar.gz" + git = "https://github.com/oneapi-src/oneTBB.git" + + maintainers("rscohn2") + + # Note: when adding new versions, please check and update the + # patches, filters and url_for_version() below as needed. + + license("Apache-2.0") + + version("master", branch="master") + version("2021.9.0", sha256="1ce48f34dada7837f510735ff1172f6e2c261b09460e3bf773b49791d247d24e") + version("2021.8.0", sha256="eee380323bb7ce864355ed9431f85c43955faaae9e9bce35c62b372d7ffd9f8b") + version("2021.7.0", sha256="2cae2a80cda7d45dc7c072e4295c675fff5ad8316691f26f40539f7e7e54c0cc") + version("2021.6.0", sha256="4897dd106d573e9dacda8509ca5af1a0e008755bf9c383ef6777ac490223031f") + version("2021.5.0", sha256="e5b57537c741400cf6134b428fc1689a649d7d38d9bb9c1b6d64f092ea28178a") + version("2021.4.0", sha256="021796c7845e155e616f5ecda16daa606ebb4c6f90b996e5c08aebab7a8d3de3") + version("2021.3.0", sha256="8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e") + version("2021.2.0", sha256="cee20b0a71d977416f3e3b4ec643ee4f38cedeb2a9ff015303431dd9d8d79854") + version("2021.1.1", sha256="b182c73caaaabc44ddc5ad13113aca7e453af73c1690e4061f71dfe4935d74e8") + version("2020.3", sha256="ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3") + version("2020.2", sha256="4804320e1e6cbe3a5421997b52199e3c1a3829b2ecb6489641da4b8e32faf500") + version("2020.1", sha256="7c96a150ed22bc3c6628bc3fef9ed475c00887b26d37bca61518d76a56510971") + version("2020.0", sha256="57714f2d2cf33935db33cee93af57eb3ecd5a7bef40c1fb7ca4a41d79684b118") + version("2019.9", sha256="3f5ea81b9caa195f1967a599036b473b2e7c347117330cda99b79cfcf5b77c84") + version("2019.8", sha256="6b540118cbc79f9cbc06a35033c18156c21b84ab7b6cf56d773b168ad2b68566") + version("2019.7", sha256="94847fc627ed081c63ea253e31f23645ed3671548106b095ce303d1da5d76275") + version("2019.6", sha256="21cd496ac768560e70d35e5423878aa3bcf0285f7194be77935d8febf0b18f47") + version("2019.5", sha256="abf9236e6ec9a3675fa59ab56c2192c7ab4f7096a82af118e8efa514b2541578") + version("2019.4", sha256="673e540aba6e526b220cbeacc3e4ff7b19a8689a00d7a09a9dc94396d73b24df") + version("2019.3", sha256="4cb6bde796ae056e7c29f31bfdc6cfd0cfe848925219e9c82a20f09158e81542") + version("2019.2", sha256="3bbe21054bd5b593ef99d4dfe451432cbf1f6f9429cd0dd543e879ef7e4e3327") + version("2019.1", sha256="e6fb8dd1a1ae834b4e5f4ae6c4c87a3362f81a3aaeddfa6325168c6cfee59391") + version("2019", sha256="91f00308a4e431bd9632b439d516134d7084f1eb35f52b7c9b111b46bdfcf093") + version("2018.6", sha256="0ebb5fc877871ef15f7395d6e3c86de4ffedb820dc336383a3ab71fc39426aa7") + version("2018.5", sha256="b8dbab5aea2b70cf07844f86fa413e549e099aa3205b6a04059ca92ead93a372") + version("2018.4", sha256="c973b41b6da3db10efa7e14ce64a850e3fbfbcc16374494a005bf994d53a770a") + version("2018.3", sha256="e5f19d747f6adabfc7daf2cc0a1ddcfab0f26bc083d70ea0a63def4a9f3919c5") + version("2018.2", sha256="733c4dba646573b8285b1923dc106f0d771725bea620baa3659c86ab9312a1f4") + version("2018.1", sha256="a9f51e0d081fbdda441d0150e759c7562318d6d7bc5a0c9a9d8064217d4d8d8d") + version("2018", sha256="d427c58a59863c5f9510fffb3d05cd1bcc7abb94cdde1613407559e88b1263ab") + version("2017.8", sha256="227cc1a8329da67f9957285f0020ad4d73d9ce26cbf88614349b8b74bb189ae1") + version("2017.7", sha256="f487243e5931e967479189ef75946f02e3bb666ea73dcc19ac2828edd5550746") + version("2017.6", sha256="b0f40edd010b90ce2519c1cebfa6f33216a1828d4fba19291b5cd23bd7fe809b") + version("2017.5", sha256="b785e7181317350f0bb20f7bffda20bdecde7e82b824d2e5eb6d408a3b9cbeaf") + version("2017.4", sha256="9a70ae3068767bf8c530bf98b9bbc655e36e82a301b347f7de76f99f401df1dd") + version("2017.3", sha256="230ed3ff32bb3e91df1f59e4a3a567bde02639d9970b7e87cee0421b4c0b0f23") + version("2017.2", sha256="dd37c896f95ca2357e828c24c9c4a169c6a6b5c905b3862a6cab09474d164497") + version("2017.1", sha256="9b5b36b6d0ed97a3a1711b9095e78aed79bc998957a4a6b3d8a7af063523f037") + version("2017", sha256="470544b0f374987273cc12e7706353edba8f9547578291d45b5b29358d4e5e81") + version("4.4.6", sha256="65101b3a0eda38320ec3e3603daa79c54e6a60fb59ed2959738eaf4ce6d17f0a") + version("4.4.5", sha256="2e372703fe444442c77760229897f00bb4babff62f7d0861b3f2783883cb257e") + version("4.4.4", sha256="3ed03838c4e368b78305b0561cac48d369919bb4d9d68edd4d8a3becd6f62f5c") + version("4.4.3", sha256="f0ff2e3735c8057b792f29c96f4f7623c1e4c76abfeda88be48645b8338c0f00") + version("4.4.2", sha256="1ab10e70354685cee3ddf614f3e291434cea86c8eb62031e025f4052278152ad") + version("4.4.1", sha256="05737bf6dd220b31aad63d77ca59c742271f81b4cc6643aa6f93d37450ae32b5") + version("4.4", sha256="93c74b6054c69c86fa49d0fce7c50061fc907cb198a7237b8dd058298fd40c0e") + + build_system( + conditional("makefile", when="@:2020.3"), + conditional("cmake", when="@2021:"), + default="cmake", + ) + + patch("update_cmake_minimum_required.patch", when="@2021.9.0", sha256="e01ee37f8d2c24adadc844d15e7c041d1a4b293183a02667b6b262b726003186") + + provides("tbb") + + # Clang builds incorrectly determine GCC version which in turn incorrectly + # causes a mismatch in C++ features resulting in a link error. This also + # means that clang builds require a gcc compiler to work correctly (this + # has always been the case). + # + # See https://github.com/intel/tbb/pull/147 for details. + # + conflicts("%apple-clang", when="@:2019.6", msg="2019.7 or later required for clang") + conflicts("%clang", when="@:2019.6", msg="2019.7 or later required for clang") + + conflicts("%gcc@6.1:", when="@:4.4.3", msg="4.4.4 or later required for GCC >= 6.1.") + + variant("shared", default=True, description="Builds a shared version of TBB libraries") + + variant( + "cxxstd", + default="default", + values=("default", "98", "11", "14", "17"), + multi=False, + description="Use the specified C++ standard when building.", + ) + + variant("tm", default=True, description="Enable use of transactional memory on x86") + + # Testing version ranges inside when clauses was fixed in e9ee9eaf. + # See: #8957 and #13989. + + # Build and install CMake config files if we're new enough. + # CMake support started in 2017.7. + depends_on("cmake@3.1.0:", type="build", when="@2017.7:") + + depends_on("hwloc", when="@2021.1.1:") + + # Patch for pedantic warnings (#10836). This was fixed in the TBB + # source tree in 2019.6. + patch("gcc_generic-pedantic-2019.patch", level=1, when="@2019.1:2019.5") + patch("gcc_generic-pedantic-4.4.patch", level=1, when="@:2019.0") + + # Patch and conflicts for GCC 13 support (#1031). + patch("gcc_13-2021-v2.patch", when="@2021.1:") + conflicts("%gcc@13", when="@:2021.3") + + # Patch cmakeConfig.cmake.in to find the libraries where we install them. + patch("tbb_cmakeConfig-2019.5.patch", level=0, when="@2019.5:2021.0") + patch("tbb_cmakeConfig.patch", level=0, when="@2017.7:2019.4") + + # Restore the debug targets. + patch("makefile-debug.patch", when="@2020:2021.0") + + # Some very old systems don't support transactional memory. + patch("disable-tm.patch", when="~tm") + + # Add support for building on arm64 macOS, + # also included in hombrew and already available upstream: + # https://github.com/oneapi-src/oneTBB/pull/258 + # https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1 + patch("macos-arm64.patch", when="@:2021.0") + + # build older tbb with %oneapi + patch("intel-tbb.2020.3-icx.patch", when="@2020.3 %oneapi") + + # Support for building with %nvhpc + # 1) remove flags nvhpc compilers do not recognize + patch("intel-tbb.nvhpc-remove-flags.2017.patch", when="@2017:2018.9 %nvhpc") + patch("intel-tbb.nvhpc-remove-flags.2019.patch", when="@2019:2019.0 %nvhpc") + patch("intel-tbb.nvhpc-remove-flags.2019.1.patch", when="@2019.1:2019.6 %nvhpc") + patch("intel-tbb.nvhpc-remove-flags.2019.7.patch", when="@2019.7:2019.8 %nvhpc") + # The 2019.9 patch below was tested successfully + # on @2019.9, @2020.0, and @2020.3 + patch("intel-tbb.nvhpc-remove-flags.2019.9.patch", when="@2019.9: %nvhpc") + # 2) Fix generation of version script tbb.def for ld (nvc++ -E + # appears to produce more output than g++ -E which was causing problems) + # The 2017 patch below was tested on @2017, @2017.8, @2018, + # @2018.3, @2018.6, 2019, @2019.[1-9], and @2020.[0-3] + patch("intel-tbb.nvhpc-version-script-fix.2017.patch", when="@2017 %nvhpc") + + # Version and tar file names: + # 2020.0 --> v2020.0.tar.gz starting with 2020 + # 2017.1 --> 2017_U1.tar.gz starting with 2017 + # 2017 --> 2017.tar.gz + # 4.4.6 --> 4.4.6.tar.gz + # + def url_for_version(self, version): + url = self.url_prefix + "archive/{0}.tar.gz" + if version[0] >= 2020: + name = "v{0}".format(version) + elif version[0] >= 2017 and len(version) > 1: + name = "{0}_U{1}".format(version[0], version[1]) + else: + name = "{0}".format(version) + return url.format(name) + + @property + def libs(self): + shared = True if "+shared" in self.spec else False + return find_libraries("libtbb*", root=self.prefix, shared=shared, recursive=True) + + +class SetupEnvironment: + # We set OS here in case the user has it set to something else + # that TBB doesn't expect. + def setup_build_environment(self, env): + env.set("OS", platform.system()) + + +class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder, SetupEnvironment): + def cmake_args(self): + spec = self.spec + options = [ + self.define("CMAKE_HWLOC_2_INCLUDE_PATH", spec["hwloc"].prefix.include), + self.define("CMAKE_HWLOC_2_LIBRARY_PATH", spec["hwloc"].libs), + self.define("-DTBB_CPF", True), + self.define("TBB_STRICT", False), + ] + if spec.variants["cxxstd"].value != "default": + options.append(self.define("CMAKE_CXX_STANDARD", spec.variants["cxxstd"].value)) + return options + + @run_after("install") + def install_pkgconfig(self): + # pkg-config generation is introduced in May 5, 2021. + # It must not be overwritten by spack-generated tbb.pc. + # https://github.com/oneapi-src/oneTBB/commit/478de5b1887c928e52f029d706af6ea640a877be + if self.spec.satisfies("@:2021.2.0"): + mkdirp(self.prefix.lib.pkgconfig) + + with open(join_path(self.prefix.lib.pkgconfig, "tbb.pc"), "w") as f: + f.write("prefix={0}\n".format(self.prefix)) + f.write("exec_prefix=${prefix}\n") + f.write("libdir={0}\n".format(self.prefix.lib)) + f.write("includedir={0}\n".format(self.prefix.include)) + f.write("\n") + f.write("Name: Threading Building Blocks\n") + f.write("Description: Intel's parallelism library for C++\n") + f.write("Version: {0}\n".format(self.spec.version)) + f.write("Cflags: -I${includedir}\n") + f.write("Libs: -L${libdir} -ltbb -latomic\n") + + +class MakefileBuilder(spack.build_systems.makefile.MakefileBuilder, SetupEnvironment): + def coerce_to_spack(self, tbb_build_subdir): + for compiler in ["icc", "gcc", "clang"]: + fs = glob.glob(join_path(tbb_build_subdir, "*.%s.inc" % compiler)) + for f in fs: + lines = open(f).readlines() + of = open(f, "w") + for lin in lines: + if lin.strip().startswith("CPLUS ="): + of.write("# coerced to spack\n") + of.write("CPLUS = $(CXX)\n") + elif lin.strip().startswith("CONLY ="): + of.write("# coerced to spack\n") + of.write("CONLY = $(CC)\n") + else: + of.write(lin) + + def build(self, pkg, spec, prefix): + # Deactivate use of RTM with GCC when on an OS with a very old + # assembler. + if ( + spec.satisfies("%gcc@4.8.0: os=rhel6") + or spec.satisfies("%gcc@4.8.0: os=centos6") + or spec.satisfies("%gcc@4.8.0: os=scientific6") + ): + filter_file(r"RTM_KEY.*=.*rtm.*", "RTM_KEY =", join_path("build", "linux.gcc.inc")) + + # We need to follow TBB's compiler selection logic to get the proper + # build + link flags but we still need to use spack's compiler wrappers + # to accomplish this, we do two things: + # + # * Look at the spack spec to determine which compiler we should pass + # to tbb's Makefile; + # + # * patch tbb's build system to use the compiler wrappers (CC, CXX) for + # icc, gcc, clang (see coerce_to_spack()); + # + self.coerce_to_spack("build") + + if spec.satisfies("%clang") or spec.satisfies("%apple-clang") or spec.satisfies("%rocmcc"): + tbb_compiler = "clang" + elif spec.satisfies("%intel"): + tbb_compiler = "icc" + else: + tbb_compiler = "gcc" + + make_opts = [] + + # Static builds of TBB are enabled by including 'big_iron.inc' file + # See caveats in 'big_iron.inc' for limits on using TBB statically + # Lore states this file must be handed to make before other options + if "+shared" not in self.spec: + make_opts.append("extra_inc=big_iron.inc") + + if spec.variants["cxxstd"].value != "default": + make_opts.append("stdver=c++{0}".format(spec.variants["cxxstd"].value)) + + # + # tbb does not have a configure script or make install target + # we simply call make, and try to put the pieces together + # + make_opts.append("compiler={0}".format(tbb_compiler)) + make(*make_opts) + + def install(self, pkg, spec, prefix): + mkdirp(prefix) + mkdirp(prefix.lib) + + # install headers to {prefix}/include + install_tree("include", prefix.include) + + # install libs to {prefix}/lib + tbb_lib_names = ["libtbb", "libtbbmalloc", "libtbbmalloc_proxy"] + + for lib_name in tbb_lib_names: + # install release libs + install(join_path("build", "*release", lib_name + ".*"), prefix.lib) + # install debug libs if they exist + install(join_path("build", "*debug", lib_name + "_debug.*"), prefix.lib) + + if spec.satisfies("@2017.8,2018.1:"): + # Generate and install the CMake Config file. + cmake_args = ( + "-DTBB_ROOT={0}".format(prefix), + "-DTBB_OS={0}".format(platform.system()), + "-P", + "tbb_config_generator.cmake", + ) + with working_dir(join_path(self.stage.source_path, "cmake")): + inspect.getmodule(self).cmake(*cmake_args) + + @run_after("install") + def darwin_fix(self): + # Replace @rpath in ids with full path + if sys.platform == "darwin": + fix_darwin_install_name(self.prefix.lib) diff --git a/spack-repos/externals/packages/intel-tbb/tbb_cmakeConfig-2019.5.patch b/spack-repos/externals/packages/intel-tbb/tbb_cmakeConfig-2019.5.patch new file mode 100644 index 000000000..f75fd6fa4 --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/tbb_cmakeConfig-2019.5.patch @@ -0,0 +1,14 @@ +This patch adapts the tbb_cmakeConfig.patch for 2019.5 and later. +The file changed. + +--- cmake/TBBMakeConfig.cmake.orig 2019-03-21 10:28:21.000000000 -0500 ++++ cmake/TBBMakeConfig.cmake 2019-11-27 22:52:45.270824744 -0600 +@@ -175,7 +175,7 @@ + + ${TBB_CHOOSE_COMPILER_SUBDIR} + +-get_filename_component(_tbb_lib_path \"\${_tbb_root}/${TBB_SHARED_LIB_DIR}/\${_tbb_arch_subdir}/\${_tbb_compiler_subdir}\" ABSOLUTE) ++get_filename_component(_tbb_lib_path \"\${_tbb_root}/${TBB_SHARED_LIB_DIR}\" ABSOLUTE) + ") + + set(TBB_RELEASE_LIB_PATH "\${_tbb_lib_path}") diff --git a/spack-repos/externals/packages/intel-tbb/tbb_cmakeConfig.patch b/spack-repos/externals/packages/intel-tbb/tbb_cmakeConfig.patch new file mode 100644 index 000000000..a7a7ec24a --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/tbb_cmakeConfig.patch @@ -0,0 +1,11 @@ +--- cmake/templates/TBBConfig.cmake.in~ 2018-03-30 10:55:05.000000000 -0500 ++++ cmake/templates/TBBConfig.cmake.in 2018-05-25 10:25:52.498708945 -0500 +@@ -52,7 +52,7 @@ + + @TBB_CHOOSE_COMPILER_SUBDIR@ + +-get_filename_component(_tbb_lib_path "${_tbb_root}/@TBB_SHARED_LIB_DIR@/${_tbb_arch_subdir}/${_tbb_compiler_subdir}" ABSOLUTE) ++get_filename_component(_tbb_lib_path "${_tbb_root}/@TBB_SHARED_LIB_DIR@" ABSOLUTE) + + foreach (_tbb_component ${TBB_FIND_COMPONENTS}) + set(_tbb_release_lib "${_tbb_lib_path}/@TBB_LIB_PREFIX@${_tbb_component}.@TBB_LIB_EXT@") diff --git a/spack-repos/externals/packages/intel-tbb/update_cmake_minimum_required.patch b/spack-repos/externals/packages/intel-tbb/update_cmake_minimum_required.patch new file mode 100644 index 000000000..89adf530e --- /dev/null +++ b/spack-repos/externals/packages/intel-tbb/update_cmake_minimum_required.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a24287b1..8ea37278 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,7 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) + + # Enable CMake policies + diff --git a/spack-repos/externals/packages/krb5/freebsd-link.patch b/spack-repos/externals/packages/krb5/freebsd-link.patch new file mode 100644 index 000000000..76f49a44f --- /dev/null +++ b/spack-repos/externals/packages/krb5/freebsd-link.patch @@ -0,0 +1,11 @@ +--- a/src/config/shlib.conf ++++ b/src/config/shlib.conf +@@ -327,7 +327,7 @@ mips-*-netbsd*) + CC_LINK_SHARED='$(CC) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CFLAGS) $(LDFLAGS)' + CXX_LINK_SHARED='$(CXX) $(PROG_LIBPATH) $(PROG_RPATH_FLAGS) $(CXXFLAGS) $(LDFLAGS)' + SHLIBEXT=.so +- LDCOMBINE='ld -Bshareable' ++ LDCOMBINE='$(CC) -shared' + SHLIB_RPATH_FLAGS='--enable-new-dtags -rpath $(SHLIB_RDIRS)' + SHLIB_EXPFLAGS='$(SHLIB_RPATH_FLAGS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)' + CC_LINK_STATIC='$(CC) $(PROG_LIBPATH) $(CFLAGS) $(LDFLAGS)' diff --git a/spack-repos/externals/packages/krb5/mit-krb5-1.17-static-libs.patch b/spack-repos/externals/packages/krb5/mit-krb5-1.17-static-libs.patch new file mode 100644 index 000000000..cdf0a097b --- /dev/null +++ b/spack-repos/externals/packages/krb5/mit-krb5-1.17-static-libs.patch @@ -0,0 +1,15 @@ +--- src/lib/crypto/builtin/aes/Makefile.in.orig 2019-06-27 14:51:51.305688932 +0200 ++++ src/lib/crypto/builtin/aes/Makefile.in 2019-06-27 14:52:46.428203235 +0200 +@@ -34,10 +34,10 @@ + + all-unix: all-libobjs # aes-gen + +-iaesx64@SHOBJEXT@: $(srcdir)/iaesx64.s ++iaesx64.$(OBJEXT) iaesx64@SHOBJEXT@: $(srcdir)/iaesx64.s + $(YASM) $(AESNI_FLAGS) -o $@ $(srcdir)/iaesx64.s + +-iaesx86@SHOBJEXT@: $(srcdir)/iaesx86.s ++iaesx86.$(OBJEXT) iaesx86@SHOBJEXT@: $(srcdir)/iaesx86.s + $(YASM) $(AESNI_FLAGS) -o $@ $(srcdir)/iaesx86.s + + includes: depend diff --git a/spack-repos/externals/packages/krb5/package.py b/spack-repos/externals/packages/krb5/package.py new file mode 100644 index 000000000..93c8f3298 --- /dev/null +++ b/spack-repos/externals/packages/krb5/package.py @@ -0,0 +1,106 @@ +# Copyright 2013-2024 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 re + +from spack.package import * + + +class Krb5(AutotoolsPackage): + """Network authentication protocol""" + + homepage = "https://kerberos.org" + url = "https://kerberos.org/dist/krb5/1.16/krb5-1.16.1.tar.gz" + list_url = "https://kerberos.org/dist/krb5/" + list_depth = 1 + + license("MIT") + + version("1.21.3", sha256="b7a4cd5ead67fb08b980b21abd150ff7217e85ea320c9ed0c6dadd304840ad35") + version("1.20.1", sha256="704aed49b19eb5a7178b34b2873620ec299db08752d6a8574f95d41879ab8851") + version("1.19.4", sha256="41f5981c5a4de0a26b3937e679a116cd5b3739641fd253124aac91f7179b54eb") + version("1.19.3", sha256="56d04863cfddc9d9eb7af17556e043e3537d41c6e545610778676cf551b9dcd0") + version("1.19.2", sha256="10453fee4e3a8f8ce6129059e5c050b8a65dab1c257df68b99b3112eaa0cdf6a") + version("1.18.2", sha256="c6e4c9ec1a98141c3f5d66ddf1a135549050c9fab4e9a4620ee9b22085873ae0") + version("1.18.1", sha256="02a4e700f10936f937cd1a4c303cab8687a11abecc6107bd4b706b9329cd5400") + version("1.18", sha256="73913934d711dcf9d5f5605803578edb44b9a11786df3c1b2711f4e1752f2c88") + version("1.17.1", sha256="3706d7ec2eaa773e0e32d3a87bf742ebaecae7d064e190443a3acddfd8afb181") + version("1.17", sha256="5a6e2284a53de5702d3dc2be3b9339c963f9b5397d3fbbc53beb249380a781f5") + version("1.16.3", sha256="e40499df7c6dbef0cf9b11870a0e167cde827737d8b2c06a9436334f08ab9b0d") + version("1.16.2", sha256="9f721e1fe593c219174740c71de514c7228a97d23eb7be7597b2ae14e487f027") + version("1.16.1", sha256="214ffe394e3ad0c730564074ec44f1da119159d94281bbec541dc29168d21117") + + depends_on("diffutils", type="build") + depends_on("bison", type="build") + depends_on("openssl@:1", when="@:1.19") + depends_on("openssl") + depends_on("gettext") + depends_on("perl", type="build") + depends_on("findutils", type="build") + depends_on("pkgconfig", type="build", when="^openssl~shared") + + variant( + "shared", default=True, description="install shared libraries if True, static if false" + ) + # This patch is applied in newer upstream releases + patch("mit-krb5-1.17-static-libs.patch", level=0, when="@:1.18.9") + patch("freebsd-link.patch", when="platform=freebsd") + + configure_directory = "src" + build_directory = "src" + + executables = ["^krb5-config$"] + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)("--version", output=str, error=str) + match = re.search(r"Kerberos 5 release\s+(\S+)", output) + return match.group(1) if match else None + + def url_for_version(self, version): + url = "https://kerberos.org/dist/krb5/{0}/krb5-{1}.tar.gz" + return url.format(version.up_to(2), version) + + def patch(self): + # https://github.com/Homebrew/homebrew-core/blob/master/Formula/krb5.rb + # https://krbdev.mit.edu/rt/Ticket/Display.html?id=8928 + filter_file( + "void foo1() __attribute__((constructor));", + "#include \nvoid foo1() __attribute__((constructor));", + join_path(self.configure_directory, "configure"), + string=True, + ) + + def configure_args(self): + args = ["--without-system-verto"] + + if "~shared" in self.spec: + args.append("--enable-static") + args.append("--disable-shared") + else: + args.append("--disable-static") + + # https://github.com/spack/spack/issues/34193 + if "%gcc@10:" in self.spec: + args.append("CFLAGS=-fcommon") + + if self.spec["openssl"].satisfies("~shared"): + pkgconf = which("pkg-config") + ssllibs = pkgconf("--static", "--libs", "openssl", output=str) + args.append(f"LDFLAGS={ssllibs}") + + return args + + def flag_handler(self, name, flags): + if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names: + flags.append("-lintl") + + if name == "cflags": + if self.spec.satisfies("@:1.21.3 %gcc@15:"): + # gcc@15: is -std=gnu23 by default and + # up to at least 1.21.3 doesn't compile + flags.append("-std=gnu17") + + return inject_flags(name, flags) diff --git a/spack-repos/externals/packages/libjpeg-turbo/package.py b/spack-repos/externals/packages/libjpeg-turbo/package.py new file mode 100644 index 000000000..8ad4d03cc --- /dev/null +++ b/spack-repos/externals/packages/libjpeg-turbo/package.py @@ -0,0 +1,128 @@ +# Copyright 2013-2024 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 LibjpegTurbo(CMakePackage, AutotoolsPackage): + """libjpeg-turbo is a fork of the original IJG libjpeg which uses SIMD to + accelerate baseline JPEG compression and decompression. + + libjpeg is a library that implements JPEG image encoding, decoding and + transcoding. + """ + + maintainers("AlexanderRichert-NOAA") + + # https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md + homepage = "https://libjpeg-turbo.org/" + url = "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.3.tar.gz" + + license("BSD-3-Clause AND IJG AND Zlib") + + version("3.0.0", sha256="171dae5d73560bc94006a7c0c3281bd9bfde6a34f7e41e66f930a1a9162bd7df") + version("2.1.5.1", sha256="61846251941e5791005fb7face196eec24541fce04f12570c308557529e92c75") + version("2.1.5", sha256="254f3642b04e309fee775123133c6464181addc150499561020312ec61c1bf7c") + version("2.1.4", sha256="a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f") + version("2.1.3", sha256="dbda0c685942aa3ea908496592491e5ec8160d2cf1ec9d5fd5470e50768e7859") + version("2.1.2", sha256="e7fdc8a255c45bc8fbd9aa11c1a49c23092fcd7379296aeaeb14d3343a3d1bed") + version("2.1.1", sha256="20e9cd3e5f517950dfb7a300ad344543d88719c254407ffb5ad88d891bf701c4") + version("2.1.0", sha256="d6b7790927d658108dfd3bee2f0c66a2924c51ee7f9dc930f62c452f4a638c52") + version("2.0.6", sha256="005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371") + version("2.0.5", sha256="b3090cd37b5a8b3e4dbd30a1311b3989a894e5d3c668f14cbc6739d77c9402b7") + version("2.0.4", sha256="7777c3c19762940cff42b3ba4d7cd5c52d1671b39a79532050c85efb99079064") + version("2.0.3", sha256="a69598bf079463b34d45ca7268462a18b6507fdaa62bb1dfd212f02041499b5d") + version("2.0.2", sha256="b45255bd476c19c7c6b198c07c0487e8b8536373b82f2b38346b32b4fa7bb942") + version("1.5.90", sha256="cb948ade92561d8626fd7866a4a7ba3b952f9759ea3dd642927bc687470f60b7") + version( + "1.5.3", + sha256="1a17020f859cb12711175a67eab5c71fc1904e04b587046218e36106e07eabde", + deprecated=True, + ) + version( + "1.5.0", + sha256="232280e1c9c3e6a1de95fe99be2f7f9c0362ee08f3e3e48d50ee83b9a2ed955b", + deprecated=True, + ) + version( + "1.3.1", + sha256="5008aeeac303ea9159a0ec3ccff295434f4e63b05aed4a684c9964d497304524", + deprecated=True, + ) + + provides("jpeg") + + build_system( + conditional("autotools", when="@:1.5.3"), + conditional("cmake", when="@1.5.90:"), + default="cmake", + ) + + variant( + "libs", + default=("shared", "static"), + values=("shared", "static"), + multi=True, + description="Build shared libs, static libs, or both", + ) + variant("jpeg8", default=False, description="Emulate libjpeg v8 API/ABI") + variant( + "pic", default=True, description="Enable position independent code", when="libs=static" + ) + variant( + "partial_decoder", + default=False, + description="add partial_decode_scale functionality required for rocAL", + ) + + patch( + "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/09c71da06a6346dca132db66f26f959f7e4dd5ad.patch?full_index=1", + sha256="4d5bdfb5de5b04399144254ea383f5357ab7beb830b398aeb35b65f21dd6b4b0", + when="@2.0.6 +partial_decoder", + ) + patch( + "https://github.com/libjpeg-turbo/libjpeg-turbo/commit/640d7ee1917fcd3b6a5271aa6cf4576bccc7c5fb.patch?full_index=1", + sha256="dc1ec567c2356b652100ecdc28713bbf25f544e46f7d2947f31a2395c362cc48", + when="@2.0.6 +partial_decoder", + ) + + patch("update_cmake_minimum_required.patch", sha256="ca12cc0c064b99901525e1db6ea09b77d253cfc87c0d7b5510f9160f207fc214", when="@3.0.0") + + # Can use either of these. But in the current version of the package + # only nasm is used. In order to use yasm an environmental variable + # NASM must be set. + # TODO: Implement the selection between two supported assemblers. + # depends_on('yasm', type='build') + depends_on("nasm", type="build") + with when("build_system=autotools"): + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + + with when("build_system=cmake"): + depends_on("cmake", type="build", when="@1.5.90:") + + @property + def libs(self): + shared = self.spec.satisfies("libs=shared") + return find_libraries("libjpeg*", root=self.prefix, shared=shared, recursive=True) + + +class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): + def cmake_args(self): + args = [ + self.define("ENABLE_SHARED", self.spec.satisfies("libs=shared")), + self.define("ENABLE_STATIC", self.spec.satisfies("libs=static")), + self.define_from_variant("WITH_JPEG8", "jpeg8"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + ] + + return args + + @run_after("install") + def darwin_fix(self): + # The shared library is not installed correctly on Darwin; fix this + if self.spec.satisfies("platform=darwin") and ("+shared" in self.spec): + fix_darwin_install_name(self.prefix.lib) diff --git a/spack-repos/externals/packages/libjpeg-turbo/update_cmake_minimum_required.patch b/spack-repos/externals/packages/libjpeg-turbo/update_cmake_minimum_required.patch new file mode 100644 index 000000000..7ad01b1a2 --- /dev/null +++ b/spack-repos/externals/packages/libjpeg-turbo/update_cmake_minimum_required.patch @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index efd101a0..2048e84d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.8.12) ++cmake_minimum_required(VERSION 3.23.1...3.28) + # When using CMake 3.4 and later, don't export symbols from executables unless + # the CMAKE_ENABLE_EXPORTS variable is set. + if(POLICY CMP0065) diff --git a/spack-repos/externals/packages/libjpeg-turbo/update_cmake_minimum_required.patch.1 b/spack-repos/externals/packages/libjpeg-turbo/update_cmake_minimum_required.patch.1 new file mode 100644 index 000000000..65d091087 --- /dev/null +++ b/spack-repos/externals/packages/libjpeg-turbo/update_cmake_minimum_required.patch.1 @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f1312470..3f329e1d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.8.12...3.28) ++cmake_minimum_required(VERSION 3.23.1...3.28) + + if(CMAKE_EXECUTABLE_SUFFIX) + set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX}) diff --git a/spack-repos/externals/packages/libmng/package.py b/spack-repos/externals/packages/libmng/package.py new file mode 100644 index 000000000..fcc7aad56 --- /dev/null +++ b/spack-repos/externals/packages/libmng/package.py @@ -0,0 +1,33 @@ +# Copyright 2013-2024 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 Libmng(CMakePackage): + """THE reference library for reading, displaying, writing + and examining Multiple-Image Network Graphics. MNG is the animation + extension to the popular PNG image format.""" + + homepage = "https://sourceforge.net/projects/libmng/" + url = "http://downloads.sourceforge.net/project/libmng/libmng-devel/2.0.3/libmng-2.0.3.tar.gz" + + license("custom") + + version("2.0.3", sha256="cf112a1fb02f5b1c0fce5cab11ea8243852c139e669c44014125874b14b7dfaa") + version("2.0.2", sha256="4908797bb3541fb5cd8fffbe0b1513ed163509f2a4d57a78b26a96f8d1dd05a2") + + depends_on("jpeg") + depends_on("zlib-api") + depends_on("lcms") + + patch("update_cmake_minimum_required.patch", sha256="380a0a1bb2a480d912b7dbebd29f86f8bcf354f98b3316762ca01947b6d7f9d7", when="@2.0.3") + + def patch(self): + # jpeg requires stdio to be included before its headers. + filter_file(r"^(\#include \)", "#include\n\\1", "libmng_types.h") + + def cmake_args(self): + return ["-DWITH_LCMS2:BOOL=ON", "-DWITH_LCMS1:BOOL=OFF"] diff --git a/spack-repos/externals/packages/libmng/update_cmake_minimum_required.patch b/spack-repos/externals/packages/libmng/update_cmake_minimum_required.patch new file mode 100644 index 000000000..12a91f158 --- /dev/null +++ b/spack-repos/externals/packages/libmng/update_cmake_minimum_required.patch @@ -0,0 +1,11 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2f39241..74f4472 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ + #libmng-VERSION +-CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.26.3) + # + IF(COMMAND CMAKE_POLICY) + CMAKE_POLICY(SET CMP0003 NEW) diff --git a/spack-repos/externals/packages/libpng/package.py b/spack-repos/externals/packages/libpng/package.py new file mode 100644 index 000000000..ddbc9da82 --- /dev/null +++ b/spack-repos/externals/packages/libpng/package.py @@ -0,0 +1,65 @@ +# Copyright 2013-2024 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.build_systems.cmake import CMakeBuilder +from spack.package import * + + +class Libpng(CMakePackage): + """libpng is the official PNG reference library.""" + + homepage = "http://www.libpng.org/pub/png/libpng.html" + url = "https://prdownloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz" + git = "https://github.com/glennrp/libpng.git" + + maintainers("AlexanderRichert-NOAA") + + license("Libpng") + + version("1.6.39", sha256="1f4696ce70b4ee5f85f1e1623dc1229b210029fa4b7aee573df3e2ba7b036937") + version("1.6.37", sha256="505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca") + # From http://www.libpng.org/pub/png/libpng.html (2019-04-15) + # libpng versions 1.6.36 and earlier have a use-after-free bug in the + # simplified libpng API png_image_free(). It has been assigned ID + # CVE-2019-7317. The vulnerability is fixed in version 1.6.37, + # released on 15 April 2019. + + # Required for qt@3 + version("1.5.30", sha256="7d76275fad2ede4b7d87c5fd46e6f488d2a16b5a69dc968ffa840ab39ba756ed") + version("1.2.57", sha256="0f4620e11fa283fedafb474427c8e96bf149511a1804bdc47350963ae5cf54d8") + + depends_on("zlib-api") + + patch("update_cmake_minimum_required.patch", when="@1.6.39", sha256="48f25fa532adc4d0de8ef5e6787d1d8ee3551f46e017d2359e7612ddb58e34da") + + variant( + "libs", + default="shared,static", + values=("shared", "static"), + multi=True, + description="Build shared libs, static libs or both", + ) + variant("pic", default=False, description="PIC") + + @property + def libs(self): + # v1.2 does not have a version-less symlink + libraries = f"libpng{self.version.up_to(2).joined}" + shared = "libs=shared" in self.spec + return find_libraries(libraries, root=self.prefix, shared=shared, recursive=True) + + +class CMakeBuilder(CMakeBuilder): + def cmake_args(self): + args = [ + self.define("CMAKE_CXX_FLAGS", self.spec["zlib-api"].headers.include_flags), + self.define("ZLIB_ROOT", self.spec["zlib-api"].prefix), + self.define("PNG_SHARED", "shared" in self.spec.variants["libs"].value), + self.define("PNG_STATIC", "static" in self.spec.variants["libs"].value), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + ] + if self.spec.satisfies("platform=darwin target=aarch64:"): + args.append("-DPNG_ARM_NEON=off") + return args diff --git a/spack-repos/externals/packages/libpng/update_cmake_minimum_required.patch b/spack-repos/externals/packages/libpng/update_cmake_minimum_required.patch new file mode 100644 index 000000000..f6708c866 --- /dev/null +++ b/spack-repos/externals/packages/libpng/update_cmake_minimum_required.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 86e0affc4..a655634a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,8 +25,8 @@ + # For conditions of distribution and use, see the disclaimer + # and license in png.h + +-cmake_minimum_required(VERSION 3.1) +-cmake_policy(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) ++cmake_policy(VERSION 3.26.3) + + project(libpng C ASM) + enable_testing() +diff --git a/contrib/pngminus/CMakeLists.txt b/contrib/pngminus/CMakeLists.txt +index 1f815a582..1034e2329 100644 +--- a/contrib/pngminus/CMakeLists.txt ++++ b/contrib/pngminus/CMakeLists.txt +@@ -1,5 +1,5 @@ +-cmake_minimum_required(VERSION 3.1) +-cmake_policy(VERSION 3.1) ++cmake_minimum_required(VERSION 3.26.3) ++cmake_policy(VERSION 3.26.3) + + project(PNGMINUS C) + diff --git a/spack-repos/externals/packages/libtiff/package.py b/spack-repos/externals/packages/libtiff/package.py new file mode 100644 index 000000000..87ea29ccc --- /dev/null +++ b/spack-repos/externals/packages/libtiff/package.py @@ -0,0 +1,143 @@ +# Copyright 2013-2024 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.build_systems.autotools import AutotoolsBuilder +from spack.build_systems.cmake import CMakeBuilder +from spack.package import * + +VARIANTS = [ + # Internal codecs + "ccitt", + "packbits", + "lzw", + "thunder", + "next", + "logluv", + # External codecs + "zlib", + "libdeflate", + "pixarlog", + "jpeg", + "old-jpeg", + "jpeg12", + "jbig", + "lerc", + "lzma", + "zstd", + "webp", +] + + +class Libtiff(CMakePackage, AutotoolsPackage): + """LibTIFF - Tag Image File Format (TIFF) Library and Utilities.""" + + homepage = "http://www.simplesystems.org/libtiff/" + url = "https://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz" + + maintainers("adamjstewart") + + license("libtiff") + + version("4.5.1", sha256="d7f38b6788e4a8f5da7940c5ac9424f494d8a79eba53d555f4a507167dca5e2b") + version("4.5.0", sha256="c7a1d9296649233979fa3eacffef3fa024d73d05d589cb622727b5b08c423464") + version("4.4.0", sha256="917223b37538959aca3b790d2d73aa6e626b688e02dcda272aec24c2f498abed") + version("4.3.0", sha256="0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8") + version("4.2.0", sha256="eb0484e568ead8fa23b513e9b0041df7e327f4ee2d22db5a533929dfc19633cb") + version("4.1.0", sha256="5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634") + version("4.0.10", sha256="2c52d11ccaf767457db0c46795d9c7d1a8d8f76f68b0b800a3dfe45786b996e4") + version("4.0.9", sha256="6e7bdeec2c310734e734d19aae3a71ebe37a4d842e0e23dbb1b8921c0026cfcd") + version("4.0.8", sha256="59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910") + version("4.0.7", sha256="9f43a2cfb9589e5cecaa66e16bf87f814c945f22df7ba600d63aac4632c4f019") + version("4.0.6", sha256="4d57a50907b510e3049a4bba0d7888930fdfc16ce49f1bf693e5b6247370d68c") + version("4.0.5", sha256="e25eaa83ed7fab43ddd278b9b14d91a406a4b674cedc776adb95535f897f309c") + version("4.0.4", sha256="8cb1d90c96f61cdfc0bcf036acc251c9dbe6320334da941c7a83cfe1576ef890") + version("3.9.7", sha256="f5d64dd4ce61c55f5e9f6dc3920fbe5a41e02c2e607da7117a35eb5c320cef6a") + + # Internal codecs + variant("ccitt", default=True, description="support for CCITT Group 3 & 4 algorithms") + variant("packbits", default=True, description="support for Macintosh PackBits algorithm") + variant("lzw", default=True, description="support for LZW algorithm") + variant("thunder", default=True, description="support for ThunderScan 4-bit RLE algorithm") + variant("next", default=True, description="support for NeXT 2-bit RLE algorithm") + variant("logluv", default=True, description="support for LogLuv high dynamic range algorithm") + + # External codecs + variant("zlib", default=True, description="use zlib") + variant("libdeflate", default=False, description="use libdeflate", when="@4.2:") + variant("pixarlog", default=False, description="support for Pixar log-format algorithm") + variant("jpeg", default=True, description="use libjpeg") + variant("old-jpeg", default=False, description="support for Old JPEG compression") + variant("jpeg12", default=False, description="enable libjpeg 8/12-bit dual mode", when="@4:") + variant("jbig", default=False, description="use ISO JBIG compression") + variant("lerc", default=False, description="use libLerc", when="@4.3:") + variant("lzma", default=False, description="use liblzma", when="@4:") + variant("zstd", default=False, description="use libzstd", when="@4.0.10:") + variant("webp", default=False, description="use libwebp", when="@4.0.10:") + + build_system(conditional("cmake", when="@4.0.5:"), "autotools", default="cmake") + + variant("shared", default=True, description="Build shared") + variant("pic", default=False, description="Enable position-independent code (PIC)") + + with when("build_system=cmake"): + depends_on("cmake@3.9:", when="@4.3:", type="build") + depends_on("cmake@2.8.11:", when="@4.0.10:4.2", type="build") + depends_on("cmake@2.8.9:", when="@4.0.6:4.0.9", type="build") + depends_on("cmake@3:", when="@4.0.5", type="build") + + depends_on("zlib-api", when="+zlib") + depends_on("zlib-api", when="+pixarlog") + depends_on("jpeg@5:", when="+jpeg") + depends_on("jbigkit", when="+jbig") + depends_on("lerc", when="+lerc") + depends_on("xz", when="+lzma") + depends_on("zstd@1:", when="+zstd") + depends_on("libwebp", when="+webp") + + conflicts("+libdeflate", when="~zlib") + conflicts("+jpeg12", when="~jpeg") + conflicts("+lerc", when="~zlib") + + patch("update_cmake_minimum_required.patch", sha256="8e1335e4f38efc0ab3303a97769c3d51483ca5a2695f67332d2672047d7ca1db", when="@4.5.1") + + # 4.3.0 contains a bug that breaks the build on case-sensitive filesystems when + # using a C++20-capable compiler (commonly the case on macOS). Not an easy way to + # check for this, so add a conflict for macOS overall. For more details, see: + # https://gitlab.com/libtiff/libtiff/-/merge_requests/243 + conflicts("platform=darwin", when="@4.3.0") + + def patch(self): + # Remove flags not recognized by the NVIDIA compiler + if self.spec.satisfies("%nvhpc@:20.11"): + filter_file( + 'vl_cv_prog_cc_warnings="-Wall -W"', 'vl_cv_prog_cc_warnings="-Wall"', "configure" + ) + + +class CMakeBuilder(CMakeBuilder): + def cmake_args(self): + args = [self.define_from_variant(var) for var in VARIANTS] + args.append("-Dsphinx=OFF") + args += [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] + args += [self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")] + + # Remove empty strings + args = [arg for arg in args if arg] + + return args + + +class AutotoolsBuilder(AutotoolsBuilder): + def configure_args(self): + args = [] + for var in VARIANTS: + args.extend(self.enable_or_disable(var)) + + args.append("--disable-sphinx") + + args.extend(self.enable_or_disable("shared")) + args.extend(self.with_or_without("pic")) + + return args diff --git a/spack-repos/externals/packages/libtiff/update_cmake_minimum_required.patch b/spack-repos/externals/packages/libtiff/update_cmake_minimum_required.patch new file mode 100644 index 000000000..5f31c729b --- /dev/null +++ b/spack-repos/externals/packages/libtiff/update_cmake_minimum_required.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8d440f3..264ee51 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,10 +24,10 @@ + # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + # OF THIS SOFTWARE. + +-cmake_minimum_required(VERSION 3.9.0) ++cmake_minimum_required(VERSION 3.26.3) + + # Default policy is from 3.9.0 +-cmake_policy(VERSION 3.9.0) ++cmake_policy(VERSION 3.26.3) + + # Find CMake modules in cmake/ + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") +diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt +index 6cc3d2e..c981ddf 100644 +--- a/doc/CMakeLists.txt ++++ b/doc/CMakeLists.txt +@@ -24,7 +24,7 @@ + # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + # OF THIS SOFTWARE. + +-cmake_minimum_required(VERSION 3.2.0) ++cmake_minimum_required(VERSION 3.26.3) + + include(Sphinx) + diff --git a/spack-repos/externals/packages/llvm/D133513.diff b/spack-repos/externals/packages/llvm/D133513.diff new file mode 100644 index 000000000..54849b8e8 --- /dev/null +++ b/spack-repos/externals/packages/llvm/D133513.diff @@ -0,0 +1,29 @@ +Index: lldb/bindings/python/get-python-config.py +=================================================================== +--- lldb/bindings/python/get-python-config.py ++++ lldb/bindings/python/get-python-config.py +@@ -44,15 +44,21 @@ + elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH": + tried = list() + exe = sys.executable +- prefix = os.path.realpath(sys.prefix) ++ prefix = sys.prefix + while True: + try: + print(relpath_nodots(exe, prefix)) + break + except ValueError: + tried.append(exe) +- if os.path.islink(exe): +- exe = os.path.join(os.path.realpath(os.path.dirname(exe)), os.readlink(exe)) ++ real_exe_dirname = os.path.realpath(os.path.dirname(exe)) ++ real_prefix = os.path.realpath(prefix) ++ if prefix != real_prefix: ++ prefix = real_prefix ++ exe = os.path.join(real_exe_dirname, os.path.basename(exe)) ++ continue ++ elif os.path.islink(exe): ++ exe = os.path.join(real_exe_dirname, os.readlink(exe)) + continue + else: + print("Could not find a relative path to sys.executable under sys.prefix", file=sys.stderr) diff --git a/spack-repos/externals/packages/llvm/add-include-for-libelf-llvm-12-14.patch b/spack-repos/externals/packages/llvm/add-include-for-libelf-llvm-12-14.patch new file mode 100644 index 000000000..f585d08d0 --- /dev/null +++ b/spack-repos/externals/packages/llvm/add-include-for-libelf-llvm-12-14.patch @@ -0,0 +1,26 @@ +From e5f0939fde75f769c53c6c99c9ed6886e7d58c43 Mon Sep 17 00:00:00 2001 +From: Harmen Stoppels +Date: Wed, 23 Aug 2023 11:35:23 +0200 +Subject: [PATCH] Add corresponding -I for libelf.h + +Funnily enough, it's added to `include_directories` in multiple places, +except where it's necessary. +--- + openmp/libomptarget/plugins/amdgpu/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt +index 92523c23f68b..52e1923f97b7 100644 +--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt ++++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt +@@ -51,6 +51,7 @@ endif() + include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/impl + ${LIBOMPTARGET_LLVM_INCLUDE_DIRS} ++ ${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR} + ) + + set(LIBOMPTARGET_DLOPEN_LIBHSA OFF) +-- +2.39.2 + diff --git a/spack-repos/externals/packages/llvm/add-include-for-libelf-llvm-15.patch b/spack-repos/externals/packages/llvm/add-include-for-libelf-llvm-15.patch new file mode 100644 index 000000000..7a7d57d10 --- /dev/null +++ b/spack-repos/externals/packages/llvm/add-include-for-libelf-llvm-15.patch @@ -0,0 +1,26 @@ +From 5e149c3ec8118ad8f3d20a30ce5d3fbac4072515 Mon Sep 17 00:00:00 2001 +From: Harmen Stoppels +Date: Wed, 23 Aug 2023 11:35:23 +0200 +Subject: [PATCH] Add corresponding -I for libelf.h + +Funnily enough, it's added to `include_directories` in multiple places, +except where it's necessary. +--- + openmp/libomptarget/plugins/amdgpu/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt +index 66bf680d15c7..6be12ab6d7f8 100644 +--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt ++++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt +@@ -99,6 +99,7 @@ target_include_directories( + PRIVATE + ${LIBOMPTARGET_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/impl ++ ${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR} + ) + + +-- +2.39.2 + diff --git a/spack-repos/externals/packages/llvm/detection_test.yaml b/spack-repos/externals/packages/llvm/detection_test.yaml new file mode 100644 index 000000000..e979a8362 --- /dev/null +++ b/spack-repos/externals/packages/llvm/detection_test.yaml @@ -0,0 +1,75 @@ +paths: +- layout: + - executables: + - "bin/clang-3.9" + script: | + echo "clang version 3.9.1-19ubuntu1 (tags/RELEASE_391/rc2)" + echo "Target: x86_64-pc-linux-gnu" + echo "Thread model: posix" + echo "InstalledDir: /usr/bin" + - executables: + - "bin/clang++-3.9" + script: | + echo "clang version 3.9.1-19ubuntu1 (tags/RELEASE_391/rc2)" + echo "Target: x86_64-pc-linux-gnu" + echo "Thread model: posix" + echo "InstalledDir: /usr/bin" + platforms: ["darwin", "linux"] + results: + - spec: 'llvm@3.9.1 +clang~lld~lldb' + extra_attributes: + compilers: + c: ".*/bin/clang-3.9$" + cxx: ".*/bin/clang[+][+]-3.9$" + +# Multiple LLVM packages in the same prefix +- layout: + - executables: + - "bin/clang-8" + - "bin/clang++-8" + script: | + echo "clang version 8.0.0-3~ubuntu18.04.2 (tags/RELEASE_800/final)" + echo "Target: x86_64-pc-linux-gnu" + echo "Thread model: posix" + echo "InstalledDir: /usr/bin" + - executables: + - "bin/ld.lld-8" + script: 'echo "LLD 8.0.0 (compatible with GNU linkers)"' + - executables: + - "bin/lldb" + script: 'echo "lldb version 8.0.0"' + - executables: + - "bin/clang-3.9" + - "bin/clang++-3.9" + script: | + echo "clang version 3.9.1-19ubuntu1 (tags/RELEASE_391/rc2)" + echo "Target: x86_64-pc-linux-gnu" + echo "Thread model: posix" + echo "InstalledDir: /usr/bin" + platforms: ["darwin", "linux"] + results: + - spec: 'llvm@8.0.0+clang+lld+lldb' + extra_attributes: + compilers: + c: ".*/bin/clang-8$" + cxx: ".*/bin/clang[+][+]-8$" + ld: ".*/bin/ld.lld-8$" + + - spec: 'llvm@3.9.1+clang~lld~lldb' + extra_attributes: + compilers: + c: ".*/bin/clang-3.9$" + cxx: ".*/bin/clang[+][+]-3.9$" + +# Apple Clang should not be detected +- layout: + - executables: + - "bin/clang" + - "bin/clang++" + script: | + echo "Apple clang version 11.0.0 (clang-1100.0.33.8)" + echo "Target: x86_64-apple-darwin19.5.0" + echo "Thread model: posix" + echo "InstalledDir: /Library/Developer/CommandLineTools/usr/bin" + platforms: ["darwin"] + results: [] diff --git a/spack-repos/externals/packages/llvm/llvm12-thread.patch b/spack-repos/externals/packages/llvm/llvm12-thread.patch new file mode 100644 index 000000000..bbe3c253e --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm12-thread.patch @@ -0,0 +1,31 @@ +diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +index e3c2a580396e..5f76992d193e 100644 +--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake ++++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +@@ -249,3 +249,6 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND + endif() + endif() + endif() ++ ++find_package(Threads REQUIRED) ++set(OPENMP_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) +diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt +index 15e6c3bbaf1f..3e5a73504a08 100644 +--- a/openmp/libomptarget/src/CMakeLists.txt ++++ b/openmp/libomptarget/src/CMakeLists.txt +@@ -30,6 +30,7 @@ if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMPTARGET_PROFILING)) + add_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES}) + target_link_libraries(omptarget + ${CMAKE_DL_LIBS} ++ ${OPENMP_PTHREAD_LIB} + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports") + else() + set(LLVM_LINK_COMPONENTS +@@ -37,6 +38,7 @@ else() + ) + add_llvm_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES} + LINK_LIBS ${CMAKE_DL_LIBS} ++ ${OPENMP_PTHREAD_LIB} + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports" + ) + target_compile_definitions(omptarget PUBLIC OMPTARGET_PROFILE_ENABLED) diff --git a/spack-repos/externals/packages/llvm/llvm13-14-thread.patch b/spack-repos/externals/packages/llvm/llvm13-14-thread.patch new file mode 100644 index 000000000..0067a9303 --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm13-14-thread.patch @@ -0,0 +1,19 @@ +--- spack-src/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake.org 2022-02-08 14:58:13.000000000 +0900 ++++ spack-src/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake 2022-02-08 13:58:53.000000000 +0900 +@@ -276,4 +276,5 @@ + endif() + endif() + +-set(OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB}) ++find_package(Threads REQUIRED) ++set(OPENMP_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) +--- spack-src/openmp/libomptarget/src/CMakeLists.txt.org 2022-02-09 08:49:35.000000000 +0900 ++++ spack-src/openmp/libomptarget/src/CMakeLists.txt 2022-02-09 08:50:18.000000000 +0900 +@@ -36,6 +36,7 @@ + endif() + target_link_libraries(omptarget PRIVATE + ${CMAKE_DL_LIBS} ++ ${OPENMP_PTHREAD_LIB} + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports") + + # Install libomptarget under the lib destination folder. diff --git a/spack-repos/externals/packages/llvm/llvm13-fujitsu.patch b/spack-repos/externals/packages/llvm/llvm13-fujitsu.patch new file mode 100644 index 000000000..aa215bcff --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm13-fujitsu.patch @@ -0,0 +1,15 @@ +--- spack-src/libcxx/include/__config.org 2022-02-03 14:36:11.000000000 +0900 ++++ spack-src/libcxx/include/__config 2022-02-04 08:39:59.000000000 +0900 +@@ -52,7 +52,11 @@ + # elif __cplusplus <= 201703L + # define _LIBCPP_STD_VER 17 + # elif __cplusplus <= 202002L +-# define _LIBCPP_STD_VER 20 ++# if defined(__FUJITSU) || defined(__CLANG_FUJITSU) ++# define _LIBCPP_STD_VER 17 ++# else ++# define _LIBCPP_STD_VER 20 ++# endif + # else + # define _LIBCPP_STD_VER 21 // current year, or date of c++2b ratification + # endif diff --git a/spack-repos/externals/packages/llvm/llvm15-thread.patch b/spack-repos/externals/packages/llvm/llvm15-thread.patch new file mode 100644 index 000000000..cffb55918 --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm15-thread.patch @@ -0,0 +1,23 @@ +diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +index 1f2a50667c4f..d3ff232f6bd3 100644 +--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake ++++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +@@ -280,4 +280,5 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND + endif() + endif() + +-set(OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB}) ++find_package(Threads REQUIRED) ++set(OPENMP_PTHREAD_LIB Threads::Threads) +diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt +index 071ec61889a2..b782c3b07e6f 100644 +--- a/openmp/libomptarget/src/CMakeLists.txt ++++ b/openmp/libomptarget/src/CMakeLists.txt +@@ -33,6 +33,7 @@ add_llvm_library(omptarget + LINK_LIBS + PRIVATE + ${CMAKE_DL_LIBS} ++ ${OPENMP_PTHREAD_LIB} + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports" + NO_INSTALL_RPATH + ) diff --git a/spack-repos/externals/packages/llvm/llvm17-18-thread.patch b/spack-repos/externals/packages/llvm/llvm17-18-thread.patch new file mode 100644 index 000000000..7e337433f --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm17-18-thread.patch @@ -0,0 +1,22 @@ +diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +index 1f2a50667c4f..d3ff232f6bd3 100644 +--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake ++++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +@@ -280,4 +280,5 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND + endif() + endif() + +-set(OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB}) ++find_package(Threads REQUIRED) ++set(OPENMP_PTHREAD_LIB Threads::Threads) +diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt +index 071ec61889a2..b782c3b07e6f 100644 +--- a/openmp/libomptarget/src/CMakeLists.txt.orig 2024-03-26 14:30:52.000000000 +0900 ++++ b/openmp/libomptarget/src/CMakeLists.txt 2024-03-26 14:34:02.000000000 +0900 +@@ -41,5 +41,6 @@ + + if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG) + target_link_libraries(omptarget PRIVATE ++ ${OPENMP_PTHREAD_LIB} + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports") + endif() diff --git a/spack-repos/externals/packages/llvm/llvm17-fujitsu.patch b/spack-repos/externals/packages/llvm/llvm17-fujitsu.patch new file mode 100644 index 000000000..f960830c1 --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm17-fujitsu.patch @@ -0,0 +1,28 @@ +diff --git a/lldb/include/lldb/Utility/LLDBAssert.h_org b/lldb/include/lldb/Utility/LLDBAssert.h +index aeef3e5..2f14ff3 100644 +--- a/lldb/include/lldb/Utility/LLDBAssert.h_org ++++ b/lldb/include/lldb/Utility/LLDBAssert.h +@@ -14,7 +14,7 @@ + #ifndef NDEBUG + #define lldbassert(x) assert(x) + #else +-#if defined(__clang__) ++#if defined(__clang__) && !defined(__CLANG_FUJITSU) + // __FILE_NAME__ is a Clang-specific extension that functions similar to + // __FILE__ but only renders the last path component (the filename) instead of + // an invocation dependent full path to that file. + +diff --git runtimes/CMakeLists.txt_org runtimes/CMakeLists.txt +--- a/runtimes/CMakeLists.txt_org ++++ b/runtimes/CMakeLists.txt +@@ -6,2 +6,2 @@ + include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake + NO_POLICY_SCOPE) + ++string(REPLACE "-Nclang" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ++string(REPLACE "-Nnofjprof" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ++string(REPLACE "-Nfjprof" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ++ + project(Runtimes C CXX ASM) + + list(INSERT CMAKE_MODULE_PATH 0 diff --git a/spack-repos/externals/packages/llvm/llvm7_intel.patch b/spack-repos/externals/packages/llvm/llvm7_intel.patch new file mode 100644 index 000000000..710545a61 --- /dev/null +++ b/spack-repos/externals/packages/llvm/llvm7_intel.patch @@ -0,0 +1,50 @@ +diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h +index 71b0e7527cb..3304a378f37 100644 +--- a/llvm/include/llvm/ADT/StringExtras.h ++++ b/llvm/include/llvm/ADT/StringExtras.h +@@ -369,7 +369,7 @@ inline size_t join_items_size(const A1 &A, Args &&... Items) { + template + inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) { + using tag = typename std::iterator_traits::iterator_category; +- return detail::join_impl(Begin, End, Separator, tag()); ++ return llvm::detail::join_impl(Begin, End, Separator, tag()); + } + + /// Joins the strings in the range [R.begin(), R.end()), adding Separator +diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h +index 25b2efd33c9..40144d96044 100644 +--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h ++++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h +@@ -186,8 +186,9 @@ public: + /// topological sort) and it's class is the same regardless of block type. + struct BlockNode { + using IndexType = uint32_t; ++ using IndexTypeLimits = std::numeric_limits; + +- IndexType Index = std::numeric_limits::max(); ++ IndexType Index = IndexTypeLimits::max(); + + BlockNode() = default; + BlockNode(IndexType Index) : Index(Index) {} +diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp +index 4325d57f73d..96e1e1d5503 100644 +--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp ++++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp +@@ -1423,7 +1423,7 @@ VSO::lookupImpl(std::shared_ptr &Q, + if (SymI->second.getAddress() != 0) { + Q->resolve(Name, SymI->second); + if (Q->isFullyResolved()) +- ActionFlags |= NotifyFullyResolved; ++ ActionFlags = static_cast(ActionFlags | NotifyFullyResolved); + } + + // If the symbol is lazy, get the MaterialiaztionUnit for it. +@@ -1456,7 +1456,7 @@ VSO::lookupImpl(std::shared_ptr &Q, + // continue. + Q->notifySymbolReady(); + if (Q->isFullyReady()) +- ActionFlags |= NotifyFullyReady; ++ ActionFlags = static_cast(ActionFlags | NotifyFullyReady); + continue; + } + diff --git a/spack-repos/externals/packages/llvm/no_cyclades9.patch b/spack-repos/externals/packages/llvm/no_cyclades9.patch new file mode 100644 index 000000000..55cb70d1e --- /dev/null +++ b/spack-repos/externals/packages/llvm/no_cyclades9.patch @@ -0,0 +1,47 @@ +# This is a backport of https://reviews.llvm.org/D102059. +# +# We need the patch to be applicable when="@:9" and, therefore, cannot fetch +# it from the upstream repo. + +--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +@@ -370,9 +370,0 @@ +- _(CYGETDEFTHRESH, WRITE, sizeof(int)); +- _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +- _(CYGETMON, WRITE, struct_cyclades_monitor_sz); +- _(CYGETTHRESH, WRITE, sizeof(int)); +- _(CYGETTIMEOUT, WRITE, sizeof(int)); +- _(CYSETDEFTHRESH, NONE, 0); +- _(CYSETDEFTIMEOUT, NONE, 0); +- _(CYSETTHRESH, NONE, 0); +- _(CYSETTIMEOUT, NONE, 0); +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -986,1 +986,0 @@ +- extern unsigned struct_cyclades_monitor_sz; +@@ -1331,9 +1327,0 @@ +- extern unsigned IOCTL_CYGETDEFTHRESH; +- extern unsigned IOCTL_CYGETDEFTIMEOUT; +- extern unsigned IOCTL_CYGETMON; +- extern unsigned IOCTL_CYGETTHRESH; +- extern unsigned IOCTL_CYGETTIMEOUT; +- extern unsigned IOCTL_CYSETDEFTHRESH; +- extern unsigned IOCTL_CYSETDEFTIMEOUT; +- extern unsigned IOCTL_CYSETTHRESH; +- extern unsigned IOCTL_CYSETTIMEOUT; +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -143,1 +143,0 @@ +-#include +@@ -460,1 +459,0 @@ +- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); +@@ -824,9 +822,0 @@ +- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; +- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; +- unsigned IOCTL_CYGETMON = CYGETMON; +- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH; +- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT; +- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH; +- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT; +- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH; +- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT; diff --git a/spack-repos/externals/packages/llvm/package.py b/spack-repos/externals/packages/llvm/package.py new file mode 100644 index 000000000..f3a8a2878 --- /dev/null +++ b/spack-repos/externals/packages/llvm/package.py @@ -0,0 +1,1146 @@ +# Copyright 2013-2024 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 +import os.path +import re +import sys + +import llnl.util.tty as tty +from llnl.util.lang import classproperty + +import spack.build_environment +import spack.util.executable +from spack.package import * + + +class Llvm(CMakePackage, CudaPackage, CompilerPackage): + """The LLVM Project is a collection of modular and reusable compiler and + toolchain technologies. Despite its name, LLVM has little to do + with traditional virtual machines, though it does provide helpful + libraries that can be used to build them. The name "LLVM" itself + is not an acronym; it is the full name of the project. + """ + + homepage = "https://llvm.org/" + url = "https://github.com/llvm/llvm-project/archive/llvmorg-7.1.0.tar.gz" + list_url = "https://releases.llvm.org/download.html" + git = "https://github.com/llvm/llvm-project" + maintainers("trws", "haampie", "skosukhin") + + tags = ["e4s", "compiler"] + + generator("ninja") + + license("Apache-2.0") + + version("main", branch="main") + version("19.1.7", sha256="59abea1c22e64933fad4de1671a61cdb934098793c7a31b333ff58dc41bff36c") + version("18.1.3", sha256="fc5a2fd176d73ceb17f4e522f8fe96d8dde23300b8c233476d3609f55d995a7a") + version("18.1.2", sha256="8d686d5ece6f12b09985cb382a3a530dc06bb6e7eb907f57c7f8bf2d868ebb0b") + version("18.1.1", sha256="62439f733311869dbbaf704ce2e02141d2a07092d952fc87ef52d1d636a9b1e4") + version("18.1.0", sha256="eb18f65a68981e94ea1a5aae4f02321b17da9e99f76bfdb983b953f4ba2d3550") + version("17.0.6", sha256="81494d32e6f12ea6f73d6d25424dbd2364646011bb8f7e345ca870750aa27de1") + version("17.0.5", sha256="432c1eda3d1c9379cd52a9bee8e0ea6f7b204bff5075895f963fd8e575aa4fb8") + version("17.0.4", sha256="46200b79f52a02fe26d0a43fd856ab6ceff49ab2a0b7c240ac4b700a6ada700c") + version("17.0.3", sha256="1e3d9d04fb5fbd8d0080042ad72c7e2a5c68788b014b186647a604dbbdd625d2") + version("17.0.2", sha256="dcba3eb486973dce45b6edfe618f3f29b703ae7e6ef9df65182fb50fb6fe4235") + version("17.0.1", sha256="d51b10be66c10a6a81f4c594b554ffbf1063ffbadcb810af37d1f88d6e0b49dd") + version("16.0.6", sha256="56b2f75fdaa95ad5e477a246d3f0d164964ab066b4619a01836ef08e475ec9d5") + version("16.0.5", sha256="e0fbca476693fcafa125bc71c8535587b6d9950293122b66b262bb4333a03942") + version("16.0.4", sha256="10c3fe1757d2e4f1cd7745dc548ecf687680a71824ec81701c38524c2a0753e2") + version("16.0.3", sha256="0bd71bc687a4e5a250c40afb0decefc50c85178fcce726137b682039de63919b") + version("16.0.2", sha256="97c3c6aafb53c4bb0ed2781a18d6f05e75445e24bb1dc57a32b74f8d710ac19f") + version("16.0.1", sha256="b5a9ff1793b1e2d388a3819bf35797002b1d2e40bb35a10c65605e0ea1435271") + version("16.0.0", sha256="cba969a0782a3a398658d439f047b5e548ea04724f4fbfdbe17cfc946f4cd3ed") + version("15.0.7", sha256="42a0088f148edcf6c770dfc780a7273014a9a89b66f357c761b4ca7c8dfa10ba") + version("15.0.6", sha256="4d857d7a180918bdacd09a5910bf9743c9861a1e49cb065a85f7a990f812161d") + version("15.0.5", sha256="c47640269e0251e009ae18a25162df4e20e175885286e21d28c054b084b991a4") + version("15.0.4", sha256="e24b4d3bf7821dcb1c901d1e09096c1f88fb00095c5a6ef893baab4836975e52") + version("15.0.3", sha256="8ac8e4c0982bf236526d737d385db5e1e66543ab217a9355d54159659eae3774") + version("15.0.2", sha256="dc11d35e60ab61792baa607dff080c993b39de23fb93b3d3369ba15b0601c307") + version("15.0.1", sha256="20bccb964e39f604fdc16d1258f94d2053fbdcdab2b2f6d5e20e6095ec403c00") + version("15.0.0", sha256="36d83cd84e1caf2bcfda1669c029e2b949adb9860cff01e7d3246ac2348b11ae") + version("14.0.6", sha256="98f15f842700bdb7220a166c8d2739a03a72e775b67031205078f39dd756a055") + version("14.0.5", sha256="a4a57f029cb81f04618e05853f05fc2d21b64353c760977d8e7799bf7218a23a") + version("14.0.4", sha256="1333236f9bee38658762076be4236cb5ebf15ae9b7f2bfce6946b96ae962dc73") + version("14.0.3", sha256="0e1d049b050127ecf6286107e9a4400b0550f841d5d2288b9d31fd32ed0683d5") + version("14.0.2", sha256="ca52232b3451c8e017f00eb882277707c13e30fac1271ec97015f6d0eeb383d1") + version("14.0.1", sha256="c8be00406e872c8a24f8571cf6f5517b73ae707104724b1fd1db2f0af9544019") + version("14.0.0", sha256="87b1a068b370df5b79a892fdb2935922a8efb1fddec4cc506e30fe57b6a1d9c4") + version("13.0.1", sha256="09c50d558bd975c41157364421820228df66632802a4a6a7c9c17f86a7340802") + version("13.0.0", sha256="a1131358f1f9f819df73fa6bff505f2c49d176e9eef0a3aedd1fdbce3b4630e8") + version("12.0.1", sha256="66b64aa301244975a4aea489f402f205cde2f53dd722dad9e7b77a0459b4c8df") + version("12.0.0", sha256="8e6c99e482bb16a450165176c2d881804976a2d770e0445af4375e78a1fbf19c") + version("11.1.0", sha256="53a0719f3f4b0388013cfffd7b10c7d5682eece1929a9553c722348d1f866e79") + version("11.0.1", sha256="9c7ad8e8ec77c5bde8eb4afa105a318fd1ded7dff3747d14f012758719d7171b") + version("11.0.0", sha256="8ad4ddbafac4f2c8f2ea523c2c4196f940e8e16f9e635210537582a48622a5d5") + version("10.0.1", sha256="c7ccb735c37b4ec470f66a6c35fbae4f029c0f88038f6977180b1a8ddc255637") + version("10.0.0", sha256="b81c96d2f8f40dc61b14a167513d87c0d813aae0251e06e11ae8a4384ca15451") + version("9.0.1", sha256="be7b034641a5fda51ffca7f5d840b1a768737779f75f7c4fd18fe2d37820289a") + version("9.0.0", sha256="7807fac25330e24e9955ca46cd855dd34bbc9cc4fdba8322366206654d1036f2") + version("8.0.1", sha256="5b18f6111c7aee7c0933c355877d4abcfe6cb40c1a64178f28821849c725c841") + version("8.0.0", sha256="d81238b4a69e93e29f74ce56f8107cbfcf0c7d7b40510b7879e98cc031e25167") + version("7.1.0", sha256="71c93979f20e01f1a1cc839a247945f556fa5e63abf2084e8468b238080fd839") + version("7.0.1", sha256="f17a6cd401e8fd8f811fbfbb36dcb4f455f898c9d03af4044807ad005df9f3c0") + version("6.0.1", sha256="aefadceb231f4c195fe6d6cd3b1a010b269c8a22410f339b5a089c2e902aa177") + version("6.0.0", sha256="1946ec629c88d30122afa072d3c6a89cc5d5e4e2bb28dc63b2f9ebcc7917ee64") + version("5.0.2", sha256="fe87aa11558c08856739bfd9bd971263a28657663cb0c3a0af01b94f03b0b795") + version("5.0.1", sha256="84ca454abf262579814a2a2b846569f6e0cb3e16dc33ca3642b4f1dff6fbafd3") + version("5.0.0", sha256="1f1843315657a4371d8ca37f01265fa9aae17dbcf46d2d0a95c1fdb3c6a4bab6") + + variant( + "clang", default=True, description="Build the LLVM C/C++/Objective-C compiler frontend" + ) + + variant( + "flang", + default=False, + description="Build the LLVM Fortran compiler frontend " + "(experimental - parser only, needs GCC)", + ) + conflicts("+flang", when="@:10") + conflicts("+flang", when="~clang") + + variant("lldb", default=True, description="Build the LLVM debugger") + conflicts("+lldb", when="~clang") + + variant("lld", default=True, description="Build the LLVM linker") + variant("mlir", default=False, when="@10:", description="Build with MLIR support") + variant( + "libunwind", + values=( + "none", + conditional("project", when="@:15"), + conditional("runtime", when="+clang @6:"), + ), + default="runtime", + description="Build the LLVM unwinder library" + "either as a runtime (with just-build Clang) " + "or as a project (with the compiler in use)", + ) + variant( + "polly", + default=True, + description="Build the LLVM polyhedral optimization plugin, only builds for 3.7.0+", + ) + variant( + "libcxx", + values=( + "none", + conditional("project", when="@:15"), + conditional("runtime", when="+clang @6:"), + ), + default="runtime", + description="Build the LLVM C++ standard library " + "either as a runtime (with just-build Clang) " + "or as a project (with the compiler in use)", + ) + + variant("libomptarget", default=True, description="Build the OpenMP offloading library") + conflicts("+libomptarget", when="~clang") + for _p in ["darwin", "windows"]: + conflicts("+libomptarget", when="platform={0}".format(_p)) + del _p + + variant( + "libomptarget_debug", + default=False, + description="Allow debug output with the environment variable LIBOMPTARGET_DEBUG=1", + ) + conflicts("+libomptarget_debug", when="~libomptarget") + + variant( + "compiler-rt", + values=( + "none", + conditional("project", when="+clang"), + conditional("runtime", when="+clang @6:"), + ), + default="runtime", + description="Build the LLVM compiler runtime, including sanitizers, " + "either as a runtime (with just-build Clang) " + "or as a project (with the compiler in use)", + ) + variant( + "gold", + default=(sys.platform != "darwin"), + description="Add support for LTO with the gold linker plugin", + ) + variant("split_dwarf", default=False, description="Build with split dwarf information") + variant( + "llvm_dylib", + default=True, + description="Build a combined LLVM shared library with all components", + ) + variant( + "link_llvm_dylib", + default=False, + when="+llvm_dylib", + description="Link LLVM tools against the LLVM shared library", + ) + variant( + "targets", + default="all", + description=( + "What targets to build. Spack's target family is always added " + "(e.g. X86 is automatically enabled when targeting znver2)." + ), + values=( + "all", + "none", + "aarch64", + "amdgpu", + "arm", + "avr", + "bpf", + "cppbackend", + "hexagon", + "lanai", + "mips", + "msp430", + "nvptx", + "powerpc", + "riscv", + "sparc", + "systemz", + "webassembly", + "x86", + "xcore", + ), + multi=True, + ) + variant( + "libomp_tsan", + default=False, + # Added in https://reviews.llvm.org/D13072 + # Removed in https://reviews.llvm.org/D103767 + when="@4:12", + description="Build with OpenMP capable thread sanitizer", + ) + variant( + "openmp", + values=("project", conditional("runtime", when="+clang @12:")), + default="runtime", + description="Build OpenMP either as a runtime (with just-build Clang) " + "or as a project (with the compiler in use)", + ) + variant( + "code_signing", + default=False, + when="+lldb platform=darwin", + description="Enable code-signing on macOS", + ) + variant("python", default=False, description="Install python bindings") + variant("lua", default=True, description="Enable lua scripting inside lldb") + variant("version_suffix", default="none", description="Add a symbol suffix") + variant( + "shlib_symbol_version", + default="none", + description="Add shared library symbol version", + when="@13:", + ) + variant("z3", default=False, description="Use Z3 for the clang static analyzer") + conflicts("+z3", when="@:7") + conflicts("+z3", when="~clang") + conflicts("+lua", when="@:10") + conflicts("+lua", when="~lldb") + + variant( + "zstd", + default=False, + when="@15:", + description="Enable zstd support for static analyzer / lld", + ) + + provides("libllvm@17", when="@17.0.0:17") + provides("libllvm@16", when="@16.0.0:16") + provides("libllvm@15", when="@15.0.0:15") + provides("libllvm@14", when="@14.0.0:14") + provides("libllvm@13", when="@13.0.0:13") + provides("libllvm@12", when="@12.0.0:12") + provides("libllvm@11", when="@11.0.0:11") + provides("libllvm@10", when="@10.0.0:10") + provides("libllvm@9", when="@9.0.0:9") + provides("libllvm@8", when="@8.0.0:8") + provides("libllvm@7", when="@7.0.0:7") + provides("libllvm@6", when="@6.0.0:6") + provides("libllvm@5", when="@5.0.0:5") + provides("libllvm@4", when="@4.0.0:4") + provides("libllvm@3", when="@3.0.0:3") + + extends("python", when="+python") + + # Build dependency + depends_on("cmake@3.4.3:", type="build") + depends_on("cmake@3.13.4:", type="build", when="@12:") + depends_on("cmake@3.20:", type="build", when="@16:") + with when("@:10"): + # Versions 10 and older cannot build runtimes with cmake@3.17: + # See https://reviews.llvm.org/D77284 + for runtime in ["libunwind", "libcxx", "compiler-rt"]: + depends_on("cmake@:3.16", type="build", when="{0}=runtime".format(runtime)) + del runtime + depends_on("python", when="~python", type="build") + depends_on("pkgconfig", type="build") + + # Universal dependency + depends_on("python", when="+python") + + # clang and clang-tools dependencies + depends_on("z3@4.7.1:", when="+z3") + + # openmp dependencies + depends_on("perl-data-dumper", type=("build")) + depends_on("hwloc") + depends_on("hwloc@2.0.1:", when="@13") + with when("@:15"): + depends_on("elf", when="+cuda") + depends_on("elf", when="+libomptarget") + depends_on("libffi", when="+libomptarget") + + # llvm-config --system-libs libraries. + depends_on("zlib-api") + + # needs zstd cmake config file, which is not added when built with makefile. + depends_on("zstd build_system=cmake", when="+zstd") + + # lldb dependencies + with when("+lldb"): + depends_on("libedit") + depends_on("libxml2") + depends_on("lua@5.3", when="+lua") # purposefully not a range + depends_on("ncurses") + depends_on("py-six", when="+python") + depends_on("swig", when="+lua") + depends_on("swig", when="+python") + depends_on("xz") + + for _when_spec in ("+lldb+python", "+lldb+lua"): + with when(_when_spec): + depends_on("swig@2:", when="@10:") + depends_on("swig@3:", when="@12:") + depends_on("swig@4:", when="@17:") + # Commits f0a25fe0b746f56295d5c02116ba28d2f965c175 and + # 81fc5f7909a4ef5a8d4b5da2a10f77f7cb01ba63 fixed swig 4.1 support + depends_on("swig@:4.0", when="@:15") + + # gold support, required for some features + depends_on("binutils+gold+ld+plugins+headers", when="+gold") + + # Older LLVM do not build with newer compilers, and vice versa + with when("@16:"): + conflicts("%gcc@:7.0") + conflicts("%clang@:4") + conflicts("%apple-clang@:9") + conflicts("%gcc@8:", when="@:5") + conflicts("%gcc@:5.0", when="@8:") + # Internal compiler error on gcc 8.4 on aarch64 https://bugzilla.redhat.com/show_bug.cgi?id=1958295 + conflicts("%gcc@8.4:8.4.9", when="@12: target=aarch64:") + + # libcxx=project imposes compiler conflicts + # see https://libcxx.llvm.org/#platform-and-compiler-support for the latest release + # and https://github.com/llvm/www-releases for older releases + with when("libcxx=project"): + for v, compiler_conflicts in { + "@7:": {"clang": "@:3.4", "gcc": "@:4.6"}, + "@9:": {"clang": "@:3.4", "gcc": "@:4"}, + "@11:": {"clang": "@:3", "gcc": "@:4"}, + "@13:": {"clang": "@:10", "gcc": "@:10", "apple-clang": "@:11"}, + "@14:": { + "clang": "@:11", + "gcc": "@:10", + "apple-clang": "@:11", + "xlc": "@:17.0", + "xlc_r": "@:17.0", + }, + "@15:": { + "clang": "@:12", + "gcc": "@:11", + "apple-clang": "@:12", + "xlc": "@:17.0", + "xlc_r": "@:17.0", + }, + "@16:": { + "clang": "@:13", + "gcc": "@:11", + "apple-clang": "@:13", + "xlc": "@:17.0", + "xlc_r": "@:17.0", + }, + }.items(): + with when(v): + for comp in spack.compilers.supported_compilers(): + conflicts("%{0}{1}".format(comp, compiler_conflicts.get(comp, ""))) + del v, compiler_conflicts, comp + + # libomptarget + conflicts("+cuda", when="@15:") # +cuda variant is obselete since LLVM 15 + conflicts( + "targets=none", + when="+libomptarget", + msg="Non-host backends needed for offloading, set targets=all", + ) + # See https://github.com/spack/spack/pull/32476#issuecomment-1573770361 + conflicts("~lld", when="+libomptarget") + + # cuda_arch value must be specified + conflicts("cuda_arch=none", when="+cuda", msg="A value for cuda_arch must be specified.") + + # LLVM bug https://bugs.llvm.org/show_bug.cgi?id=48234 + # CMake bug: https://gitlab.kitware.com/cmake/cmake/-/issues/21469 + # Fixed in upstream versions of both + conflicts("^cmake@3.19.0", when="@6:11.0.0") + + # Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463 + patch( + "https://raw.githubusercontent.com/freebsd/freebsd-ports/f8f9333d8e1e5a7a6b28c5ef0ca73785db06136e/devel/llvm50/files/lld/patch-tools_lld_ELF_Symbols.cpp", + sha256="c81a50c1b6b78d359c0ce3b88914477f4f2a85b8dbfa7ac745b9e7eb4e53931b", + when="@5+lld%clang@7:", + ) + + # Add missing include directives for the standard headers (the real need for the following + # patches depends on the implementation of the standard C++ library, the headers, however, must + # be included according to the standard, therefore, we apply the patches regardless of the + # compiler and compiler version). + # + # fix missing ::size_t in 'llvm@4:5' + # see comments in the patch file + patch( + "xray_buffer_queue-cstddef.patch", + # we do not cover compiler-rt=runtime because it is not supported when @:5 + when="@4:5 compiler-rt=project", + ) + # + # see https://reviews.llvm.org/D64937 + # see https://github.com/spack/spack/issues/24270 + patch( + "https://github.com/llvm/llvm-project/commit/b288d90b39f4b905c02092a9bfcfd6d78f99b191.patch?full_index=1", + sha256="2028d52e1a39326bb48fb7463132bbfe7fb4fa18f1adfeea9c3ed0320ed49564", + when="@8:9.0.0", + ) + # + # committed upstream without a review + # see https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1 + # see https://github.com/spack/spack/pull/28547 + patch( + "https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1.patch?full_index=1", + sha256="514926d661635de47972c7d403c9c4669235aa51e22e56d44676d2a2709179b6", + when="@8:11", + ) + # + # fix compilation against libstdc++13 + patch( + "https://github.com/llvm/llvm-project/commit/1b4fdf18bc2aaa2d46bf072475dd9cbcd44a9fee.patch?full_index=1", + sha256="82481418766b4b949ea808d956ff3800b9a241a576370114862428bb0e25ee1f", + when="@14:15", + ) + + # missing include + patch( + "https://github.com/llvm/llvm-project/commit/ff1681ddb303223973653f7f5f3f3435b48a1983.patch?full_index=1", + sha256="c6ca6b925f150e8644ce756023797b7f94c9619c62507231f979edab1c09af78", + when="@6:13", + ) + # fix building of older versions of llvm with newer versions of glibc + for compiler_rt_as in ["project", "runtime"]: + with when("compiler-rt={0}".format(compiler_rt_as)): + # sys/ustat.h has been removed in favour of statfs from glibc-2.28 + # see https://reviews.llvm.org/D47281 + patch( + "https://github.com/llvm/llvm-project/commit/383fe5c8668f63ef21c646b43f48da9fa41aa100.patch?full_index=1", + sha256="66f01ac1769a6815aba09d6f4347ac1744f77f82ec9578a1158b24daca7a89e6", + when="@4:6.0.0", + ) + # fix sanitizer-common build with glibc 2.31 + # see https://reviews.llvm.org/D70662 + patch("sanitizer-ipc_perm_mode.patch", when="@5:9") + del compiler_rt_as + + # Backport from llvm upstream gcc ppc const expr long double issue + # see https://bugs.llvm.org/show_bug.cgi?id=39696 + # This fix was initially committed (3bf63cf3b366) for the 9.0 release + # but was then broken (0583d9ea8d5e) prior to the 9.0 release and + # eventually unbroken (d9a42ec98adc) for the 11.0 release. The first + # patch backports the original correct fix to previous releases. The + # second patch backports the un-breaking of the original fix. + for libcxx_as in ["project", "runtime"]: + with when("libcxx={0}".format(libcxx_as)): + patch( + "https://github.com/llvm/llvm-project/commit/3bf63cf3b366d3a57cf5cbad4112a6abf6c0c3b1.patch?full_index=1", + sha256="e56489a4bcf3c3636e206adca366bfcda2722ad81a5fa9a0360faed63933191a", + when="@6:8", + ) + patch( + "https://github.com/llvm/llvm-project/commit/d9a42ec98adcb1ebc0c3837715df4e5a50c7ccc0.patch?full_index=1", + sha256="50bfc4e82c02bb5b7739990f363d99b1e43d5d11a5104f6aabbc303ebce6fbe3", + when="@9:10", + ) + del libcxx_as + + # Backport from llvm to fix issues related to Python 3.7 + # see https://bugs.llvm.org/show_bug.cgi?id=38233 + patch( + "https://github.com/llvm/llvm-project/commit/5457b426f5e15a29c0acc8af1a476132f8be2a36.patch?full_index=1", + sha256="7a1e4aa80760167807255c3e3121b1281bfcf532396b2d8fb3dce021f3f18758", + when="@4:6+python+lldb ^python@3.7:", + ) + + # fix building on SUSE (with panel.h being in /usr/include/ncurses/) + # see https://reviews.llvm.org/D85219 + # see https://github.com/spack/spack/issues/19625 + patch( + "https://github.com/llvm/llvm-project/commit/c952ec15d38843b69e22dfd7b0665304a0459f9f.patch?full_index=1", + sha256="66932ba31b5bf8808ea112e42cfd79b2480a4936e711771c06ce851eac429b2c", + when="@10:11+lldb", + ) + + # honor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake + # see https://reviews.llvm.org/D91536 + patch( + "https://github.com/llvm/llvm-project/commit/16de50895e96adbe261a5ce2498366bda7b3fccd.patch?full_index=1", + sha256="0e121ed460aa6e117f9f5f339d597a96c0fe4f97dc2209aba47b43ffc831ea24", + # The patch is applicable only starting version 7.0.0 (the older version might require a + # different patch addressing https://github.com/spack/spack/issues/19908). It looks like + # the patched function is used only if both compiler-rt and libcxx are enabled but we keep + # it simple: + when="@7:11", + ) + + # Workaround for issue https://github.com/spack/spack/issues/18197 + patch("llvm7_intel.patch", when="@7 %intel@18.0.2,19.0.0:19.1.99") + + # Remove cyclades support to build against newer kernel headers + # https://reviews.llvm.org/D102059 + patch( + "https://github.com/llvm/llvm-project/commit/68d5235cb58f988c71b403334cd9482d663841ab.patch?full_index=1", + sha256="742501723642675075e617f3c38339961b2c7b6fd8290dbffc52239ab0783317", + when="@10:12.0.0", + ) + # The patch above is not applicable when "@:9" due to the file renaming and reformatting. The + # following patch is applicable starting at least version 5.0.0, the oldest we try to support. + patch("no_cyclades9.patch", when="@5:9") + + with when("+libomptarget"): + # libomptarget makes use of multithreading via the standard C++ library (e.g. + # std::call_once), which, depending on the platform and the implementation of the standard + # library, might or might not require linking to libpthread (note that the failure might + # happen at the linking time as well as at the runtime). In some cases, the required linker + # flag comes as a transitive dependency (e.g. from the static LLVMSupport component). The + # following patches enforce linking to the thread library that is relevant for the system, + # which might lead to overlinking in some cases though. + # TODO: figure out why we do not use LLVM_PTHREAD_LIB but run find_package(Threads), at + # least for newer versions (the solution must work with both openmp=runtime and + # openmp=project) + patch("llvm12-thread.patch", when="@12") + patch("llvm13-14-thread.patch", when="@13:14") + patch("llvm15-thread.patch", when="@15") + + # avoid build failed with Fujitsu compiler + patch("llvm13-fujitsu.patch", when="@13 %fj") + + # avoid build failed with Fujitsu compiler since llvm17 + patch("llvm17-fujitsu.patch", when="@17: %fj") + patch("llvm17-18-thread.patch", when="@17:18 %fj") + + # patch for missing hwloc.h include for libompd + # see https://reviews.llvm.org/D123888 + patch( + "https://github.com/llvm/llvm-project/commit/91ccd8248c85385a5654c63c302a37d97f811bab.patch?full_index=1", + sha256="b216cff38659c176c5381e9dda3252edbb204e6f6f1f33e843a9ebcc42732e5d", + when="@14 openmp=runtime", + ) + + # make libflags a list in openmp subproject when openmp=project + # see https://reviews.llvm.org/D125370 + patch( + "https://github.com/llvm/llvm-project/commit/e27ce281399dca8b08b6ca593172a1bd5dbdd5c1.patch?full_index=1", + sha256="6f0cfa55e3ed17ee33346b0a5bca8092adcc1dc75ca712ab83901755fba9767e", + when="@3.7:14 openmp=project", + ) + + # fix detection of LLDB_PYTHON_EXE_RELATIVE_PATH + # see https://reviews.llvm.org/D133513 + # TODO: the patch is not applicable after https://reviews.llvm.org/D141042 but it is not clear + # yet whether we need a version of it for when="@16:" + patch("D133513.diff", level=0, when="@14:15+lldb+python") + + # Fix hwloc@:2.3 (Conditionally disable hwloc@2.0 and hwloc@2.4 code) + patch( + "https://github.com/llvm/llvm-project/commit/3a362a9f38b95978160377ee408dbc7d14af9aad.patch?full_index=1", + sha256="25bc503f7855229620e56e76161cf4654945aef0be493a2d8d9e94a088157b7c", + when="@14:15", + ) + + # Fix false positive detection of a target when building compiler-rt as a runtime + # https://reviews.llvm.org/D127975 + patch( + "https://github.com/llvm/llvm-project/commit/9f1d90bf91570efa124c4a86cd033de374d1049a.patch?full_index=1", + sha256="1f4287465b3e499911e039e6cc2f395b8cb00eb8a0a223fa0db3704ba77f9969", + when="@13:14 compiler-rt=runtime", + ) + + patch("add-include-for-libelf-llvm-12-14.patch", when="@12:14") + patch("add-include-for-libelf-llvm-15.patch", when="@15") + + patch("sanitizer-platform-limits-posix-xdr-macos.patch", when="@10:14 platform=darwin") + + @when("@14:17") + def patch(self): + # https://github.com/llvm/llvm-project/pull/69458 + filter_file( + r"${TERMINFO_LIB}", + r"${Terminfo_LIBRARIES}", + "lldb/source/Core/CMakeLists.txt", + string=True, + ) + + compiler_version_regex = ( + # Normal clang compiler versions are left as-is + r"clang version ([^ )\n]+)-svn[~.\w\d-]*|" + # Don't include hyphenated patch numbers in the version + # (see https://github.com/spack/spack/pull/14365 for details) + r"clang version ([^ )\n]+?)-[~.\w\d-]*|" + r"clang version ([^ )\n]+)|" + # LLDB + r"lldb version ([^ )\n]+)|" + # LLD + r"LLD ([^ )\n]+) \(compatible with GNU linkers\)" + ) + compiler_version_argument = "--version" + compiler_languages = ["c", "cxx", "fortran"] + c_names = ["clang"] + cxx_names = ["clang++"] + fortran_names = ["flang"] + + @property + def supported_languages(self): + languages = [] + if self.spec.satisfies("+clang"): + languages.extend(["c", "cxx"]) + if self.spec.satisfies("+flang"): + languages.append("fortran") + return languages + + @classproperty + def executables(cls): + return super().executables + ["ld.lld", "lldb"] + + @classmethod + def filter_detected_exes(cls, prefix, exes_in_prefix): + result = [] + for exe in exes_in_prefix: + # Executables like lldb-vscode-X are daemon listening + # on some port and would hang Spack during detection. + # clang-cl and clang-cpp are dev tools that we don't + # need to test + if any(x in exe for x in ("vscode", "cpp", "-cl", "-gpu")): + continue + result.append(exe) + return result + + @classmethod + def determine_version(cls, exe): + try: + compiler = Executable(exe) + output = compiler(cls.compiler_version_argument, output=str, error=str) + if "Apple" in output: + return None + if "AMD" in output: + return None + match = re.search(cls.compiler_version_regex, output) + if match: + return match.group(match.lastindex) + except spack.util.executable.ProcessError: + pass + except Exception as e: + tty.debug(e) + + return None + + @classmethod + def determine_variants(cls, exes, version_str): + # Do not need to reuse more general logic from CompilerPackage + # because LLVM has kindly named compilers + variants, compilers = ["+clang"], {} + lld_found, lldb_found = False, False + for exe in exes: + name = os.path.basename(exe) + if "clang++" in name: + compilers["cxx"] = exe + elif "clang" in name: + compilers["c"] = exe + elif "flang" in name: + variants.append("+flang") + compilers["fortran"] = exe + elif "ld.lld" in name: + lld_found = True + compilers["ld"] = exe + elif "lldb" in name: + lldb_found = True + compilers["lldb"] = exe + + variants.append("+lld" if lld_found else "~lld") + variants.append("+lldb" if lldb_found else "~lldb") + + return "".join(variants), {"compilers": compilers} + + @classmethod + def validate_detected_spec(cls, spec, extra_attributes): + # For LLVM 'compilers' is a mandatory attribute + msg = 'the extra attribute "compilers" must be set for ' 'the detected spec "{0}"'.format( + spec + ) + assert "compilers" in extra_attributes, msg + compilers = extra_attributes["compilers"] + for key in ("c", "cxx"): + msg = "{0} compiler not found for {1}" + assert key in compilers, msg.format(key, spec) + + @property + def cc(self): + msg = "cannot retrieve C compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("c", None) + result = None + if "+clang" in self.spec: + result = os.path.join(self.spec.prefix.bin, "clang") + return result + + @property + def cxx(self): + msg = "cannot retrieve C++ compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("cxx", None) + result = None + if "+clang" in self.spec: + result = os.path.join(self.spec.prefix.bin, "clang++") + return result + + @property + def fc(self): + msg = "cannot retrieve Fortran compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("fc", None) + result = None + if "+flang" in self.spec: + result = os.path.join(self.spec.prefix.bin, "flang") + return result + + @property + def f77(self): + msg = "cannot retrieve Fortran 77 compiler [spec is not concrete]" + assert self.spec.concrete, msg + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("f77", None) + result = None + if "+flang" in self.spec: + result = os.path.join(self.spec.prefix.bin, "flang") + return result + + @property + def libs(self): + return LibraryList(self.llvm_config("--libfiles", "all", result="list")) + + @run_before("cmake") + def codesign_check(self): + if self.spec.satisfies("+code_signing"): + codesign = which("codesign") + mkdir("tmp") + llvm_check_file = join_path("tmp", "llvm_check") + copy("/usr/bin/false", llvm_check_file) + try: + codesign("-f", "-s", "lldb_codesign", "--dryrun", llvm_check_file) + + except ProcessError: + # Newer LLVM versions have a simple script that sets up + # automatically when run with sudo priviliges + setup = Executable("./lldb/scripts/macos-setup-codesign.sh") + try: + setup() + except Exception: + raise RuntimeError( + "spack was unable to either find or set up" + "code-signing on your system. Please refer to" + "https://lldb.llvm.org/resources/build.html#" + "code-signing-on-macos for details on how to" + "create this identity." + ) + + def flag_handler(self, name, flags): + if name == "ldflags" and self.spec.satisfies("%intel"): + flags.append("-shared-intel") + return (None, flags, None) + return (flags, None, None) + + def setup_build_environment(self, env): + """When using %clang, add only its ld.lld-$ver and/or ld.lld to our PATH""" + if self.compiler.name in ["clang", "apple-clang"]: + for lld in "ld.lld-{0}".format(self.compiler.version.version[0]), "ld.lld": + bin = os.path.join(os.path.dirname(self.compiler.cc), lld) + sym = os.path.join(self.stage.path, "ld.lld") + if os.path.exists(bin) and not os.path.exists(sym): + mkdirp(self.stage.path) + os.symlink(bin, sym) + env.prepend_path("PATH", self.stage.path) + + def setup_run_environment(self, env): + if "+clang" in self.spec: + env.set("CC", join_path(self.spec.prefix.bin, "clang")) + env.set("CXX", join_path(self.spec.prefix.bin, "clang++")) + if "+flang" in self.spec: + env.set("FC", join_path(self.spec.prefix.bin, "flang")) + env.set("F77", join_path(self.spec.prefix.bin, "flang")) + + root_cmakelists_dir = "llvm" + + def cmake_args(self): + spec = self.spec + define = self.define + from_variant = self.define_from_variant + + cmake_args = [ + define("LLVM_REQUIRES_RTTI", True), + define("LLVM_ENABLE_RTTI", True), + define("LLVM_ENABLE_LIBXML2", False), + define("CLANG_DEFAULT_OPENMP_RUNTIME", "libomp"), + define("LIBOMP_USE_HWLOC", True), + define("LIBOMP_HWLOC_INSTALL_DIR", spec["hwloc"].prefix), + from_variant("LLVM_ENABLE_ZSTD", "zstd"), + ] + + # Flang does not support exceptions from core llvm. + # LLVM_ENABLE_EH=True when building flang will soon + # fail (with changes at the llvm-project level). + # Only enable exceptions in LLVM if we are *not* + # building flang. FYI: LLVM <= 16.x will build flang + # successfully but the executable will suffer from + # link errors looking for C++ EH support. + if "+flang" not in spec: + cmake_args.append(define("LLVM_ENABLE_EH", True)) + + version_suffix = spec.variants["version_suffix"].value + if version_suffix != "none": + cmake_args.append(define("LLVM_VERSION_SUFFIX", version_suffix)) + + shlib_symbol_version = spec.variants.get("shlib_symbol_version", None) + if shlib_symbol_version is not None and shlib_symbol_version.value != "none": + cmake_args.append(define("LLVM_SHLIB_SYMBOL_VERSION", shlib_symbol_version.value)) + + projects = [] + runtimes = [] + + if "+cuda" in spec: + cmake_args.extend( + [ + define("CUDA_TOOLKIT_ROOT_DIR", spec["cuda"].prefix), + define( + "LIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES", + ",".join(spec.variants["cuda_arch"].value), + ), + define( + "CLANG_OPENMP_NVPTX_DEFAULT_ARCH", + "sm_{0}".format(spec.variants["cuda_arch"].value[-1]), + ), + ] + ) + if "openmp=runtime" in spec: + cmake_args.append(define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True)) + else: + # still build libomptarget but disable cuda + cmake_args.extend( + [ + define("CUDA_TOOLKIT_ROOT_DIR", "IGNORE"), + define("CUDA_SDK_ROOT_DIR", "IGNORE"), + define("CUDA_NVCC_EXECUTABLE", "IGNORE"), + define("LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES", "IGNORE"), + ] + ) + + cmake_args.append(from_variant("LIBOMPTARGET_ENABLE_DEBUG", "libomptarget_debug")) + + if spec.satisfies("@14:"): + # The hsa-rocr-dev package may be pulled in through hwloc, which can lead to cmake + # finding libhsa and enabling the AMDGPU plugin. Since we don't support this yet, + # disable explicitly. See commit a05a0c3c2f8eefc80d84b7a87a23a4452d4a3087. + cmake_args.append(define("LIBOMPTARGET_BUILD_AMDGPU_PLUGIN", False)) + + if "+lldb" in spec: + projects.append("lldb") + cmake_args.extend( + [ + define("LLDB_ENABLE_LIBEDIT", True), + define("LLDB_ENABLE_CURSES", True), + define("LLDB_ENABLE_LIBXML2", True), + from_variant("LLDB_ENABLE_LUA", "lua"), + define("LLDB_ENABLE_LZMA", True), + ] + ) + if spec["ncurses"].satisfies("+termlib"): + cmake_args.append(define("LLVM_ENABLE_TERMINFO", True)) + else: + cmake_args.append(define("LLVM_ENABLE_TERMINFO", False)) + if spec.version >= Version("10"): + cmake_args.append(from_variant("LLDB_ENABLE_PYTHON", "python")) + else: + cmake_args.append(define("LLDB_DISABLE_PYTHON", "~python" in spec)) + if spec.satisfies("@5.0.0: +python"): + cmake_args.append(define("LLDB_USE_SYSTEM_SIX", True)) + else: + cmake_args.append(define("LLVM_ENABLE_TERMINFO", False)) + + if "+gold" in spec: + cmake_args.append(define("LLVM_BINUTILS_INCDIR", spec["binutils"].prefix.include)) + + if "+clang" in spec: + projects.append("clang") + projects.append("clang-tools-extra") + if "openmp=runtime" in spec: + runtimes.append("openmp") + elif "openmp=project" in spec: + projects.append("openmp") + + if "+libomptarget" in spec: + cmake_args.append(define("OPENMP_ENABLE_LIBOMPTARGET", True)) + else: + cmake_args.append(define("OPENMP_ENABLE_LIBOMPTARGET", False)) + + if "@8" in spec: + cmake_args.append(from_variant("CLANG_ANALYZER_ENABLE_Z3_SOLVER", "z3")) + elif "@9:" in spec: + cmake_args.append(from_variant("LLVM_ENABLE_Z3_SOLVER", "z3")) + + if "+flang" in spec: + projects.append("flang") + if "+lld" in spec: + projects.append("lld") + if "compiler-rt=runtime" in spec: + runtimes.append("compiler-rt") + elif "compiler-rt=project" in spec: + projects.append("compiler-rt") + if "libcxx=runtime" in spec: + runtimes.extend(["libcxx", "libcxxabi"]) + elif "libcxx=project" in spec: + projects.extend(["libcxx", "libcxxabi"]) + if "+mlir" in spec: + projects.append("mlir") + if "libunwind=runtime" in spec: + runtimes.append("libunwind") + elif "libunwind=project" in spec: + projects.append("libunwind") + if "+polly" in spec: + projects.append("polly") + cmake_args.append(define("LINK_POLLY_INTO_TOOLS", True)) + + cmake_args.extend( + [ + define("BUILD_SHARED_LIBS", False), + from_variant("LLVM_BUILD_LLVM_DYLIB", "llvm_dylib"), + from_variant("LLVM_LINK_LLVM_DYLIB", "link_llvm_dylib"), + from_variant("LLVM_USE_SPLIT_DWARF", "split_dwarf"), + # By default on Linux, libc++.so is a ldscript. CMake fails to add + # CMAKE_INSTALL_RPATH to it, which fails. Statically link libc++abi.a + # into libc++.so, linking with -lc++ or -stdlib=libc++ is enough. + define("LIBCXX_ENABLE_STATIC_ABI_LIBRARY", True), + ] + ) + + cmake_args.append(define("LLVM_TARGETS_TO_BUILD", get_llvm_targets_to_build(spec))) + + cmake_args.append(from_variant("LIBOMP_TSAN_SUPPORT", "libomp_tsan")) + + # From clang 16 onwards we use a more precise --gcc-install-dir flag in post-install + # generated config files. + if self.spec.satisfies("@:15 %gcc"): + cmake_args.append(define("GCC_INSTALL_PREFIX", self.compiler.prefix)) + + if self.spec.satisfies("~code_signing platform=darwin"): + cmake_args.append(define("LLDB_USE_SYSTEM_DEBUGSERVER", True)) + + # LLDB test suite requires libc++ + if "libcxx=none" in spec: + cmake_args.append(define("LLDB_INCLUDE_TESTS", False)) + + # Enable building with CLT [and not require full Xcode] + # https://github.com/llvm/llvm-project/issues/57037 + if self.spec.satisfies("@15.0.0: platform=darwin"): + cmake_args.append(define("BUILTINS_CMAKE_ARGS", "-DCOMPILER_RT_ENABLE_IOS=OFF")) + + # Semicolon seperated list of projects to enable + cmake_args.append(define("LLVM_ENABLE_PROJECTS", projects)) + + # Semicolon seperated list of runtimes to enable + if runtimes: + # The older versions are not careful enough with the order of the runtimes. + # Instead of applying + # https://github.com/llvm/llvm-project/commit/06400a0142af8297b5d39b8f34a7c59db6f9910c, + # which might be incompatible with the version that we install, + # we sort the runtimes here according to the same order as + # in the aforementioned commit: + if self.spec.satisfies("@:14"): + runtimes_order = [ + "libc", + "libunwind", + "libcxxabi", + "libcxx", + "compiler-rt", + "openmp", + ] + runtimes.sort( + key=lambda x: ( + runtimes_order.index(x) if x in runtimes_order else len(runtimes_order) + ) + ) + + # CMake args passed just to runtimes + runtime_cmake_args = [define("CMAKE_INSTALL_RPATH_USE_LINK_PATH", True)] + + # When building runtimes, just-built clang has to know where GCC is. + gcc_install_dir_flag = get_gcc_install_dir_flag(spec, self.compiler) + if gcc_install_dir_flag: + runtime_cmake_args.extend( + [ + define("CMAKE_C_FLAGS", gcc_install_dir_flag), + define("CMAKE_CXX_FLAGS", gcc_install_dir_flag), + ] + ) + + cmake_args.extend( + [ + define("LLVM_ENABLE_RUNTIMES", runtimes), + define("RUNTIMES_CMAKE_ARGS", runtime_cmake_args), + ] + ) + + return cmake_args + + @run_after("install") + def post_install(self): + spec = self.spec + define = self.define + + # unnecessary if we build openmp via LLVM_ENABLE_RUNTIMES + if "+cuda openmp=project" in self.spec: + ompdir = "build-bootstrapped-omp" + prefix_paths = spack.build_environment.get_cmake_prefix_path(self) + prefix_paths.append(str(spec.prefix)) + # rebuild libomptarget to get bytecode runtime library files + with working_dir(ompdir, create=True): + cmake_args = [ + "-G", + "Ninja", + define("CMAKE_BUILD_TYPE", spec.variants["build_type"].value), + define("CMAKE_C_COMPILER", spec.prefix.bin + "/clang"), + define("CMAKE_CXX_COMPILER", spec.prefix.bin + "/clang++"), + define("CMAKE_INSTALL_PREFIX", spec.prefix), + define("CMAKE_PREFIX_PATH", prefix_paths), + ] + cmake_args.extend(self.cmake_args()) + cmake_args.extend( + [ + define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True), + self.stage.source_path + "/openmp", + ] + ) + + cmake(*cmake_args) + ninja() + ninja("install") + if "+python" in self.spec: + if spec.version < Version("17.0.0"): + # llvm bindings were removed in v17: + # https://releases.llvm.org/17.0.1/docs/ReleaseNotes.html#changes-to-the-python-bindings + install_tree("llvm/bindings/python", python_platlib) + + if "+clang" in self.spec: + install_tree("clang/bindings/python", python_platlib) + + with working_dir(self.build_directory): + install_tree("bin", join_path(self.prefix, "libexec", "llvm")) + + cfg_files = [] + if spec.satisfies("+clang"): + cfg_files.extend(("clang.cfg", "clang++.cfg")) + if spec.satisfies("@19: +flang"): + # The config file is `flang.cfg` even though the executable is `flang-new`. + # `--gcc-install-dir` / `--gcc-toolchain` support was only added in LLVM 19. + cfg_files.append("flang.cfg") + gcc_install_dir_flag = get_gcc_install_dir_flag(spec, self.compiler) + if gcc_install_dir_flag: + for cfg in cfg_files: + with open(os.path.join(self.prefix.bin, cfg), "w") as f: + print(gcc_install_dir_flag, file=f) + + def llvm_config(self, *args, **kwargs): + lc = Executable(self.prefix.bin.join("llvm-config")) + if not kwargs.get("output"): + kwargs["output"] = str + ret = lc(*args, **kwargs) + if kwargs.get("result") == "list": + return ret.split() + else: + return ret + + +def get_gcc_install_dir_flag(spec: Spec, compiler) -> Optional[str]: + """Get the --gcc-install-dir=... flag, so that clang does not do a system scan for GCC.""" + if not spec.satisfies("@16: %gcc"): + return None + gcc = Executable(compiler.cc) + libgcc_path = gcc("-print-file-name=libgcc.a", output=str, fail_on_error=False).strip() + if not os.path.isabs(libgcc_path): + return None + libgcc_dir = os.path.dirname(libgcc_path) + return f"--gcc-install-dir={libgcc_dir}" if os.path.exists(libgcc_dir) else None + + +def get_llvm_targets_to_build(spec): + targets = spec.variants["targets"].value + + # Build everything? + if "all" in targets: + return "all" + + # Convert targets variant values to CMake LLVM_TARGETS_TO_BUILD array. + spack_to_cmake = { + "aarch64": "AArch64", + "amdgpu": "AMDGPU", + "arm": "ARM", + "avr": "AVR", + "bpf": "BPF", + "cppbackend": "CppBackend", + "hexagon": "Hexagon", + "lanai": "Lanai", + "mips": "Mips", + "msp430": "MSP430", + "nvptx": "NVPTX", + "powerpc": "PowerPC", + "riscv": "RISCV", + "sparc": "Sparc", + "systemz": "SystemZ", + "webassembly": "WebAssembly", + "x86": "X86", + "xcore": "XCore", + } + + if "none" in targets: + llvm_targets = set() + else: + llvm_targets = set(spack_to_cmake[target] for target in targets) + + if spec.target.family in ("x86", "x86_64"): + llvm_targets.add("X86") + elif spec.target.family == "arm": + llvm_targets.add("ARM") + elif spec.target.family == "aarch64": + llvm_targets.add("AArch64") + elif spec.target.family in ("sparc", "sparc64"): + llvm_targets.add("Sparc") + elif spec.target.family in ("ppc64", "ppc64le", "ppc", "ppcle"): + llvm_targets.add("PowerPC") + + return list(llvm_targets) diff --git a/spack-repos/externals/packages/llvm/sanitizer-ipc_perm_mode.patch b/spack-repos/externals/packages/llvm/sanitizer-ipc_perm_mode.patch new file mode 100644 index 000000000..e270f230e --- /dev/null +++ b/spack-repos/externals/packages/llvm/sanitizer-ipc_perm_mode.patch @@ -0,0 +1,53 @@ +# ipc_perm.mode is not used and has changed from short to int over architectures +# and versions. The last change was in glibc-2.31. +# LLVM upstream decided to not check ipc_perm.mode below glibc-2.31, +# because it is not actually used in the sanitizer: +# https://reviews.llvm.org/D70662 +# +# We need the patch to be applicable when="@5:9" and, therefore, cannot +# fetch it from the upstream repo. + +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1126,8 +1126,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + CHECK_SIZE_AND_OFFSET(ipc_perm, gid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); +-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) +-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ ++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) ++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit ++ on many architectures. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -203,26 +203,13 @@ namespace __sanitizer { + u64 __unused1; + u64 __unused2; + #elif defined(__sparc__) +-#if defined(__arch64__) + unsigned mode; +- unsigned short __pad1; +-#else +- unsigned short __pad1; +- unsigned short mode; + unsigned short __pad2; +-#endif + unsigned short __seq; + unsigned long long __unused1; + unsigned long long __unused2; +-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) +- unsigned int mode; +- unsigned short __seq; +- unsigned short __pad1; +- unsigned long __unused1; +- unsigned long __unused2; + #else +- unsigned short mode; +- unsigned short __pad1; ++ unsigned int mode; + unsigned short __seq; + unsigned short __pad2; + #if defined(__x86_64__) && !defined(_LP64) diff --git a/spack-repos/externals/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch b/spack-repos/externals/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch new file mode 100644 index 000000000..d4477390f --- /dev/null +++ b/spack-repos/externals/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch @@ -0,0 +1,11 @@ +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -1250,7 +1250,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd); + CHECK_SIZE_AND_OFFSET(group, gr_gid); + CHECK_SIZE_AND_OFFSET(group, gr_mem); + +-#if HAVE_RPC_XDR_H ++#if HAVE_RPC_XDR_H && !SANITIZER_MAC + CHECK_TYPE_SIZE(XDR); + CHECK_SIZE_AND_OFFSET(XDR, x_op); + CHECK_SIZE_AND_OFFSET(XDR, x_ops); diff --git a/spack-repos/externals/packages/llvm/xray_buffer_queue-cstddef.patch b/spack-repos/externals/packages/llvm/xray_buffer_queue-cstddef.patch new file mode 100644 index 000000000..35e635044 --- /dev/null +++ b/spack-repos/externals/packages/llvm/xray_buffer_queue-cstddef.patch @@ -0,0 +1,13 @@ +# The patched file uses size_t, a.k.a. ::size_t (not std::size_t), but does not +# include explicitly. Whether or not the header is included +# implicitly via other headers, depends on the implementation of the standard +# library. Therefore, we should not apply this patch depending on the compiler +# version. Strictly speaking, is not guaranteed to provide ::size_t +# (in contrast to std::size_t). However, it does that in most cases and that is +# what the upstream developers seem to rely on starting LLVM 6.0.0 +# (see https://reviews.llvm.org/D39175). + +--- a/compiler-rt/lib/xray/xray_buffer_queue.h ++++ b/compiler-rt/lib/xray/xray_buffer_queue.h +@@ -18,0 +18,1 @@ ++#include diff --git a/spack-repos/externals/packages/msgpack-c/package.py b/spack-repos/externals/packages/msgpack-c/package.py index 0806cb203..cd5f857d0 100644 --- a/spack-repos/externals/packages/msgpack-c/package.py +++ b/spack-repos/externals/packages/msgpack-c/package.py @@ -11,6 +11,7 @@ class MsgpackC(CMakePackage): homepage = "http://www.msgpack.org" url = "https://github.com/msgpack/msgpack-c/archive/cpp-3.0.1.tar.gz" + version("7.0.0", sha256="070881ebea9208cf7e731fd5a46a11404025b2f260ab9527e32dfcb7c689fbfc") version('3.3.0', sha256='754c3ace499a63e45b77ef4bcab4ee602c2c414f58403bce826b76ffc2f77d0b') version('3.1.1', sha256='bda49f996a73d2c6080ff0523e7b535917cd28c8a79c3a5da54fc29332d61d1e') version('3.0.1', sha256='1b834ab0b5b41da1dbfb96dd4a673f6de7e79dbd7f212f45a553ff9cc54abf3b') @@ -18,7 +19,10 @@ class MsgpackC(CMakePackage): depends_on('cmake@2.8.12:', type='build') depends_on('googletest', type='test') + depends_on('boost', when='@7.0.0:') + patch("update_cmake_minimum_required.patch", when="@3.3.0", sha256="35c18b96d7c96eac7007cdb2df9a9078c4eb4eaf448b2c5765e54edca88b25f0") + def cmake_args(self): args = [ "-DCMAKE_CXX_FLAGS=-Wno-implicit-fallthrough", diff --git a/spack-repos/externals/packages/msgpack-c/update_cmake_minimum_required.patch b/spack-repos/externals/packages/msgpack-c/update_cmake_minimum_required.patch new file mode 100644 index 000000000..dd342384e --- /dev/null +++ b/spack-repos/externals/packages/msgpack-c/update_cmake_minimum_required.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f9762d1d..6eebb52f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12) ++CMAKE_MINIMUM_REQUIRED (VERSION 3.26) + + IF ((CMAKE_VERSION VERSION_GREATER 3.1) OR + (CMAKE_VERSION VERSION_EQUAL 3.1)) +diff --git a/example/cmake/CMakeLists.txt b/example/cmake/CMakeLists.txt +index 8c885ea5..910aa8e6 100644 +--- a/example/cmake/CMakeLists.txt ++++ b/example/cmake/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.0) ++cmake_minimum_required (VERSION 3.26) + project (example) + + if(EXAMPLE_MSGPACK_EMBEDDED) diff --git a/spack-repos/externals/packages/nlohmann-json/package.py b/spack-repos/externals/packages/nlohmann-json/package.py new file mode 100644 index 000000000..d6be58845 --- /dev/null +++ b/spack-repos/externals/packages/nlohmann-json/package.py @@ -0,0 +1,66 @@ +# Copyright 2013-2024 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 NlohmannJson(CMakePackage): + """JSON for Modern C++""" + + homepage = "https://nlohmann.github.io/json/" + url = "https://github.com/nlohmann/json/archive/v3.1.2.tar.gz" + maintainers("ax3l") + + license("MIT") + + version("3.12.0", sha256="4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187") + version("3.11.3", sha256="0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406") + version("3.11.2", sha256="d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273") + # v3.11.0 & v3.11.1 omitted; released with significant regressions + version("3.10.5", sha256="5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4") + version("3.10.4", sha256="1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3") + version("3.10.3", sha256="e0d7c1b120cac47fa7f14a41d10a5d390f67d423d8e97b9d6834887285d6873c") + version("3.10.2", sha256="081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c") + version("3.10.0", sha256="eb8b07806efa5f95b349766ccc7a8ec2348f3b2ee9975ad879259a371aea8084") + version("3.9.1", sha256="4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b") + version("3.9.0", sha256="9943db11eeaa5b23e58a88fbc26c453faccef7b546e55063ad00e7caaaf76d0b") + version("3.8.0", sha256="7d0edf65f2ac7390af5e5a0b323b31202a6c11d744a74b588dc30f5a8c9865ba") + version("3.7.2", sha256="914c4af3f14bb98ff084172685fba5d32e8ce4390ec8ba5da45c63daa305df4d") + version("3.7.0", sha256="d51a3a8d3efbb1139d7608e28782ea9efea7e7933157e8ff8184901efd8ee760") + version("3.6.1", sha256="80c45b090e40bf3d7a7f2a6e9f36206d3ff710acfa8d8cc1f8c763bb3075e22e") + version("3.5.0", sha256="e0b1fc6cc6ca05706cce99118a87aca5248bd9db3113e703023d23f044995c1d") + version("3.4.0", sha256="c377963a95989270c943d522bfefe7b889ef5ed0e1e15d535fd6f6f16ed70732") + version("3.3.0", sha256="2fd1d207b4669a7843296c41d3b6ac5b23d00dec48dba507ba051d14564aa801") + version("3.2.0", sha256="2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1") + version("3.1.2", sha256="e8fffa6cbdb3c15ecdff32eebf958b6c686bc188da8ad5c6489462d16f83ae54") + version("3.1.1", sha256="9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47") + + variant( + "multiple_headers", default=True, description="Use non-amalgamated version of the library" + ) + + depends_on("cmake@3.8:", type="build") + depends_on("cmake@3.13:", type="test") + + # requires mature C++11 implementations + conflicts("%gcc@:4.7") + # v3.3.0 adds support for gcc 4.8 + # https://github.com/nlohmann/json/releases/tag/v3.3.0 + conflicts("%gcc@:4.8", when="@:3.2.9") + conflicts("%intel@:16") + conflicts("%pgi@:14") + + def cmake_args(self): + return [ + self.define_from_variant("JSON_MultipleHeaders", "multiple_headers"), + self.define("JSON_BuildTests", self.run_tests), + ] + + @when("@3.1.1:") + def check(self): + # cmake_fetch_content_configure relies on git to fetch a file, fails from tar: + # https://github.com/nlohmann/json/discussions/2596 + with working_dir(self.build_directory): + ctest("--output-on-failure", "-LE", "not_reproducible|git_required") diff --git a/spack-repos/externals/packages/openmpi/package.py b/spack-repos/externals/packages/openmpi/package.py index 68689904b..2d0ce51c0 100644 --- a/spack-repos/externals/packages/openmpi/package.py +++ b/spack-repos/externals/packages/openmpi/package.py @@ -43,6 +43,10 @@ class Openmpi(AutotoolsPackage, CudaPackage): version("main", branch="main", submodules=True) # Current + version( + "5.0.9", sha256="dfb72762531170847af3e4a0f21d77d7b23cf36f67ce7ce9033659273677d80b" + ) # libmpi.so.40.40.7 + version( "5.0.3", sha256="990582f206b3ab32e938aa31bbf07c639368e4405dca196fabe7f0f76eeda90b" ) # libmpi.so.40.40.3 diff --git a/spack-repos/externals/packages/pistache/package.py b/spack-repos/externals/packages/pistache/package.py index db46ee9ed..1b053163e 100644 --- a/spack-repos/externals/packages/pistache/package.py +++ b/spack-repos/externals/packages/pistache/package.py @@ -39,16 +39,24 @@ class Pistache(CMakePackage): # fddaq-v5.3.0 and dunedaq-v2.8.0 are the same, except fddaq-v5.3.0 builds # against gcc 13.2.0 because of a patch and dunedaq-v2.8.0 doesn't + # JCF, Dec-30-2025 + + # fddaq-v5.6.0 is also the same, except there's an additional + # patch which will support newer versions of CMake (e.g., v4.1.2) + + version('fddaq-v5.6.0', commit="a54a4fab00252a9") version('fddaq-v5.3.0', commit="a54a4fab00252a9") version('dunedaq-v2.8.0', commit="a54a4fab00252a9") version('master', branch='master') - #depends_on('openssl') + depends_on('libpthread-stubs') depends_on('rapidjson') - #patch('pistache_gcc12.patch', when='@dunedaq-v2.8.0') - patch('build_under_gcc_13.2.0.patch', when='@fddaq-v5.3.0') + patch('build_under_gcc_13.2.0.patch', sha256='455c25d3b54c2ceabe24c5b564a3ab6b6b3b4585c725b77807e38dd16ffce90e', when='@fddaq-v5.3.0') + patch('build_under_gcc_13.2.0.patch', sha256='455c25d3b54c2ceabe24c5b564a3ab6b6b3b4585c725b77807e38dd16ffce90e', when='@fddaq-v5.6.0') + patch("update_cmake_minimum_required.patch", sha256="2dcde02fc983b470ab53d462bcda409eb66549f223c1bc46b5f6e50a4744f55f", when="@fddaq-v5.6.0") + def install(self, spec, prefix): super().install(spec, prefix) diff --git a/spack-repos/externals/packages/pistache/update_cmake_minimum_required.patch b/spack-repos/externals/packages/pistache/update_cmake_minimum_required.patch new file mode 100644 index 000000000..4becb3e97 --- /dev/null +++ b/spack-repos/externals/packages/pistache/update_cmake_minimum_required.patch @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0286647..0a3de6c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.4) ++cmake_minimum_required (VERSION 3.26.3) + + set(CMAKE_BUILD_TYPE_INIT Release) + diff --git a/spack-repos/externals/packages/pugixml/package.py b/spack-repos/externals/packages/pugixml/package.py index 977aa4886..f3f024563 100644 --- a/spack-repos/externals/packages/pugixml/package.py +++ b/spack-repos/externals/packages/pugixml/package.py @@ -24,6 +24,7 @@ class Pugixml(CMakePackage): version('1.9', sha256='d156d35b83f680e40fd6412c4455fdd03544339779134617b9b28d19e11fdba6') version('1.8.1', sha256='00d974a1308e85ca0677a981adc1b2855cb060923181053fb0abf4e2f37b8f39') + patch("update_cmake_minimum_required.patch", when="@1.12.1", sha256="6f44d859b0475fd0ecff8fb5b678589c0f6f3fdb68ef89e885e41b325803460b") variant('pic', default=True, description='Build position-independent code') variant('shared', default=True, description='Build shared libraries') diff --git a/spack-repos/externals/packages/pugixml/update_cmake_minimum_required.patch b/spack-repos/externals/packages/pugixml/update_cmake_minimum_required.patch new file mode 100644 index 000000000..3af3c759c --- /dev/null +++ b/spack-repos/externals/packages/pugixml/update_cmake_minimum_required.patch @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 17f67d1..db0f9b1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.4) ++cmake_minimum_required(VERSION 3.26.3) + project(pugixml VERSION 1.12 LANGUAGES CXX) + + include(CMakePackageConfigHelpers) diff --git a/spack-repos/externals/packages/py-anyconfig/package.py b/spack-repos/externals/packages/py-anyconfig/package.py index 735863542..b93f2e0a0 100644 --- a/spack-repos/externals/packages/py-anyconfig/package.py +++ b/spack-repos/externals/packages/py-anyconfig/package.py @@ -16,6 +16,13 @@ class PyAnyconfig(PythonPackage): maintainers = ['brettviren'] - version('0.9.11', sha256='8888130cde5461cb39379afdd1d09b1b1342356210f0a6743a4b60f9973226f8') + version("0.14.0", sha256="2cdf54af5dae8e91743ded82c54ed9d8aaefa3a9722f5d45e9b5f74b603e014d") + version("0.13.0", sha256="03ff2e1762af388fbbbed1c1ab7f9f1ec006a91da7db3a68b963da6e7795d2ac") + version("0.12.0", sha256="3091d7675740686fade85755537f2a7c6ccefa8659c5bb56174e02ded74b96d5") + version("0.11.1", sha256="050dcade09799cd19c9b1f834e6df710ef824b388e6bb0af8c77be39b158b011") + version("0.11.0", sha256="ec4eaad7250af23c98c86760954781361906b83027ae5b9d4da539e09765d308") + version("0.10.1", sha256="f04a5490da8563c97fad15810b0debc92351dbd4b8058dfd82d32a30a41e7e5c") + version("0.10.0", sha256="d9a25625aa72dd870e0712eac3e70fee50eb243af14b2f0cc6f305ec9191cacf") + version("0.9.11", sha256="8888130cde5461cb39379afdd1d09b1b1342356210f0a6743a4b60f9973226f8") depends_on('py-setuptools', type='build') diff --git a/spack-repos/externals/packages/py-cython/5307.patch b/spack-repos/externals/packages/py-cython/5307.patch new file mode 100644 index 000000000..a86800b8d --- /dev/null +++ b/spack-repos/externals/packages/py-cython/5307.patch @@ -0,0 +1,24 @@ +From 0d01d90aaa0574868db867f64c8504fc847bae9b Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Wed, 2 Feb 2022 23:41:45 +0100 +Subject: [PATCH] Allow globally forcing C file regeneration by setting the env + var CYTHON_FORCE_REGEN=1, e.g. from external build systems. + +--- + Cython/Build/Dependencies.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py +index 1ba574d52f..28c48ed8c3 100644 +--- a/Cython/Build/Dependencies.py ++++ b/Cython/Build/Dependencies.py +@@ -963,6 +963,9 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False, + pythran_options.cplus = True + pythran_options.np_pythran = True + ++ if force is None: ++ force = os.environ.get("CYTHON_FORCE_REGEN") == "1" # allow global overrides for build systems ++ + c_options = CompilationOptions(**options) + cpp_options = CompilationOptions(**options); cpp_options.cplus = True + ctx = c_options.create_context() diff --git a/spack-repos/externals/packages/py-cython/5712.patch b/spack-repos/externals/packages/py-cython/5712.patch new file mode 100644 index 000000000..e820d5f33 --- /dev/null +++ b/spack-repos/externals/packages/py-cython/5712.patch @@ -0,0 +1,23 @@ +From d6b6df173dc43625c22f23503b22253db35848e2 Mon Sep 17 00:00:00 2001 +From: Harmen Stoppels +Date: Tue, 19 Sep 2023 21:36:24 +0200 +Subject: [PATCH] cythonize 0.29.x: use force=None as default instead of + force=False + +--- + Cython/Build/Dependencies.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py +index 28c48ed8c3b..92fa96aa013 100644 +--- a/Cython/Build/Dependencies.py ++++ b/Cython/Build/Dependencies.py +@@ -878,7 +878,7 @@ class Extension_setuptools(Extension): pass + + + # This is the user-exposed entry point. +-def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False, force=False, language=None, ++def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False, force=None, language=None, + exclude_failures=False, **options): + """ + Compile a set of source modules into C/C++ files and return a list of distutils diff --git a/spack-repos/externals/packages/py-cython/package.py b/spack-repos/externals/packages/py-cython/package.py new file mode 100644 index 000000000..8af533449 --- /dev/null +++ b/spack-repos/externals/packages/py-cython/package.py @@ -0,0 +1,95 @@ +# Copyright 2013-2024 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 PyCython(PythonPackage): + """The Cython compiler for writing C extensions for the Python language.""" + + homepage = "https://github.com/cython/cython" + pypi = "cython/Cython-0.29.21.tar.gz" + tags = ["build-tools"] + + license("Apache-2.0") + + version("3.0.8", sha256="8333423d8fd5765e7cceea3a9985dd1e0a5dfeb2734629e1a2ed2d6233d39de6") + version("3.0.7", sha256="fb299acf3a578573c190c858d49e0cf9d75f4bc49c3f24c5a63804997ef09213") + version("3.0.6", sha256="399d185672c667b26eabbdca420c98564583798af3bc47670a8a09e9f19dd660") + version("3.0.5", sha256="39318348db488a2f24e7c84e08bdc82f2624853c0fea8b475ea0b70b27176492") + version("3.0.4", sha256="2e379b491ee985d31e5faaf050f79f4a8f59f482835906efe4477b33b4fbe9ff") + version("3.0.0", sha256="350b18f9673e63101dbbfcf774ee2f57c20ac4636d255741d76ca79016b1bd82") + version("0.29.36", sha256="41c0cfd2d754e383c9eeb95effc9aa4ab847d0c9747077ddd7c0dcb68c3bc01f") + version("0.29.35", sha256="6e381fa0bf08b3c26ec2f616b19ae852c06f5750f4290118bf986b6f85c8c527") + version("0.29.34", sha256="1909688f5d7b521a60c396d20bba9e47a1b2d2784bfb085401e1e1e7d29a29a8") + version("0.29.33", sha256="5040764c4a4d2ce964a395da24f0d1ae58144995dab92c6b96f44c3f4d72286a") + version("0.29.32", sha256="8733cf4758b79304f2a4e39ebfac5e92341bce47bcceb26c1254398b2f8c1af7") + version("0.29.30", sha256="2235b62da8fe6fa8b99422c8e583f2fb95e143867d337b5c75e4b9a1a865f9e3") + version("0.29.24", sha256="cdf04d07c3600860e8c2ebaad4e8f52ac3feb212453c1764a49ac08c827e8443") + version("0.29.23", sha256="6a0d31452f0245daacb14c979c77e093eb1a546c760816b5eed0047686baad8e") + version("0.29.22", sha256="df6b83c7a6d1d967ea89a2903e4a931377634a297459652e4551734c48195406") + version("0.29.21", sha256="e57acb89bd55943c8d8bf813763d20b9099cc7165c0f16b707631a7654be9cad") + version("0.29.20", sha256="22d91af5fc2253f717a1b80b8bb45acb655f643611983fd6f782b9423f8171c7") + version("0.29.16", sha256="232755284f942cbb3b43a06cd85974ef3c970a021aef19b5243c03ee2b08fa05") + version("0.29.15", sha256="60d859e1efa5cc80436d58aecd3718ff2e74b987db0518376046adedba97ac30") + version("0.29.14", sha256="e4d6bb8703d0319eb04b7319b12ea41580df44fd84d83ccda13ea463c6801414") + version("0.29.13", sha256="c29d069a4a30f472482343c866f7486731ad638ef9af92bfe5fca9c7323d638e") + version("0.29.10", sha256="26229570d6787ff3caa932fe9d802960f51a89239b990d275ae845405ce43857") + version("0.29.7", sha256="55d081162191b7c11c7bfcb7c68e913827dfd5de6ecdbab1b99dab190586c1e8") + version("0.29.5", sha256="9d5290d749099a8e446422adfb0aa2142c711284800fb1eb70f595101e32cbf1") + version("0.29", sha256="94916d1ede67682638d3cc0feb10648ff14dc51fb7a7f147f4fedce78eaaea97") + version("0.28.6", sha256="68aa3c00ef1deccf4dd50f0201d47c268462978c12c42943bc33dc9dc816ac1b") + version("0.28.3", sha256="1aae6d6e9858888144cea147eb5e677830f45faaff3d305d77378c3cba55f526") + version("0.28.1", sha256="152ee5f345012ca3bb7cc71da2d3736ee20f52cd8476e4d49e5e25c5a4102b12") + version("0.25.2", sha256="f141d1f9c27a07b5a93f7dc5339472067e2d7140d1c5a9e20112a5665ca60306") + version("0.23.5", sha256="0ae5a5451a190e03ee36922c4189ca2c88d1df40a89b4f224bc842d388a0d1b6") + version("0.23.4", sha256="fec42fecee35d6cc02887f1eef4e4952c97402ed2800bfe41bbd9ed1a0730d8e") + + + #depends_on("python@:3.14", type=("build", "link", "run")) + #depends_on("python@:3.13", when="@:3.1.2", type=("build", "link", "run")) + depends_on("python@:3.12", when="@:3.0.10", type=("build", "link", "run")) + # https://github.com/cython/cython/issues/5751 (distutils not yet dropped) + depends_on("python@:3.11", when="@:3.0.3", type=("build", "link", "run")) + + # https://github.com/cython/cython/commit/1cd24026e9cf6d63d539b359f8ba5155fd48ae21 + # collections.Iterable was removed in Python 3.10 + #depends_on("python@:3.9", when="@:0.29.14", type=("build", "link", "run")) + + # https://github.com/cython/cython/commit/430e2ca220c8fed49604daf578df98aadb33a87d + #depends_on("python@:3.8", when="@:0.29.13", type=("build", "link", "run")) + + depends_on("py-setuptools", type=("build", "run")) + depends_on("gdb@7.2:", type="test") + + # Backports CYTHON_FORCE_REGEN environment variable + patch("5307.patch", when="@0.29:0.29.33") + patch("5712.patch", when="@0.29") + + @property + def command(self): + """Returns the Cython command""" + return Executable(self.prefix.bin.cython) + + def setup_dependent_build_environment(self, env, dependent_spec): + # If cython is used as a dep, ensure it's used even when pre-generated + # C files are distributed in the tarball. Cython is a small build dep, and + # the time generating C-files is typically less than compiling them. So it's + # fine. It solves an issue where distributed C-sources were generated with + # an old, buggy Cython. In particular Cython regularly depends on cpython + # internals, which can change even in Python patch releases. It looks like + # the Cython folks are coming back from their recommendation to *include* + # pre-generated C-sources in tarballs, see also + # https://github.com/cython/cython/issues/5089 + + # Support for this was backported to 0.29.34, but we patch any 0.29 release + if self.spec.version >= Version("0.29"): + env.set("CYTHON_FORCE_REGEN", "1") + + @run_after("install") + @on_package_attributes(run_tests=True) + def build_test(self): + # Warning: full suite of unit tests takes a very long time + python("runtests.py", "-j", str(make_jobs)) diff --git a/spack-repos/externals/packages/py-moo/package.py b/spack-repos/externals/packages/py-moo/package.py index 5e026ae57..c92a8e1ae 100644 --- a/spack-repos/externals/packages/py-moo/package.py +++ b/spack-repos/externals/packages/py-moo/package.py @@ -27,10 +27,13 @@ class PyMoo(PythonPackage): depends_on('py-jsonschema', type=('build', 'run')) depends_on('py-fastjsonschema', type=('build', 'run')) depends_on('py-jsonpointer', type=('build', 'run')) - depends_on('py-numpy@1.23.0 ~blas ~lapack', type=('build', 'run'), when="@:0.6.4") - depends_on('py-numpy@1.24.0 ~blas ~lapack', type=('build', 'run'), when="@0.6.7:") + depends_on('py-numpy@1.23.0', type=('build', 'run'), when="@:0.6.4") + depends_on('py-numpy@2.1.2', type=('build', 'run'), when="@0.6.7:") + #depends_on('py-numpy@1.26.0', type=('build', 'run'), when="@0.6.7: ^python@:3.11") + #depends_on('py-numpy@2.1.2', type=('build', 'run'), when="@0.6.7: ^python@3.12:") depends_on('py-openpyxl', type=('build', 'run')) depends_on('py-gojsonnet', type=('build', 'run'), when='@0.6.7:') + depends_on('py-setuptools', type=('build'), when='@0.6.7: ^python@3.11:') # DUNE-specific depends_on('py-jsonnet', type=('build', 'run')) diff --git a/spack-repos/externals/packages/py-numpy/blas-lapack-order.patch b/spack-repos/externals/packages/py-numpy/blas-lapack-order.patch deleted file mode 100644 index ac27d87dc..000000000 --- a/spack-repos/externals/packages/py-numpy/blas-lapack-order.patch +++ /dev/null @@ -1,347 +0,0 @@ -Allows you to specify order of BLAS/LAPACK preference -https://github.com/numpy/numpy/pull/13132 -diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py -index 806f4f7d3..0480d7b5a 100644 ---- a/numpy/distutils/system_info.py -+++ b/numpy/distutils/system_info.py -@@ -474,6 +474,13 @@ class LapackSrcNotFoundError(LapackNotFoundError): - the LAPACK_SRC environment variable.""" - - -+class BlasOptNotFoundError(NotFoundError): -+ """ -+ Optimized (vendor) Blas libraries are not found. -+ Falls back to netlib Blas library which has worse performance. -+ A better performance should be easily gained by switching -+ Blas library.""" -+ - class BlasNotFoundError(NotFoundError): - """ - Blas (http://www.netlib.org/blas/) libraries not found. -@@ -1541,139 +1548,219 @@ Make sure that -lgfortran is used for C++ extensions. - class lapack_opt_info(system_info): - - notfounderror = LapackNotFoundError -+ # Default order of LAPACK checks -+ lapack_order = ['mkl', 'openblas', 'atlas', 'accelerate', 'lapack'] - -- def calc_info(self): -+ def _calc_info_mkl(self): -+ info = get_info('lapack_mkl') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- lapack_mkl_info = get_info('lapack_mkl') -- if lapack_mkl_info: -- self.set_info(**lapack_mkl_info) -- return -+ def _calc_info_openblas(self): -+ info = get_info('openblas_lapack') -+ if info: -+ self.set_info(**info) -+ return True -+ info = get_info('openblas_clapack') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- openblas_info = get_info('openblas_lapack') -- if openblas_info: -- self.set_info(**openblas_info) -- return -+ def _calc_info_atlas(self): -+ info = get_info('atlas_3_10_threads') -+ if not info: -+ info = get_info('atlas_3_10') -+ if not info: -+ info = get_info('atlas_threads') -+ if not info: -+ info = get_info('atlas') -+ if info: -+ # Figure out if ATLAS has lapack... -+ # If not we need the lapack library, but not BLAS! -+ l = info.get('define_macros', []) -+ if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \ -+ or ('ATLAS_WITHOUT_LAPACK', None) in l: -+ # Get LAPACK (with possible warnings) -+ # If not found we don't accept anything -+ # since we can't use ATLAS with LAPACK! -+ lapack_info = self._get_info_lapack() -+ if not lapack_info: -+ return False -+ dict_append(info, **lapack_info) -+ self.set_info(**info) -+ return True -+ return False - -- openblas_info = get_info('openblas_clapack') -- if openblas_info: -- self.set_info(**openblas_info) -- return -+ def _calc_info_accelerate(self): -+ info = get_info('accelerate') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- atlas_info = get_info('atlas_3_10_threads') -- if not atlas_info: -- atlas_info = get_info('atlas_3_10') -- if not atlas_info: -- atlas_info = get_info('atlas_threads') -- if not atlas_info: -- atlas_info = get_info('atlas') -- -- accelerate_info = get_info('accelerate') -- if accelerate_info and not atlas_info: -- self.set_info(**accelerate_info) -- return -+ def _get_info_blas(self): -+ # Default to get the optimized BLAS implementation -+ info = get_info('blas_opt') -+ if not info: -+ warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=3) -+ info_src = get_info('blas_src') -+ if not info_src: -+ warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=3) -+ return {} -+ dict_append(info, libraries=[('fblas_src', info_src)]) -+ return info - -- need_lapack = 0 -- need_blas = 0 -- info = {} -- if atlas_info: -- l = atlas_info.get('define_macros', []) -- if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \ -- or ('ATLAS_WITHOUT_LAPACK', None) in l: -- need_lapack = 1 -- info = atlas_info -+ def _get_info_lapack(self): -+ info = get_info('lapack') -+ if not info: -+ warnings.warn(LapackNotFoundError.__doc__ or '', stacklevel=3) -+ info_src = get_info('lapack_src') -+ if not info_src: -+ warnings.warn(LapackSrcNotFoundError.__doc__ or '', stacklevel=3) -+ return {} -+ dict_append(info, libraries=[('flapack_src', info_src)]) -+ return info - -- else: -- warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2) -- need_blas = 1 -- need_lapack = 1 -+ def _calc_info_lapack(self): -+ info = self._get_info_lapack() -+ if info: -+ info_blas = self._get_info_blas() -+ dict_append(info, **info_blas) - dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)]) -+ self.set_info(**info) -+ return True -+ return False - -- if need_lapack: -- lapack_info = get_info('lapack') -- #lapack_info = {} ## uncomment for testing -- if lapack_info: -- dict_append(info, **lapack_info) -- else: -- warnings.warn(LapackNotFoundError.__doc__, stacklevel=2) -- lapack_src_info = get_info('lapack_src') -- if not lapack_src_info: -- warnings.warn(LapackSrcNotFoundError.__doc__, stacklevel=2) -- return -- dict_append(info, libraries=[('flapack_src', lapack_src_info)]) -- -- if need_blas: -- blas_info = get_info('blas') -- if blas_info: -- dict_append(info, **blas_info) -- else: -- warnings.warn(BlasNotFoundError.__doc__, stacklevel=2) -- blas_src_info = get_info('blas_src') -- if not blas_src_info: -- warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2) -- return -- dict_append(info, libraries=[('fblas_src', blas_src_info)]) -+ def calc_info(self): -+ user_order = os.environ.get('NPY_LAPACK_ORDER', None) -+ if user_order is None: -+ lapack_order = self.lapack_order -+ else: -+ # the user has requested the order of the -+ # check they are all in the available list, a COMMA SEPARATED list -+ user_order = user_order.lower().split(',') -+ non_existing = [] -+ lapack_order = [] -+ for order in user_order: -+ if order in self.lapack_order: -+ lapack_order.append(order) -+ elif len(order) > 0: -+ non_existing.append(order) -+ if len(non_existing) > 0: -+ raise ValueError("lapack_opt_info user defined " -+ "LAPACK order has unacceptable " -+ "values: {}".format(non_existing)) -+ -+ for lapack in lapack_order: -+ if getattr(self, '_calc_info_{}'.format(lapack))(): -+ return - -- self.set_info(**info) -- return -+ if 'lapack' not in lapack_order: -+ # Since the user may request *not* to use any library, we still need -+ # to raise warnings to signal missing packages! -+ warnings.warn(LapackNotFoundError.__doc__ or '', stacklevel=2) -+ warnings.warn(LapackSrcNotFoundError.__doc__ or '', stacklevel=2) - - - class blas_opt_info(system_info): - - notfounderror = BlasNotFoundError -+ # Default order of BLAS checks -+ blas_order = ['mkl', 'blis', 'openblas', 'atlas', 'accelerate', 'blas'] - -- def calc_info(self): -+ def _calc_info_mkl(self): -+ info = get_info('blas_mkl') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- blas_mkl_info = get_info('blas_mkl') -- if blas_mkl_info: -- self.set_info(**blas_mkl_info) -- return -+ def _calc_info_blis(self): -+ info = get_info('blis') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- blis_info = get_info('blis') -- if blis_info: -- self.set_info(**blis_info) -- return -+ def _calc_info_openblas(self): -+ info = get_info('openblas') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- openblas_info = get_info('openblas') -- if openblas_info: -- self.set_info(**openblas_info) -- return -+ def _calc_info_atlas(self): -+ info = get_info('atlas_3_10_blas_threads') -+ if not info: -+ info = get_info('atlas_3_10_blas') -+ if not info: -+ info = get_info('atlas_blas_threads') -+ if not info: -+ info = get_info('atlas_blas') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- atlas_info = get_info('atlas_3_10_blas_threads') -- if not atlas_info: -- atlas_info = get_info('atlas_3_10_blas') -- if not atlas_info: -- atlas_info = get_info('atlas_blas_threads') -- if not atlas_info: -- atlas_info = get_info('atlas_blas') -- -- accelerate_info = get_info('accelerate') -- if accelerate_info and not atlas_info: -- self.set_info(**accelerate_info) -- return -+ def _calc_info_accelerate(self): -+ info = get_info('accelerate') -+ if info: -+ self.set_info(**info) -+ return True -+ return False - -- need_blas = 0 -+ def _calc_info_blas(self): -+ # Warn about a non-optimized BLAS library -+ warnings.warn(BlasOptNotFoundError.__doc__ or '', stacklevel=3) - info = {} -- if atlas_info: -- info = atlas_info -+ dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)]) -+ -+ blas = get_info('blas') -+ if blas: -+ dict_append(info, **blas) - else: -- warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2) -- need_blas = 1 -- dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)]) -+ # Not even BLAS was found! -+ warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=3) - -- if need_blas: -- blas_info = get_info('blas') -- if blas_info: -- dict_append(info, **blas_info) -- else: -- warnings.warn(BlasNotFoundError.__doc__, stacklevel=2) -- blas_src_info = get_info('blas_src') -- if not blas_src_info: -- warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2) -- return -- dict_append(info, libraries=[('fblas_src', blas_src_info)]) -+ blas_src = get_info('blas_src') -+ if not blas_src: -+ warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=3) -+ return False -+ dict_append(info, libraries=[('fblas_src', blas_src)]) - - self.set_info(**info) -- return -+ return True -+ -+ def calc_info(self): -+ user_order = os.environ.get('NPY_BLAS_ORDER', None) -+ if user_order is None: -+ blas_order = self.blas_order -+ else: -+ # the user has requested the order of the -+ # check they are all in the available list -+ user_order = user_order.lower().split(',') -+ non_existing = [] -+ blas_order = [] -+ for order in user_order: -+ if order in self.blas_order: -+ blas_order.append(order) -+ elif len(order) > 0: -+ non_existing.append(order) -+ if len(non_existing) > 0: -+ raise ValueError("blas_opt_info user defined BLAS order has unacceptable values: {}".format(non_existing)) -+ -+ for blas in blas_order: -+ if getattr(self, '_calc_info_{}'.format(blas))(): -+ return -+ -+ if 'blas' not in blas_order: -+ # Since the user may request *not* to use any library, we still need -+ # to raise warnings to signal missing packages! -+ warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=2) -+ warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=2) - - - class blas_info(system_info): diff --git a/spack-repos/externals/packages/py-numpy/check_executables4.patch b/spack-repos/externals/packages/py-numpy/check_executables4.patch deleted file mode 100644 index b553acb46..000000000 --- a/spack-repos/externals/packages/py-numpy/check_executables4.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- spack-src/numpy/distutils/fcompiler/__init__.py.orig 2018-11-03 10:49:58.000000000 +0900 -+++ spack-src/numpy/distutils/fcompiler/__init__.py 2021-02-12 17:57:50.632263931 +0900 -@@ -318,7 +318,12 @@ - if not exe_from_environ: - possibles = [f90, f77] + self.possible_executables - else: -- possibles = [exe_from_environ] + self.possible_executables -+ matching_executables = [] -+ for e in exe_from_environ: -+ for p in self.possible_executables: -+ if p in e: -+ matching_executables.append(e) -+ possibles = [matching_executables] + self.possible_executables - - seen = set() - unique_possibles = [] diff --git a/spack-repos/externals/packages/py-numpy/package.py b/spack-repos/externals/packages/py-numpy/package.py index b9cca708a..f25c918a9 100644 --- a/spack-repos/externals/packages/py-numpy/package.py +++ b/spack-repos/externals/packages/py-numpy/package.py @@ -1,20 +1,17 @@ -# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2024 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 platform import subprocess +from typing import Tuple from spack.package import * class PyNumpy(PythonPackage): - """NumPy is the fundamental package for scientific computing with Python. - It contains among other things: a powerful N-dimensional array object, - sophisticated (broadcasting) functions, tools for integrating C/C++ and - Fortran code, and useful linear algebra, Fourier transform, and random - number capabilities""" + """Fundamental package for array computing in Python.""" homepage = "https://numpy.org/" pypi = "numpy/numpy-1.23.0.tar.gz" @@ -22,7 +19,24 @@ class PyNumpy(PythonPackage): maintainers("adamjstewart", "rgommers") + license("BSD-3-Clause") + version("main", branch="main") + version("2.1.2", sha256="13532a088217fa624c99b843eeb54640de23b3414b14aa66d023805eb731066c") + version("2.1.1", sha256="d0cf7d55b1051387807405b3898efafa862997b4cba8aa5dbe657be794afeafd") + version("2.1.0", sha256="7dc90da0081f7e1da49ec4e398ede6a8e9cc4f5ebe5f9e06b443ed889ee9aaa2") + version("2.0.2", sha256="883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78") + version("2.0.1", sha256="485b87235796410c3519a699cfe1faab097e509e90ebb05dcd098db2ae87e7b3") + version("2.0.0", sha256="cf5d1c9e6837f8af9f92b6bd3e86d513cdc11f60fd62185cc49ec7d1aba34864") + version("1.26.4", sha256="2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010") + version("1.26.3", sha256="697df43e2b6310ecc9d95f05d5ef20eacc09c7c4ecc9da3f235d39e71b7da1e4") + version("1.26.2", sha256="f65738447676ab5777f11e6bbbdb8ce11b785e105f690bc45966574816b6d3ea") + version("1.26.1", sha256="c8c6c72d4a9f831f328efb1312642a1cafafaa88981d9ab76368d50d07d93cbe") + version("1.26.0", sha256="f93fc78fe8bf15afe2b8d6b6499f1c73953169fad1e9a8dd086cdff3190e7fdf") + version("1.25.2", sha256="fd608e19c8d7c55021dffd43bfe5492fab8cc105cc8986f813f8c3c048b38760") + version("1.25.1", sha256="9a3a9f3a61480cc086117b426a8bd86869c213fc4072e606f01c4e4b66eb92bf") + version("1.25.0", sha256="f1accae9a28dc3cda46a91de86acf69de0d1b5f4edd44a9b0c3ceb8036dfff19") + version("1.24.4", sha256="80f5e3a4e498641401868df4208b74581206afbee7cf7b8329daae82676d9463") version("1.24.3", sha256="ab344f1bf21f140adab8e47fdbc7c35a477dc01408791f8ba00d018dd0bc5155") version("1.24.2", sha256="003a9f530e880cb2cd177cba1af7220b9aa42def9c4afc2a2fc3ee6be7eb2b22") version("1.24.1", sha256="2386da9a471cc00a1f47845e27d916d5ec5346ae9696e01a8a34760858fe9dd2") @@ -64,56 +78,61 @@ class PyNumpy(PythonPackage): version("1.17.5", sha256="16507ba6617f62ae3c6ab1725ae6f550331025d4d9a369b83f6d5a470446c342") version("1.17.4", sha256="f58913e9227400f1395c7b800503ebfdb0772f1c33ff8cb4d6451c06cabdf316") version("1.17.3", sha256="a0678793096205a4d784bd99f32803ba8100f639cf3b932dc63b21621390ea7e") - version("1.17.2", sha256="73615d3edc84dd7c4aeb212fa3748fb83217e00d201875a47327f55363cef2df") - version("1.17.1", sha256="f11331530f0eff69a758d62c2461cd98cdc2eae0147279d8fc86e0464eb7e8ca") - version("1.17.0", sha256="951fefe2fb73f84c620bec4e001e80a80ddaa1b84dce244ded7f1e0cbe0ed34a") - version("1.16.6", sha256="e5cf3fdf13401885e8eea8170624ec96225e2174eb0c611c6f26dd33b489e3ff") - version("1.16.5", sha256="8bb452d94e964b312205b0de1238dd7209da452343653ab214b5d681780e7a0c") - version("1.16.4", sha256="7242be12a58fec245ee9734e625964b97cf7e3f2f7d016603f9e56660ce479c7") - version("1.16.3", sha256="78a6f89da87eeb48014ec652a65c4ffde370c036d780a995edaeb121d3625621") - version("1.16.2", sha256="6c692e3879dde0b67a9dc78f9bfb6f61c666b4562fd8619632d7043fb5b691b0") - version("1.16.1", sha256="31d3fe5b673e99d33d70cfee2ea8fe8dccd60f265c3ed990873a88647e3dd288") - version("1.16.0", sha256="cb189bd98b2e7ac02df389b6212846ab20661f4bafe16b5a70a6f1728c1cc7cb") - version("1.15.4", sha256="3d734559db35aa3697dadcea492a423118c5c55d176da2f3be9c98d4803fc2a7") - version("1.15.3", sha256="1c0c80e74759fa4942298044274f2c11b08c86230b25b8b819e55e644f5ff2b6") - version("1.15.2", sha256="27a0d018f608a3fe34ac5e2b876f4c23c47e38295c47dd0775cc294cd2614bc1") - version("1.15.2", sha256="27a0d018f608a3fe34ac5e2b876f4c23c47e38295c47dd0775cc294cd2614bc1") - version("1.15.1", sha256="7b9e37f194f8bcdca8e9e6af92e2cbad79e360542effc2dd6b98d63955d8d8a3") - version("1.15.0", sha256="f28e73cf18d37a413f7d5de35d024e6b98f14566a10d82100f9dc491a7d449f9") - version("1.14.6", sha256="1250edf6f6c43e1d7823f0967416bc18258bb271dc536298eb0ea00a9e45b80a") - version("1.14.5", sha256="a4a433b3a264dbc9aa9c7c241e87c0358a503ea6394f8737df1683c7c9a102ac") - - variant("blas", default=True, description="Build with BLAS support") - variant("lapack", default=True, description="Build with LAPACK support") - - # Based on wheel availability on PyPI - depends_on("python@3.8:3.11", when="@1.23.2:", type=("build", "link", "run")) - depends_on("python@3.8:3.10", when="@1.22:1.23.1", type=("build", "link", "run")) - depends_on("python@:3.10", when="@1.21.2:1.21", type=("build", "link", "run")) - depends_on("python@:3.9", when="@1.19.3:1.21.1", type=("build", "link", "run")) - depends_on("python@:3.8", when="@1.17.3:1.19.2", type=("build", "link", "run")) - depends_on("python@:3.7", when="@1.14.5:1.17.2", type=("build", "link", "run")) - - # https://github.com/spack/spack/pull/32078 - depends_on("py-setuptools@:63", type=("build", "run")) - depends_on("py-setuptools@:59", when="@:1.22.1", type=("build", "run")) - # Check pyproject.toml for updates to the required cython version - depends_on("py-cython@0.29.13:2", when="@1.18.0:", type="build") - depends_on("py-cython@0.29.14:2", when="@1.18.1:", type="build") - depends_on("py-cython@0.29.21:2", when="@1.19.1:", type="build") - depends_on("py-cython@0.29.24:2", when="@1.21.2:", type="build") - depends_on("py-cython@0.29.30:2", when="@1.22.4:", type="build") - depends_on("blas", when="+blas") - depends_on("lapack", when="+lapack") - - depends_on("py-nose@1.0.0:", when="@:1.14", type="test") - depends_on("py-pytest", when="@1.15:", type="test") - depends_on("py-hypothesis", when="@1.19:", type="test") - depends_on("py-typing-extensions@4.2:", when="@1.23:", type="test") - - # Allows you to specify order of BLAS/LAPACK preference - # https://github.com/numpy/numpy/pull/13132 - patch("blas-lapack-order.patch", when="@1.15:1.16") + + # JCF, Dec-29-2025: this package.py is vendored from the builtin area + # of Spack 0.23.1, but since right now I'm working with 0.22.0 I need + # to comment out the compiler-as-dependency lines + + #depends_on("c", type="build") + #depends_on("cxx", type="build") + + # Based on PyPI wheel availability + with default_args(type=("build", "link", "run")): + depends_on("python@3.10:3.13", when="@2.1:") + depends_on("python@3.9:3.12", when="@1.26:2.0") + depends_on("python@3.9:3.11", when="@1.25") + depends_on("python@3.8:3.11", when="@1.23.2:1.24") + depends_on("python@3.8:3.10", when="@1.22:1.23.1") + depends_on("python@:3.10", when="@1.21.2:1.21") + depends_on("python@:3.9", when="@1.19.3:1.21.1") + depends_on("python@:3.8", when="@1.17.3:1.19.2") + + with default_args(type="build"): + # Required to use --config-settings + depends_on("py-pip@23.1:", when="@1.26:") + + # Build dependencies (do not include upper bound unless known issues) + depends_on("py-cython@3.0.6:", when="@2:") + depends_on("py-cython@0.29.34:", when="@1.26:") + depends_on("py-cython@0.29.34:2", when="@1.25") + depends_on("py-cython@0.29.30:2", when="@1.22.4:1.24") + depends_on("py-cython@0.29.24:2", when="@1.21.2:1.22.3") + depends_on("py-cython@0.29.21:2", when="@1.19.1:1.21.1") + depends_on("py-cython@0.29.14:2", when="@1.18.1:1.19.0") + depends_on("py-cython@0.29.13:2", when="@1.18.0") + depends_on("py-meson-python@0.15:", when="@1.26.4:") + + depends_on("blas") + depends_on("lapack") + + # requirements/test_requirements.txt + with default_args(type="test"): + depends_on("py-pytest") + depends_on("py-hypothesis", when="@1.19:") + depends_on("py-typing-extensions@4.2:", when="@1.23:") + + # Historical dependencies + with default_args(type="build"): + depends_on("py-pyproject-metadata@0.7.1:", when="@1.26.0:1.26.3") + depends_on("py-tomli@1:", when="@1.26.0:1.26.3 ^python@:3.10") + depends_on("py-setuptools@60:", when="@1.26.0:1.26.3 ^python@3.12:") + depends_on("py-colorama", when="@1.26.0:1.26.3 platform=windows") + depends_on("ninja@1.8.2:", when="@1.26.0:1.26.3") + depends_on("pkgconfig", when="@1.26.0:1.26.3") + + with default_args(type=("build", "run")): + depends_on("py-setuptools@:63", when="@:1.25") + depends_on("py-setuptools@:59", when="@:1.22.1") # Add Fujitsu Fortran compiler patch("add_fj_compiler.patch", when="@1.19.3:1.19.5%fj") @@ -123,7 +142,6 @@ class PyNumpy(PythonPackage): patch("check_executables.patch", when="@1.20.0:") patch("check_executables2.patch", when="@1.19.0:1.19.5") patch("check_executables3.patch", when="@1.16.0:1.18.5") - patch("check_executables4.patch", when="@1.14.0:1.15.4") # Backport bug fix for f2py's define for threading when building with Mingw patch( @@ -139,19 +157,44 @@ class PyNumpy(PythonPackage): when="@1.22.0:1.22.3", ) - # version 1.21.0 runs into an infinit loop during printing + # Patch to fix AVX512 build flags on Intel Classic Compiler + # See https://github.com/spack/spack/issues/42204 + # Numpy before 1.26 did not use meson, so the patch does not work for older versions + with when("%intel"): + patch( + "https://github.com/numpy/numpy/commit/953cc2dfc0f0e063a01778d1392c931d9031c469.patch?full_index=1", + sha256="fe42a018a69cfafb7c4efc183a7c73835a298e45a8f9a585cb411170871ff596", + when="@1.26:1.26.3", + ) + + # meson.build + # https://docs.scipy.org/doc/scipy/dev/toolchain.html#compilers + conflicts("%gcc@:8.3", when="@1.26:", msg="NumPy requires GCC >= 8.4") + conflicts("%gcc@:6.4", when="@1.23:", msg="NumPy requires GCC >= 6.5") + conflicts("%gcc@:4.7", msg="NumPy requires GCC >= 4.8") + conflicts( + "%msvc@:19.19", + when="@1.26:", + msg="NumPy requires at least vc142 (default with Visual Studio 2019) " + "when building with MSVC", + ) + + # version 1.21.0 runs into an infinite loop during printing # (e.g. print(numpy.ones(1000)) when compiled with gcc 11 conflicts("%gcc@11:", when="@1.21.0") - # GCC 4.8 is the minimum version that works - conflicts("%gcc@:4.7", msg="GCC 4.8+ required") - # NVHPC support added in https://github.com/numpy/numpy/pull/17344 conflicts("%nvhpc", when="@:1.19") # See https://github.com/numpy/numpy/issues/22011 conflicts("%intel", when="@1.23.0:1.23.3") conflicts("%oneapi", when="@1.23.0:1.23.3") + # https://github.com/spack/spack/pull/44735 + conflicts("%oneapi", when="@2:") + + @property + def archive_files(self): + return [join_path(self.stage.source_path, "build", "meson-logs", "meson-log.txt")] def url_for_version(self, version): url = "https://files.pythonhosted.org/packages/source/n/numpy/numpy-{}.{}" @@ -187,16 +230,68 @@ def flag_handler(self, name, flags): return (flags, None, None) - @run_before("install") - def set_blas_lapack(self): - # https://numpy.org/devdocs/user/building.html - # https://github.com/numpy/numpy/blob/master/site.cfg.example + def blas_lapack_pkg_config(self) -> Tuple[str, str]: + """Convert library names to pkg-config names. - # Skip if no BLAS/LAPACK requested + Returns: + The names of the blas and lapack libs that pkg-config should search for. + """ spec = self.spec - if "+blas" not in spec and "+lapack" not in spec: - return + blas = spec["blas"].libs.names[0] + lapack = spec["lapack"].libs.names[0] + + if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: + blas = "mkl-dynamic-lp64-seq" + + if spec["lapack"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: + lapack = "mkl-dynamic-lp64-seq" + if spec["blas"].name in ["blis", "amdblis"]: + blas = "blis" + + if spec["blas"].name == "cray-libsci": + blas = "libsci" + + if spec["lapack"].name == "cray-libsci": + lapack = "libsci" + + if "armpl" in blas: + if "_mp" in blas: + blas = "armpl-dynamic-lp64-omp" + else: + blas = "armpl-dynamic-lp64-seq" + + if "armpl" in lapack: + if "_mp" in lapack: + lapack = "armpl-dynamic-lp64-omp" + else: + lapack = "armpl-dynamic-lp64-seq" + + return blas, lapack + + @when("@1.26:") + def config_settings(self, spec, prefix): + blas, lapack = self.blas_lapack_pkg_config() + return { + "builddir": "build", + "compile-args": f"-j{make_jobs}", + "setup-args": { + # https://scipy.github.io/devdocs/building/blas_lapack.html + "-Dblas": blas, + "-Dlapack": lapack, + # https://numpy.org/doc/stable/reference/simd/build-options.html + # TODO: get this working in CI + # "-Dcpu-baseline": "native", + # "-Dcpu-dispatch": "none", + }, + } + + def blas_lapack_site_cfg(self) -> None: + """Write a site.cfg file to configure BLAS/LAPACK.""" + spec = self.spec + + # https://numpy.org/doc/1.25/user/building.html + # https://github.com/numpy/numpy/blob/v1.25.2/site.cfg.example def write_library_dirs(f, dirs): f.write("library_dirs = {0}\n".format(dirs)) if not ( @@ -205,17 +300,11 @@ def write_library_dirs(f, dirs): ): f.write("rpath = {0}\n".format(dirs)) - blas_libs = LibraryList([]) - blas_headers = HeaderList([]) - if "+blas" in spec: - blas_libs = spec["blas"].libs - blas_headers = spec["blas"].headers + blas_libs = spec["blas"].libs + blas_headers = spec["blas"].headers - lapack_libs = LibraryList([]) - lapack_headers = HeaderList([]) - if "+lapack" in spec: - lapack_libs = spec["lapack"].libs - lapack_headers = spec["lapack"].headers + lapack_libs = spec["lapack"].libs + lapack_headers = spec["lapack"].headers lapackblas_libs = lapack_libs + blas_libs lapackblas_headers = lapack_headers + blas_headers @@ -291,52 +380,58 @@ def write_library_dirs(f, dirs): if "^netlib-lapack" in spec or "^cray-libsci" in spec: # netlib and Cray require blas and lapack listed # separately so that scipy can find them - if spec.satisfies("+blas"): - f.write("[blas]\n") - f.write("libraries = {0}\n".format(blas_lib_names)) - write_library_dirs(f, blas_lib_dirs) - f.write("include_dirs = {0}\n".format(blas_header_dirs)) - if spec.satisfies("+lapack"): - f.write("[lapack]\n") - f.write("libraries = {0}\n".format(lapack_lib_names)) - write_library_dirs(f, lapack_lib_dirs) - f.write("include_dirs = {0}\n".format(lapack_header_dirs)) + f.write("[blas]\n") + f.write("libraries = {0}\n".format(blas_lib_names)) + write_library_dirs(f, blas_lib_dirs) + f.write("include_dirs = {0}\n".format(blas_header_dirs)) + f.write("[lapack]\n") + f.write("libraries = {0}\n".format(lapack_lib_names)) + write_library_dirs(f, lapack_lib_dirs) + f.write("include_dirs = {0}\n".format(lapack_header_dirs)) if "^fujitsu-ssl2" in spec: - if spec.satisfies("+blas"): - f.write("[blas]\n") - f.write("libraries = {0}\n".format(spec["blas"].libs.names[0])) - write_library_dirs(f, blas_lib_dirs) - f.write("include_dirs = {0}\n".format(blas_header_dirs)) - f.write("extra_link_args = {0}\n".format(self.spec["blas"].libs.ld_flags)) - if spec.satisfies("+lapack"): - f.write("[lapack]\n") - f.write("libraries = {0}\n".format(spec["lapack"].libs.names[0])) - write_library_dirs(f, lapack_lib_dirs) - f.write("include_dirs = {0}\n".format(lapack_header_dirs)) - f.write("extra_link_args = {0}\n".format(self.spec["lapack"].libs.ld_flags)) + f.write("[blas]\n") + f.write("libraries = {0}\n".format(spec["blas"].libs.names[0])) + write_library_dirs(f, blas_lib_dirs) + f.write("include_dirs = {0}\n".format(blas_header_dirs)) + f.write("extra_link_args = {0}\n".format(self.spec["blas"].libs.ld_flags)) + f.write("[lapack]\n") + f.write("libraries = {0}\n".format(spec["lapack"].libs.names[0])) + write_library_dirs(f, lapack_lib_dirs) + f.write("include_dirs = {0}\n".format(lapack_header_dirs)) + f.write("extra_link_args = {0}\n".format(self.spec["lapack"].libs.ld_flags)) if "^armpl-gcc" in spec or "^acfl" in spec: - if spec.satisfies("+blas"): - f.write("[blas]\n") - f.write("libraries = {0}\n".format(blas_lib_names)) - write_library_dirs(f, blas_lib_dirs) - f.write("include_dirs = {0}\n".format(blas_header_dirs)) - if spec.satisfies("+lapack"): - f.write("[lapack]\n") - f.write("libraries = {0}\n".format(lapack_lib_names)) - write_library_dirs(f, lapack_lib_dirs) - f.write("include_dirs = {0}\n".format(lapack_header_dirs)) + f.write("[blas]\n") + f.write("libraries = {0}\n".format(blas_lib_names)) + write_library_dirs(f, blas_lib_dirs) + f.write("include_dirs = {0}\n".format(blas_header_dirs)) + f.write("[lapack]\n") + f.write("libraries = {0}\n".format(lapack_lib_names)) + write_library_dirs(f, lapack_lib_dirs) + f.write("include_dirs = {0}\n".format(lapack_header_dirs)) + + @when("@:1.25") + @run_before("install") + def set_blas_lapack(self): + self.blas_lapack_site_cfg() + @when("@1.26:") + def setup_build_environment(self, env): + if self.spec.satisfies("%msvc"): + # For meson build system, compiler paths must be in quotes + # to prevent paths from being split by spaces. + env.set("CC", f'"{self.compiler.cc}"') + env.set("CXX", f'"{self.compiler.cxx}"') + + @when("@:1.25") def setup_build_environment(self, env): # Tell numpy which BLAS/LAPACK libraries we want to use. - # https://github.com/numpy/numpy/pull/13132 - # https://numpy.org/devdocs/user/building.html#accelerated-blas-lapack-libraries spec = self.spec - # https://numpy.org/devdocs/user/building.html#blas - if "blas" not in spec: - blas = "" - elif ( + # https://github.com/numpy/numpy/pull/13132 + # https://numpy.org/doc/1.25/user/building.html#accelerated-blas-lapack-libraries + # https://numpy.org/doc/1.25/user/building.html#blas + if ( spec["blas"].name == "intel-mkl" or spec["blas"].name == "intel-parallel-studio" or spec["blas"].name == "intel-oneapi-mkl" @@ -355,10 +450,8 @@ def setup_build_environment(self, env): env.set("NPY_BLAS_ORDER", blas) - # https://numpy.org/devdocs/user/building.html#lapack - if "lapack" not in spec: - lapack = "" - elif ( + # https://numpy.org/doc/1.25/user/building.html#lapack + if ( spec["lapack"].name == "intel-mkl" or spec["lapack"].name == "intel-parallel-studio" or spec["lapack"].name == "intel-oneapi-mkl" diff --git a/spack-repos/externals/packages/python/cpython-windows-externals.patch b/spack-repos/externals/packages/python/cpython-windows-externals.patch new file mode 100644 index 000000000..c3bcce983 --- /dev/null +++ b/spack-repos/externals/packages/python/cpython-windows-externals.patch @@ -0,0 +1,28 @@ +diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat +index b5a44e3..52941c7 100644 +--- a/PCbuild/get_externals.bat ++++ b/PCbuild/get_externals.bat +@@ -76,7 +76,7 @@ for %%e in (%libraries%) do ( + echo.Fetching external binaries... + + set binaries= +-if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi ++if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.3.0 + if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.1k-1 + if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.9.0 + if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06 +diff --git a/PCbuild/python.props b/PCbuild/python.props +index 419d5eb..c66fb07 100644 +--- a/PCbuild/python.props ++++ b/PCbuild/python.props +@@ -59,8 +59,8 @@ + $(ExternalsDir)sqlite-3.35.5.0\ + $(ExternalsDir)bzip2-1.0.6\ + $(ExternalsDir)xz-5.2.2\ +- $(ExternalsDir)libffi\ +- $(ExternalsDir)libffi\$(ArchName)\ ++ $(ExternalsDir)libffi-3.3.0\ ++ $(ExternalsDir)libffi-3.3.0\$(ArchName)\ + $(libffiOutDir)include + $(ExternalsDir)openssl-1.1.1k\ + $(ExternalsDir)openssl-bin-1.1.1k-1\$(ArchName)\ diff --git a/spack-repos/externals/packages/python/fj-rpath-3.1.patch b/spack-repos/externals/packages/python/fj-rpath-3.1.patch new file mode 100644 index 000000000..d25b58da7 --- /dev/null +++ b/spack-repos/externals/packages/python/fj-rpath-3.1.patch @@ -0,0 +1,13 @@ +--- a/Lib/distutils/unixccompiler.py 2009-05-09 21:55:12.000000000 +1000 ++++ b/Lib/distutils/unixccompiler.py 2017-05-13 14:30:18.077518999 +1000 +@@ -215,7 +211,8 @@ + return "-L" + dir + + def _is_gcc(self, compiler_name): +- return "gcc" in compiler_name or "g++" in compiler_name ++ return "gcc" in compiler_name or "g++" in compiler_name \ ++ or "fcc" in compiler_name or "FCC" in compiler_name + + def runtime_library_dir_option(self, dir): + # XXX Hackish, at the very least. See Python bug #445902: + diff --git a/spack-repos/externals/packages/python/fj-rpath-3.9.patch b/spack-repos/externals/packages/python/fj-rpath-3.9.patch new file mode 100644 index 000000000..1542b367e --- /dev/null +++ b/spack-repos/externals/packages/python/fj-rpath-3.9.patch @@ -0,0 +1,11 @@ +--- spack-src/Lib/distutils/unixccompiler.py.org 2022-01-31 14:42:34.000000000 +0900 ++++ spack-src/Lib/distutils/unixccompiler.py 2022-01-31 14:43:19.000000000 +0900 +@@ -212,7 +212,7 @@ + + def _is_gcc(self, compiler_name): + # clang uses same syntax for rpath as gcc +- return any(name in compiler_name for name in ("gcc", "g++", "clang")) ++ return any(name in compiler_name for name in ("gcc", "g++", "clang", "fcc", "FCC")) + + def runtime_library_dir_option(self, dir): + # XXX Hackish, at the very least. See Python bug #445902: diff --git a/spack-repos/externals/packages/python/intel-3.7.patch b/spack-repos/externals/packages/python/intel-3.7.patch new file mode 100644 index 000000000..f2277624a --- /dev/null +++ b/spack-repos/externals/packages/python/intel-3.7.patch @@ -0,0 +1,38 @@ +From 87ed388f41d761ddddc8447e5104569f2436c005 Mon Sep 17 00:00:00 2001 +From: Victor Stinner +Date: Fri, 11 Oct 2019 15:13:51 +0200 +Subject: [PATCH] bpo-37415: Fix stdatomic.h header check for ICC compiler + +Fix stdatomic.h header check for ICC compiler: the ICC implementation +lacks atomic_uintptr_t type which is needed by Python. + +Test: + +* atomic_int and atomic_uintptr_t types +* atomic_load_explicit() and atomic_store_explicit() +* memory_order_relaxed and memory_order_seq_cst constants + +But don't test ATOMIC_VAR_INIT(): it's not used in Python. +--- + configure | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index f1979c1b8124c..1b30a848a77e7 100755 +--- a/configure ++++ b/configure +@@ -16734,9 +16722,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + #include +- atomic_int value = ATOMIC_VAR_INIT(1); ++ atomic_int int_var; ++ atomic_uintptr_t uintptr_var; + int main() { +- int loaded_value = atomic_load(&value); ++ atomic_store_explicit(&int_var, 5, memory_order_relaxed); ++ atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed); ++ int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst); + return 0; + } + diff --git a/spack-repos/externals/packages/python/package.py b/spack-repos/externals/packages/python/package.py new file mode 100644 index 000000000..d4cf686cb --- /dev/null +++ b/spack-repos/externals/packages/python/package.py @@ -0,0 +1,1270 @@ +# Copyright 2013-2024 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 glob +import json +import os +import platform +import re +import subprocess +import sys +from shutil import copy +from typing import Dict, List + +import llnl.util.tty as tty +from llnl.util.lang import dedupe + +from spack.build_environment import dso_suffix, stat_suffix +from spack.package import * +from spack.util.prefix import Prefix + + +class Python(Package): + """The Python programming language.""" + + homepage = "https://www.python.org/" + url = "https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz" + list_url = "https://www.python.org/ftp/python/" + list_depth = 1 + tags = ["windows", "build-tools"] + + maintainers("skosukhin", "scheibelp") + + phases = ["configure", "build", "install"] + + #: phase + install_targets = ["install"] + build_targets: List[str] = [] + + license("0BSD") + + version("3.12.12", sha256="487c908ddf4097a1b9ba859f25fe46d22ccaabfb335880faac305ac62bffb79b") + version("3.12.11", sha256="7b8d59af8216044d2313de8120bfc2cc00a9bd2e542f15795e1d616c51faf3d6") + version("3.12.10", sha256="15d9c623abfd2165fe816ea1fb385d6ed8cf3c664661ab357f1782e3036a6dac") + version("3.12.9", sha256="45313e4c5f0e8acdec9580161d565cf5fea578e3eabf25df7cc6355bf4afa1ee") + version("3.12.8", sha256="5978435c479a376648cb02854df3b892ace9ed7d32b1fead652712bee9d03a45") + version("3.12.7", sha256="73ac8fe780227bf371add8373c3079f42a0dc62deff8d612cd15a618082ab623") + version("3.12.6", sha256="85a4c1be906d20e5c5a69f2466b00da769c221d6a684acfd3a514dbf5bf10a66") + version("3.12.5", sha256="38dc4e2c261d49c661196066edbfb70fdb16be4a79cc8220c224dfeb5636d405") + version("3.12.4", sha256="01b3c1c082196f3b33168d344a9c85fb07bfe0e7ecfe77fee4443420d1ce2ad9") + version("3.12.3", sha256="a6b9459f45a6ebbbc1af44f5762623fa355a0c87208ed417628b379d762dddb0") + version("3.12.2", sha256="a7c4f6a9dc423d8c328003254ab0c9338b83037bd787d680826a5bf84308116e") + version("3.12.1", sha256="d01ec6a33bc10009b09c17da95cc2759af5a580a7316b3a446eb4190e13f97b2") + version("3.12.0", sha256="51412956d24a1ef7c97f1cb5f70e185c13e3de1f50d131c0aac6338080687afb") + version( + "3.11.14", + sha256="563d2a1b2a5ba5d5409b5ecd05a0e1bf9b028cf3e6a6f0c87a5dc8dc3f2d9182", + preferred=True, + ) + version("3.11.13", sha256="0f1a22f4dfd34595a29cf69ee7ea73b9eff8b1cc89d7ab29b3ab0ec04179dad8") + version("3.11.12", sha256="379c9929a989a9d65a1f5d854e011f4872b142259f4fc0a8c4062d2815ed7fba") + version("3.11.11", sha256="883bddee3c92fcb91cf9c09c5343196953cbb9ced826213545849693970868ed") + version("3.11.10", sha256="92f2faf242681bfa406d53a51e17d42c5373affe23a130cd9697e132ef574706") + version("3.11.9", sha256="e7de3240a8bc2b1e1ba5c81bf943f06861ff494b69fda990ce2722a504c6153d") + version("3.11.8", sha256="d3019a613b9e8761d260d9ebe3bd4df63976de30464e5c0189566e1ae3f61889") + version("3.11.7", sha256="068c05f82262e57641bd93458dfa883128858f5f4997aad7a36fd25b13b29209") + version("3.11.6", sha256="c049bf317e877cbf9fce8c3af902436774ecef5249a29d10984ca3a37f7f4736") + version("3.11.5", sha256="a12a0a013a30b846c786c010f2c19dd36b7298d888f7c4bd1581d90ce18b5e58") + version("3.11.4", sha256="85c37a265e5c9dd9f75b35f954e31fbfc10383162417285e30ad25cc073a0d63") + version("3.11.3", sha256="1a79f3df32265d9e6625f1a0b31c28eb1594df911403d11f3320ee1da1b3e048") + version("3.11.2", sha256="2411c74bda5bbcfcddaf4531f66d1adc73f247f529aee981b029513aefdbf849") + version("3.11.1", sha256="baed518e26b337d4d8105679caf68c5c32630d702614fc174e98cb95c46bdfa4") + version("3.11.0", sha256="64424e96e2457abbac899b90f9530985b51eef2905951febd935f0e73414caeb") + version("3.10.13", sha256="698ec55234c1363bd813b460ed53b0f108877c7a133d48bde9a50a1eb57b7e65") + version("3.10.12", sha256="a43cd383f3999a6f4a7db2062b2fc9594fefa73e175b3aedafa295a51a7bb65c") + version("3.10.11", sha256="f3db31b668efa983508bd67b5712898aa4247899a346f2eb745734699ccd3859") + version("3.10.10", sha256="fba64559dde21ebdc953e4565e731573bb61159de8e4d4cedee70fb1196f610d") + version("3.10.9", sha256="4ccd7e46c8898f4c7862910a1703aa0e63525913a519abb2f55e26220a914d88") + version("3.10.8", sha256="f400c3fb394b8bef1292f6dc1292c5fadc3533039a5bc0c3e885f3e16738029a") + version("3.10.7", sha256="1b2e4e2df697c52d36731666979e648beeda5941d0f95740aafbf4163e5cc126") + version("3.10.6", sha256="848cb06a5caa85da5c45bd7a9221bb821e33fc2bdcba088c127c58fad44e6343") + version("3.10.5", sha256="18f57182a2de3b0be76dfc39fdcfd28156bb6dd23e5f08696f7492e9e3d0bf2d") + version("3.10.4", sha256="f3bcc65b1d5f1dc78675c746c98fcee823c038168fc629c5935b044d0911ad28") + version("3.10.3", sha256="5a3b029bad70ba2a019ebff08a65060a8b9b542ffc1a83c697f1449ecca9813b") + version("3.10.2", sha256="3c0ede893011319f9b0a56b44953a3d52c7abf9657c23fb4bc9ced93b86e9c97") + version("3.10.1", sha256="b76117670e7c5064344b9c138e141a377e686b9063f3a8a620ff674fa8ec90d3") + version("3.10.0", sha256="c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758") + version("3.9.18", sha256="504ce8cfd59addc04c22f590377c6be454ae7406cb1ebf6f5a350149225a9354") + version("3.9.17", sha256="8ead58f669f7e19d777c3556b62fae29a81d7f06a7122ff9bc57f7dd82d7e014") + version("3.9.16", sha256="1ad539e9dbd2b42df714b69726e0693bc6b9d2d2c8e91c2e43204026605140c5") + version("3.9.15", sha256="48d1ccb29d5fbaf1fb8f912271d09f7450e426d4dfe95978ef6aaada70ece4d8") + version("3.9.14", sha256="9201836e2c16361b2b7408680502393737d44f227333fe2e5729c7d5f6041675") + version("3.9.13", sha256="829b0d26072a44689a6b0810f5b4a3933ee2a0b8a4bfc99d7c5893ffd4f97c44") + version("3.9.12", sha256="70e08462ebf265012bd2be88a63d2149d880c73e53f1712b7bbbe93750560ae8") + version("3.9.11", sha256="3442400072f582ac2f0df30895558f08883b416c8c7877ea55d40d00d8a93112") + version("3.9.10", sha256="1aa9c0702edbae8f6a2c95f70a49da8420aaa76b7889d3419c186bfc8c0e571e") + version("3.9.9", sha256="2cc7b67c1f3f66c571acc42479cdf691d8ed6b47bee12c9b68430413a17a44ea") + version("3.9.8", sha256="7447fb8bb270942d620dd24faa7814b1383b61fa99029a240025fd81c1db8283") + version("3.9.7", sha256="a838d3f9360d157040142b715db34f0218e535333696a5569dc6f854604eb9d1") + version("3.9.6", sha256="d0a35182e19e416fc8eae25a3dcd4d02d4997333e4ad1f2eee6010aadc3fe866") + version("3.9.5", sha256="e0fbd5b6e1ee242524430dee3c91baf4cbbaba4a72dd1674b90fda87b713c7ab") + version("3.9.4", sha256="66c4de16daa74a825cf9da9ddae1fe020b72c3854b73b1762011cc33f9e4592f") + version("3.9.3", sha256="3afeb61a45b5a2e6f1c0f621bd8cf925a4ff406099fdb3d8c97b993a5f43d048") + version("3.9.2", sha256="7899e8a6f7946748830d66739f2d8f2b30214dad956e56b9ba216b3de5581519") + version("3.9.1", sha256="29cb91ba038346da0bd9ab84a0a55a845d872c341a4da6879f462e94c741f117") + version("3.9.0", sha256="df796b2dc8ef085edae2597a41c1c0a63625ebd92487adaef2fed22b567873e8") + version("3.8.18", sha256="7c5df68bab1be81a52dea0cc2e2705ea00553b67107a301188383d7b57320b16") + version("3.8.17", sha256="def428fa6cf61b66bcde72e3d9f7d07d33b2e4226f04f9d6fce8384c055113ae") + version("3.8.16", sha256="71ca9d935637ed2feb59e90a368361dc91eca472a90acb1d344a2e8178ccaf10") + version("3.8.15", sha256="924d46999df82aa2eaa1de5ca51d6800ffb56b4bf52486a28f40634e3362abc4") + version("3.8.14", sha256="41f959c480c59211feb55d5a28851a56c7e22d02ef91035606ebb21011723c31") + version("3.8.13", sha256="903b92d76354366b1d9c4434d0c81643345cef87c1600adfa36095d7b00eede4") + version("3.8.12", sha256="316aa33f3b7707d041e73f246efedb297a70898c4b91f127f66dc8d80c596f1a") + version("3.8.11", sha256="b77464ea80cec14581b86aeb7fb2ff02830e0abc7bcdc752b7b4bdfcd8f3e393") + version("3.8.10", sha256="b37ac74d2cbad2590e7cd0dd2b3826c29afe89a734090a87bf8c03c45066cb65") + version("3.8.9", sha256="9779ec1df000bf86914cdd40860b88da56c1e61db59d37784beca14a259ac9e9") + version("3.8.8", sha256="76c0763f048e4f9b861d24da76b7dd5c7a3ba7ec086f40caedeea359263276f7") + version("3.8.7", sha256="20e5a04262f0af2eb9c19240d7ec368f385788bba2d8dfba7e74b20bab4d2bac") + version("3.8.6", sha256="313562ee9986dc369cd678011bdfd9800ef62fbf7b1496228a18f86b36428c21") + version("3.8.5", sha256="015115023c382eb6ab83d512762fe3c5502fa0c6c52ffebc4831c4e1a06ffc49") + version("3.8.4", sha256="32c4d9817ef11793da4d0d95b3191c4db81d2e45544614e8449255ca9ae3cc18") + version("3.8.3", sha256="6af6d4d2e010f9655518d0fc6738c7ff7069f10a4d2fbd55509e467f092a8b90") + version("3.8.2", sha256="e634a7a74776c2b89516b2e013dda1728c89c8149b9863b8cea21946daf9d561") + version("3.8.1", sha256="c7cfa39a43b994621b245e029769e9126caa2a93571cee2e743b213cceac35fb") + version("3.8.0", sha256="f1069ad3cae8e7ec467aa98a6565a62a48ef196cb8f1455a245a08db5e1792df") + version( + "3.7.17", + sha256="fd50161bc2a04f4c22a0971ff0f3856d98b4bf294f89740a9f06b520aae63b49", + deprecated=True, + ) + version( + "3.7.16", + sha256="0cf2da07fa464636755215415909e22eb1d058817af4824bc15af8390d05fb38", + deprecated=True, + ) + version( + "3.7.15", + sha256="cf2993798ae8430f3af3a00d96d9fdf320719f4042f039380dca79967c25e436", + deprecated=True, + ) + version( + "3.7.14", + sha256="82b2abf8978caa61a9011d166eede831b32de9cbebc0db8162900fa23437b709", + deprecated=True, + ) + version( + "3.7.13", + sha256="e405417f50984bc5870c7e7a9f9aeb93e9d270f5ac67f667a0cd3a09439682b5", + deprecated=True, + ) + version( + "3.7.12", + sha256="33b4daaf831be19219659466d12645f87ecec6eb21d4d9f9711018a7b66cce46", + deprecated=True, + ) + version( + "3.7.11", + sha256="b4fba32182e16485d0a6022ba83c9251e6a1c14676ec243a9a07d3722cd4661a", + deprecated=True, + ) + version( + "3.7.10", + sha256="c9649ad84dc3a434c8637df6963100b2e5608697f9ba56d82e3809e4148e0975", + deprecated=True, + ) + version( + "3.7.9", + sha256="39b018bc7d8a165e59aa827d9ae45c45901739b0bbb13721e4f973f3521c166a", + deprecated=True, + ) + version( + "3.7.8", + sha256="0e25835614dc221e3ecea5831b38fa90788b5389b99b675a751414c858789ab0", + deprecated=True, + ) + version( + "3.7.7", + sha256="8c8be91cd2648a1a0c251f04ea0bb4c2a5570feb9c45eaaa2241c785585b475a", + deprecated=True, + ) + version( + "3.7.6", + sha256="aeee681c235ad336af116f08ab6563361a0c81c537072c1b309d6e4050aa2114", + deprecated=True, + ) + version( + "3.7.5", + sha256="8ecc681ea0600bbfb366f2b173f727b205bb825d93d2f0b286bc4e58d37693da", + deprecated=True, + ) + version( + "3.7.4", + sha256="d63e63e14e6d29e17490abbe6f7d17afb3db182dbd801229f14e55f4157c4ba3", + deprecated=True, + ) + version( + "3.7.3", + sha256="d62e3015f2f89c970ac52343976b406694931742fbde2fed8d1ce8ebb4e1f8ff", + deprecated=True, + ) + version( + "3.7.2", + sha256="f09d83c773b9cc72421abba2c317e4e6e05d919f9bcf34468e192b6a6c8e328d", + deprecated=True, + ) + version( + "3.7.1", + sha256="36c1b81ac29d0f8341f727ef40864d99d8206897be96be73dc34d4739c9c9f06", + deprecated=True, + ) + version( + "3.7.0", + sha256="85bb9feb6863e04fb1700b018d9d42d1caac178559ffa453d7e6a436e259fd0d", + deprecated=True, + ) + + extendable = True + + # Variants to avoid cyclical dependencies for concretizer + variant("libxml2", default=True, description="Use a gettext library build with libxml2") + + variant( + "debug", default=False, description="debug build with extra checks (this is high overhead)" + ) + + variant("shared", default=True, description="Enable shared libraries") + variant("pic", default=True, description="Produce position-independent code (for shared libs)") + variant( + "optimizations", + default=False, + description="Enable expensive build-time optimizations, if available", + ) + # See https://legacy.python.org/dev/peps/pep-0394/ + variant( + "pythoncmd", + default=sys.platform != "win32", + description="Symlink 'python3' executable to 'python' (not PEP 394 compliant)", + ) + + # Optional Python modules + variant("readline", default=sys.platform != "win32", description="Build readline module") + variant("ssl", default=True, description="Build ssl module") + variant("sqlite3", default=True, description="Build sqlite3 module") + variant("dbm", default=True, description="Build dbm module") + variant("nis", default=False, description="Build nis module") + variant("zlib", default=True, description="Build zlib module") + variant("bz2", default=True, description="Build bz2 module") + variant("lzma", default=True, description="Build lzma module") + variant("pyexpat", default=True, description="Build pyexpat module") + variant("ctypes", default=True, description="Build ctypes module") + variant("tkinter", default=False, description="Build tkinter module") + variant("uuid", default=True, description="Build uuid module") + variant("tix", default=False, description="Build Tix module", when="+tkinter") + variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=linux") + variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=darwin") + variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=cray") + + if sys.platform != "win32": + depends_on("gmake", type="build") + depends_on("pkgconfig@0.9.0:", type="build") + depends_on("gettext +libxml2", when="+libxml2") + depends_on("gettext ~libxml2", when="~libxml2") + + # Optional dependencies + # See detect_modules() in setup.py for details + depends_on("readline", when="+readline") + depends_on("ncurses", when="+readline") + depends_on("openssl", when="+ssl") + # https://docs.python.org/3/whatsnew/3.7.html#build-changes + depends_on("openssl@1.0.2:", when="+ssl") + # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes + depends_on("openssl@1.1.1:", when="@3.10:+ssl") + depends_on("sqlite@3.0.8:", when="@:3.9+sqlite3") + # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes + depends_on("sqlite@3.7.15:", when="@3.10:+sqlite3") + depends_on("gdbm", when="+dbm") # alternatively ndbm or berkeley-db + depends_on("libnsl", when="+nis") + depends_on("zlib-api", when="+zlib") + depends_on("bzip2", when="+bz2") + depends_on("xz libs=shared", when="+lzma") + depends_on("expat", when="+pyexpat") + depends_on("libffi", when="+ctypes") + # https://docs.python.org/3/whatsnew/3.11.html#build-changes + depends_on("tk@8.5.12:", when="@3.11: +tkinter") + depends_on("tk", when="+tkinter") + depends_on("tcl@8.5.12:", when="@3.11: +tkinter") + depends_on("tcl", when="+tkinter") + depends_on("uuid", when="+uuid") + depends_on("tix", when="+tix") + depends_on("libxcrypt", when="+crypt") + + # Python needs to be patched to build extensions w/ mixed C/C++ code: + # https://github.com/NixOS/nixpkgs/pull/19585/files + # https://bugs.python.org/issue1222585 + # + # NOTE: This patch puts Spack's default Python installation out of + # sync with standard Python installs. If you're using such an + # installation as an external and encountering build issues with mixed + # C/C++ modules, consider installing a Spack-managed Python with + # this patch instead. For more information, see: + # https://github.com/spack/spack/pull/16856 + patch("python-3.7.2-distutils-C++.patch", when="@3.7.2") + patch("python-3.7.3-distutils-C++.patch", when="@3.7.3") + patch("python-3.7.4+-distutils-C++.patch", when="@3.7.4:3.10") + patch("python-3.7.4+-distutils-C++-testsuite.patch", when="@3.7.4:3.11") + patch("python-3.11-distutils-C++.patch", when="@3.11.0:3.11") + patch("cpython-windows-externals.patch", when="@:3.9.6 platform=windows") + patch("tkinter-3.7.patch", when="@3.7 platform=darwin") + # Patch the setup script to deny that tcl/x11 exists rather than allowing + # autodetection of (possibly broken) system components + patch("tkinter-3.8.patch", when="@3.8:3.9 ~tkinter") + 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: + 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") + patch("fj-rpath-3.9.patch", when="@3.9.8:3.9,3.10.1:3.11 %fj") + + # Fixes build with the Intel compilers + # https://github.com/python/cpython/pull/16717 + patch("intel-3.7.patch", when="@3.7.1:3.7.5 %intel") + + # CPython tries to build an Objective-C file with GCC's C frontend + # https://github.com/spack/spack/pull/16222 + # https://github.com/python/cpython/pull/13306 + conflicts( + "%gcc platform=darwin", + msg="CPython does not compile with GCC on macOS yet, use clang. " + "See: https://github.com/python/cpython/pull/13306", + ) + conflicts("%nvhpc") + + # https://bugs.python.org/issue45405 + conflicts("@:3.7.12,3.8.0:3.8.12,3.9.0:3.9.7,3.10.0", when="%apple-clang@13:") + + # See https://github.com/python/cpython/issues/106424 + # datetime.now(timezone.utc) segfaults + conflicts("@3.9:", when="%oneapi@2022.2.1:2023") + + # Used to cache various attributes that are expensive to compute + _config_vars: Dict[str, Dict[str, str]] = {} + + # An in-source build with --enable-optimizations fails for python@3.X + build_directory = "spack-build" + + executables = [r"^python\d?$"] + + @classmethod + def determine_version(cls, exe): + # Newer versions of Python support `--version`, + # but older versions only support `-V` + # Output looks like: + # Python 3.7.7 + # On pre-production Ubuntu, this is also possible: + # Python 3.10.2+ + output = Executable(exe)("-V", output=str, error=str) + match = re.search(r"Python\s+([A-Za-z0-9_.-]+)", output) + return match.group(1) if match else None + + @classmethod + def determine_variants(cls, exes, version_str): + python = Executable(exes[0]) + + variants = "" + for exe in exes: + if os.path.basename(exe) == "python": + variants += "+pythoncmd" + break + else: + variants += "~pythoncmd" + + for module in [ + "readline", + "sqlite3", + "dbm", + "nis", + "zlib", + "bz2", + "lzma", + "ctypes", + "tkinter", + "uuid", + ]: + try: + python("-c", "import " + module, error=os.devnull) + variants += "+" + module + except ProcessError: + variants += "~" + module + + # Some variants enable multiple modules + try: + python("-c", "import ssl", error=os.devnull) + python("-c", "import hashlib", error=os.devnull) + variants += "+ssl" + except ProcessError: + variants += "~ssl" + + try: + python("-c", "import xml.parsers.expat", error=os.devnull) + python("-c", "import xml.etree.ElementTree", error=os.devnull) + variants += "+pyexpat" + except ProcessError: + variants += "~pyexpat" + + # Some variant names do not match module names + if "+tkinter" in variants: + try: + python("-c", "import tkinter.tix", error=os.devnull) + variants += "+tix" + except ProcessError: + variants += "~tix" + + # Some modules are platform-dependent + if sys.platform != "win32": + try: + python("-c", "import crypt", error=os.devnull) + variants += "+crypt" + except ProcessError: + variants += "~crypt" + + return variants + + def url_for_version(self, version): + url = "https://www.python.org/ftp/python/{0}/Python-{1}.tgz" + return url.format(re.split("[a-z]", str(version))[0], version) + + def patch(self): + # NOTE: Python's default installation procedure makes it possible for a + # user's local configurations to change the Spack installation. In + # order to prevent this behavior for a full installation, we must + # modify the installation script so that it ignores user files. + ff = FileFilter("Makefile.pre.in") + ff.filter( + r"^(.*)setup\.py(.*)((build)|(install))(.*)$", r"\1setup.py\2 --no-user-cfg \3\6" + ) + + def setup_build_environment(self, env): + spec = self.spec + + # TODO: Python has incomplete support for Python modules with mixed + # C/C++ source, and patches are required to enable building for these + # modules. All Python versions without a viable patch are installed + # with a warning message about this potentially erroneous behavior. + if not spec.satisfies("@3.7.2:"): + tty.warn( + ( + 'Python v{0} does not have the C++ "distutils" patch; ' + "errors may occur when installing Python modules w/ " + "mixed C/C++ source files." + ).format(self.version) + ) + + env.unset("PYTHONPATH") + env.unset("PYTHONHOME") + + # avoid build error on fugaku + if spec.satisfies("@3.10.0 arch=linux-rhel8-a64fx"): + if spec.satisfies("%gcc") or spec.satisfies("%fj"): + env.unset("LC_ALL") + + # https://github.com/python/cpython/issues/87275 + if spec.satisfies("@:3.9.5 +optimizations %apple-clang"): + xcrun = Executable("/usr/bin/xcrun") + env.set("LLVM_AR", xcrun("-find", "ar", output=str).strip()) + + def flag_handler(self, name, flags): + # python 3.8 requires -fwrapv when compiled with intel + if self.spec.satisfies("@3.8: %intel"): + if name == "cflags": + flags.append("-fwrapv") + + # Fix for following issues for python with aocc%3.2.0: + # https://github.com/spack/spack/issues/29115 + # https://github.com/spack/spack/pull/28708 + if self.spec.satisfies("%aocc@3.2.0"): + if name == "cflags": + flags.extend(["-mllvm", "-disable-indvar-simplify=true"]) + + # allow flags to be passed through compiler wrapper + return (flags, None, None) + + @property + def plat_arch(self): + """ + String referencing platform architecture + filtered through Python's Windows build file + architecture support map + + Note: This function really only makes + sense to use on Windows, could be overridden to + cross compile however. + """ + + arch_map = {"AMD64": "x64", "x86": "Win32", "IA64": "Win32", "EM64T": "Win32"} + arch = platform.machine() + if arch in arch_map: + arch = arch_map[arch] + return arch + + @property + def win_build_params(self): + """ + Arguments must be passed to the Python build batch script + in order to configure it to spec and system. + A number of these toggle optional MSBuild Projects + directly corresponding to the python support of the same + name. + """ + args = [] + args.append("-p %s" % self.plat_arch) + if self.spec.satisfies("+debug"): + args.append("-d") + if self.spec.satisfies("~ctypes"): + args.append("--no-ctypes") + if self.spec.satisfies("~ssl"): + args.append("--no-ssl") + if self.spec.satisfies("~tkinter"): + args.append("--no-tkinter") + return args + + def win_installer(self, prefix): + """ + Python on Windows does not export an install target + so we must handcraft one here. This structure + directly mimics the install tree of the Python + Installer on Windows. + + Parameters: + prefix (str): Install prefix for package + """ + proj_root = self.stage.source_path + pcbuild_root = os.path.join(proj_root, "PCbuild") + build_root = os.path.join(pcbuild_root, platform.machine().lower()) + include_dir = os.path.join(proj_root, "Include") + copy_tree(include_dir, prefix.include) + doc_dir = os.path.join(proj_root, "Doc") + copy_tree(doc_dir, prefix.Doc) + tools_dir = os.path.join(proj_root, "Tools") + copy_tree(tools_dir, prefix.Tools) + lib_dir = os.path.join(proj_root, "Lib") + copy_tree(lib_dir, prefix.Lib) + pyconfig = os.path.join(proj_root, "PC", "pyconfig.h") + copy(pyconfig, prefix.include) + shared_libraries = [] + shared_libraries.extend(glob.glob("%s\\*.exe" % build_root)) + shared_libraries.extend(glob.glob("%s\\*.dll" % build_root)) + shared_libraries.extend(glob.glob("%s\\*.pyd" % build_root)) + os.makedirs(prefix.DLLs) + for lib in shared_libraries: + file_name = os.path.basename(lib) + if ( + file_name.endswith(".exe") + or (file_name.endswith(".dll") and "python" in file_name) + or "vcruntime" in file_name + ): + copy(lib, prefix) + else: + copy(lib, prefix.DLLs) + static_libraries = glob.glob("%s\\*.lib" % build_root) + os.makedirs(prefix.libs, exist_ok=True) + for lib in static_libraries: + copy(lib, prefix.libs) + + def configure_args(self): + spec = self.spec + config_args = [] + cflags = [] + + # setup.py needs to be able to read the CPPFLAGS and LDFLAGS + # as it scans for the library and headers to build + link_deps = spec.dependencies(deptype="link") + + if link_deps: + # Header files are often included assuming they reside in a + # subdirectory of prefix.include, e.g. #include , + # which is why we don't use HeaderList here. The header files of + # libffi reside in prefix.lib but the configure script of Python + # finds them using pkg-config. + cppflags = " ".join("-I" + spec[dep.name].prefix.include for dep in link_deps) + + # Currently, the only way to get SpecBuildInterface wrappers of the + # dependencies (which we need to get their 'libs') is to get them + # using spec.__getitem__. + ldflags = " ".join(spec[dep.name].libs.search_flags for dep in link_deps) + + config_args.extend(["CPPFLAGS=" + cppflags, "LDFLAGS=" + ldflags]) + + if "+optimizations" in spec: + config_args.append("--enable-optimizations") + # Prefer thin LTO for faster compilation times. + if "@3.11.0: %clang@3.9:" in spec or "@3.11.0: %apple-clang@8:" in spec: + config_args.append("--with-lto=thin") + else: + config_args.append("--with-lto") + config_args.append("--with-computed-gotos") + + if spec.satisfies("@3.7 %intel"): + config_args.append("--with-icc={0}".format(spack_cc)) + + if "+debug" in spec: + config_args.append("--with-pydebug") + else: + config_args.append("--without-pydebug") + + if "+shared" in spec: + config_args.append("--enable-shared") + else: + config_args.append("--disable-shared") + + config_args.append("--without-ensurepip") + + if "+pic" in spec: + cflags.append(self.compiler.cc_pic_flag) + + if "+ssl" in spec: + config_args.append("--with-openssl={0}".format(spec["openssl"].prefix)) + + if "+dbm" in spec: + # Default order is ndbm:gdbm:bdb + config_args.append("--with-dbmliborder=gdbm") + else: + config_args.append("--with-dbmliborder=") + + if "+pyexpat" in spec: + config_args.append("--with-system-expat") + else: + config_args.append("--without-system-expat") + + if "+ctypes" in spec: + config_args.append("--with-system-ffi") + else: + config_args.append("--without-system-ffi") + + if "+tkinter" in spec: + config_args.extend( + [ + "--with-tcltk-includes=-I{0} -I{1}".format( + spec["tcl"].prefix.include, spec["tk"].prefix.include + ), + "--with-tcltk-libs={0} {1}".format( + spec["tcl"].libs.ld_flags, spec["tk"].libs.ld_flags + ), + ] + ) + + # https://docs.python.org/3.8/library/sqlite3.html#f1 + if spec.satisfies("+sqlite3 ^sqlite+dynamic_extensions"): + config_args.append("--enable-loadable-sqlite-extensions") + + if spec.satisfies("%oneapi"): + cflags.append("-fp-model=strict") + + if cflags: + config_args.append("CFLAGS={0}".format(" ".join(cflags))) + + return config_args + + def configure(self, spec, prefix): + """Runs configure with the arguments specified in + :meth:`~spack.build_systems.autotools.AutotoolsPackage.configure_args` + and an appropriately set prefix. + """ + with working_dir(self.stage.source_path, create=True): + if sys.platform == "win32": + pass + else: + options = getattr(self, "configure_flag_args", []) + options += ["--prefix={0}".format(prefix)] + options += self.configure_args() + configure(*options) + + def build(self, spec, prefix): + """Makes the build targets specified by + :py:attr:``~.AutotoolsPackage.build_targets`` + """ + # Windows builds use a batch script to drive + # configure and build in one step + with working_dir(self.stage.source_path): + if sys.platform == "win32": + pcbuild_root = os.path.join(self.stage.source_path, "PCbuild") + builder_cmd = os.path.join(pcbuild_root, "build.bat") + try: + subprocess.check_output( # novermin + " ".join([builder_cmd] + self.win_build_params), stderr=subprocess.STDOUT + ) + except subprocess.CalledProcessError as e: + raise ProcessError( + "Process exited with status %d" % e.returncode, + long_message=e.output.decode("utf-8"), + ) + else: + # See https://autotools.io/automake/silent.html + params = ["V=1"] + params += self.build_targets + make(*params) + + def install(self, spec, prefix): + """Makes the install targets specified by + :py:attr:``~.AutotoolsPackage.install_targets`` + """ + with working_dir(self.stage.source_path): + if sys.platform == "win32": + self.win_installer(prefix) + else: + # See https://github.com/python/cpython/issues/102007 + make(*self.install_targets, parallel=False) + + @run_after("install") + def filter_compilers(self): + """Run after install to tell the configuration files and Makefiles + to use the compilers that Spack built the package with. + + If this isn't done, they'll have CC and CXX set to Spack's generic + cc and c++. We want them to be bound to whatever compiler + they were built with.""" + if sys.platform == "win32": + return + kwargs = {"ignore_absent": True, "backup": False, "string": True} + + filenames = [self.get_sysconfigdata_name(), self.config_vars["makefile_filename"]] + + filter_file(spack_cc, self.compiler.cc, *filenames, **kwargs) + if spack_cxx and self.compiler.cxx: + filter_file(spack_cxx, self.compiler.cxx, *filenames, **kwargs) + + @run_after("install") + def symlink(self): + if sys.platform == "win32": + return + spec = self.spec + prefix = self.prefix + + if spec.satisfies("+pythoncmd"): + os.symlink(os.path.join(prefix.bin, "python3"), os.path.join(prefix.bin, "python")) + os.symlink( + os.path.join(prefix.bin, "python3-config"), + os.path.join(prefix.bin, "python-config"), + ) + + @run_after("install") + def install_python_gdb(self): + # https://devguide.python.org/gdb/ + src = os.path.join("Tools", "gdb", "libpython.py") + if os.path.exists(src): + install(src, self.command.path + "-gdb.py") + + @run_after("install") + @on_package_attributes(run_tests=True) + def import_tests(self): + """Test that basic Python functionality works.""" + + spec = self.spec + + with working_dir("spack-test", create=True): + # Ensure that readline module works + if "+readline" in spec: + self.command("-c", "import readline") + + # Ensure that ssl module works + if "+ssl" in spec: + self.command("-c", "import ssl") + self.command("-c", "import hashlib") + + # Ensure that sqlite3 module works + if "+sqlite3" in spec: + self.command("-c", "import sqlite3") + + # Ensure that dbm module works + if "+dbm" in spec: + self.command("-c", "import dbm") + + # Ensure that nis module works + if "+nis" in spec: + self.command("-c", "import nis") + + # Ensure that zlib module works + if "+zlib" in spec: + self.command("-c", "import zlib") + + # Ensure that bz2 module works + if "+bz2" in spec: + self.command("-c", "import bz2") + + # Ensure that lzma module works + if "+lzma" in spec: + self.command("-c", "import lzma") + + # Ensure that pyexpat module works + if "+pyexpat" in spec: + self.command("-c", "import xml.parsers.expat") + self.command("-c", "import xml.etree.ElementTree") + + # Ensure that ctypes module works + if "+ctypes" in spec: + self.command("-c", "import ctypes") + + # Ensure that tkinter module works + # https://wiki.python.org/moin/TkInter + if "+tkinter" in spec: + # Only works if ForwardX11Trusted is enabled, i.e. `ssh -Y` + if "DISPLAY" in env: + self.command("-c", "import tkinter; tkinter._test()") + else: + self.command("-c", "import tkinter") + + # Ensure that uuid module works + if "+uuid" in spec: + self.command("-c", "import uuid") + + # Ensure that tix module works + if "+tix" in spec: + self.command("-c", "import tkinter.tix") + + # Ensure that crypt module works + if "+crypt" in spec: + self.command("-c", "import crypt") + + # ======================================================================== + # Set up environment to make install easy for python extensions. + # ======================================================================== + + @property + def command(self): + """Returns the Python command, which may vary depending + on the version of Python and how it was installed. + + In general, Python 3 only comes with a ``python3`` command. However, some + package managers will symlink ``python`` to ``python3``, while others + may contain ``python3.11``, ``python3.10``, and ``python3.9`` in the + same directory. + + Returns: + Executable: the Python command + """ + # We need to be careful here. If the user is using an externally + # installed python, several different commands could be located + # in the same directory. Be as specific as possible. Search for: + # + # * python3.11 + # * python3 + # * python + # + # in that order if using python@3.11.0, for example. + version = self.spec.version + for ver in [version.up_to(2), version.up_to(1), ""]: + if sys.platform != "win32": + path = os.path.join(self.prefix.bin, "python{0}".format(ver)) + else: + path = os.path.join(self.prefix, "python{0}.exe".format(ver)) + if os.path.exists(path): + return Executable(path) + + else: + # Give a last try at rhel8 platform python + if self.spec.external and self.prefix == "/usr" and self.spec.satisfies("os=rhel8"): + path = os.path.join(self.prefix, "libexec", "platform-python") + if os.path.exists(path): + return Executable(path) + + msg = "Unable to locate {0} command in {1}" + raise RuntimeError(msg.format(self.name, self.prefix.bin)) + + @property + def config_vars(self): + """Return a set of variable definitions associated with a Python installation. + + Wrapper around various ``sysconfig`` functions. To see these variables on the + command line, run: + + .. code-block:: console + + $ python -m sysconfig + + Returns: + dict: variable definitions + """ + cmd = """ +import json +from sysconfig import ( + get_config_vars, + get_config_h_filename, + get_makefile_filename, + get_paths, +) + +config = get_config_vars() +config['config_h_filename'] = get_config_h_filename() +config['makefile_filename'] = get_makefile_filename() +config.update(get_paths()) + +print(json.dumps(config)) +""" + + dag_hash = self.spec.dag_hash() + lib_prefix = "lib" if sys.platform != "win32" else "" + if dag_hash not in self._config_vars: + # Default config vars + version = self.version.up_to(2) + if sys.platform == "win32": + version = str(version).split(".")[0] + config = { + # get_config_vars + "BINDIR": self.prefix.bin, + "CC": "cc", + "CONFINCLUDEPY": self.prefix.include.join("python{}").format(version), + "CXX": "c++", + "INCLUDEPY": self.prefix.include.join("python{}").format(version), + "LIBDEST": self.prefix.lib.join("python{}").format(version), + "LIBDIR": self.prefix.lib, + "LIBPL": self.prefix.lib.join("python{0}") + .join("config-{0}-{1}") + .format(version, sys.platform), + "LDLIBRARY": "{}python{}.{}".format(lib_prefix, version, dso_suffix), + "LIBRARY": "{}python{}.{}".format(lib_prefix, version, stat_suffix), + "LDSHARED": "cc", + "LDCXXSHARED": "c++", + "PYTHONFRAMEWORKPREFIX": "/System/Library/Frameworks", + "base": self.prefix, + "installed_base": self.prefix, + "installed_platbase": self.prefix, + "platbase": self.prefix, + "prefix": self.prefix, + # get_config_h_filename + "config_h_filename": self.prefix.include.join("python{}") + .join("pyconfig.h") + .format(version), + # get_makefile_filename + "makefile_filename": self.prefix.lib.join("python{0}") + .join("config-{0}-{1}") + .Makefile.format(version, sys.platform), + # get_paths + "data": self.prefix, + "include": self.prefix.include.join("python{}".format(version)), + "platinclude": self.prefix.include64.join("python{}".format(version)), + "platlib": self.prefix.lib64.join("python{}".format(version)).join( + "site-packages" + ), + "platstdlib": self.prefix.lib64.join("python{}".format(version)), + "purelib": self.prefix.lib.join("python{}".format(version)).join("site-packages"), + "scripts": self.prefix.bin, + "stdlib": self.prefix.lib.join("python{}".format(version)), + } + + try: + config.update(json.loads(self.command("-c", cmd, output=str))) + except (ProcessError, RuntimeError): + pass + self._config_vars[dag_hash] = config + return self._config_vars[dag_hash] + + def get_sysconfigdata_name(self): + """Return the full path name of the sysconfigdata file.""" + + libdest = self.config_vars["LIBDEST"] + + cmd = "from sysconfig import _get_sysconfigdata_name; " + cmd += "print(_get_sysconfigdata_name())" + filename = self.command("-c", cmd, output=str).strip() + filename += ".py" + + return join_path(libdest, filename) + + @property + def home(self): + """Most of the time, ``PYTHONHOME`` is simply + ``spec['python'].prefix``. However, if the user is using an + externally installed python, it may be symlinked. For example, + Homebrew installs python in ``/usr/local/Cellar/python/2.7.12_2`` + and symlinks it to ``/usr/local``. Users may not know the actual + installation directory and add ``/usr/local`` to their + ``packages.yaml`` unknowingly. Query the python executable to + determine exactly where it is installed. + """ + return Prefix(self.config_vars["base"]) + + def find_library(self, library): + # Spack installs libraries into lib, except on openSUSE where it installs them + # into lib64. If the user is using an externally installed package, it may be + # in either lib or lib64, so we need to ask Python where its LIBDIR is. + libdir = self.config_vars["LIBDIR"] + + # Debian and derivatives use a triplet subdir under /usr/lib, LIBPL can be used + # to get the Python library directory + libpldir = self.config_vars["LIBPL"] + + # The system Python installation on macOS and Homebrew installations + # install libraries into a Frameworks directory + frameworkprefix = self.config_vars["PYTHONFRAMEWORKPREFIX"] + + # Get the active Xcode environment's Framework location. + macos_developerdir = os.environ.get("DEVELOPER_DIR") + if macos_developerdir and os.path.exists(macos_developerdir): + macos_developerdir = os.path.join(macos_developerdir, "Library", "Frameworks") + else: + macos_developerdir = "" + + # Windows libraries are installed directly to BINDIR + win_bin_dir = self.config_vars["BINDIR"] + win_root_dir = self.config_vars["prefix"] + + directories = [ + libdir, + libpldir, + frameworkprefix, + macos_developerdir, + win_bin_dir, + win_root_dir, + ] + + # The Python shipped with Xcode command line tools isn't in any of these locations + for subdir in ["lib", "lib64"]: + directories.append(os.path.join(self.config_vars["base"], subdir)) + + directories = dedupe(directories) + for directory in directories: + path = os.path.join(directory, library) + if os.path.exists(path): + return LibraryList(path) + + @property + def libs(self): + py_version = self.version.up_to(2) + if sys.platform == "win32": + py_version = str(py_version).replace(".", "") + lib_prefix = "lib" if sys.platform != "win32" else "" + # The values of LDLIBRARY and LIBRARY aren't reliable. Intel Python uses a + # static binary but installs shared libraries, so sysconfig reports + # libpythonX.Y.a but only libpythonX.Y.so exists. So we add our own paths, too. + + # With framework python on macOS, self.config_vars["LDLIBRARY"] can point + # to a library that is not linkable because it does not have the required + # suffix of a shared library (it is called "Python" without extention). + # The linker then falls back to libPython.tbd in the default macOS + # software tree, which security settings prohibit to link against + # (your binary is not an allowed client of /path/to/libPython.tbd). + # To avoid this, we replace the entry in config_vars with a default value. + file_extension_shared = os.path.splitext(self.config_vars["LDLIBRARY"])[-1] + if file_extension_shared == "": + shared_libs = [] + else: + shared_libs = [self.config_vars["LDLIBRARY"]] + shared_libs += ["{}python{}.{}".format(lib_prefix, py_version, dso_suffix)] + # Like LDLIBRARY for Python on Mac OS, LIBRARY may refer to an un-linkable object + file_extension_static = os.path.splitext(self.config_vars["LIBRARY"])[-1] + if file_extension_static == "": + static_libs = [] + else: + static_libs = [self.config_vars["LIBRARY"]] + static_libs += ["{}python{}.{}".format(lib_prefix, py_version, stat_suffix)] + + # The +shared variant isn't reliable, as `spack external find` currently can't + # detect it. If +shared, prefer the shared libraries, but check for static if + # those aren't found. Vice versa for ~shared. + if "+shared" in self.spec: + candidates = shared_libs + static_libs + else: + candidates = static_libs + shared_libs + + candidates = dedupe(candidates) + + for candidate in candidates: + lib = self.find_library(candidate) + if lib: + return lib + + raise spack.error.NoLibrariesError( + "Unable to find {} libraries with the following names:\n\n* ".format(self.name) + + "\n* ".join(candidates) + ) + + @property + def headers(self): + # Locations where pyconfig.h could be + # This varies by system, especially on macOS where the command line tools are + # installed in a very different directory from the system python interpreter. + py_version = str(self.version.up_to(2)) + candidates = [ + os.path.dirname(self.config_vars["config_h_filename"]), + self.config_vars["INCLUDEPY"], + self.config_vars["CONFINCLUDEPY"], + os.path.join(self.config_vars["base"], "include", py_version), + os.path.join(self.config_vars["base"], "Headers"), + ] + candidates = list(dedupe(candidates)) + + for directory in candidates: + headers = find_headers("pyconfig", directory) + if headers: + config_h = headers[0] + break + else: + raise spack.error.NoHeadersError( + "Unable to locate {} headers in any of these locations:\n\n* ".format(self.name) + + "\n* ".join(candidates) + ) + + headers.directories = [os.path.dirname(config_h)] + return headers + + # https://docs.python.org/3/library/sysconfig.html#installation-paths + # https://discuss.python.org/t/understanding-site-packages-directories/12959 + # https://github.com/pypa/pip/blob/22.1/src/pip/_internal/locations/__init__.py + # https://github.com/pypa/installer/pull/103 + + # NOTE: XCode Python's sysconfing module was incorrectly patched, and hard-codes + # everything to be installed in /Library/Python. Therefore, we need to use a + # fallback in the following methods. For more information, see: + # https://github.com/pypa/pip/blob/22.1/src/pip/_internal/locations/__init__.py#L486 + + @property + def platlib(self): + """Directory for site-specific, platform-specific files. + + Exact directory depends on platform/OS/Python version. Examples include: + + * ``lib/pythonX.Y/site-packages`` on most POSIX systems + * ``lib64/pythonX.Y/site-packages`` on RHEL/CentOS/Fedora with system Python + * ``lib/pythonX/dist-packages`` on Debian/Ubuntu with system Python + * ``lib/python/site-packages`` on macOS with framework Python + * ``Lib/site-packages`` on Windows + + Returns: + str: platform-specific site-packages directory + """ + prefix = self.config_vars["platbase"] + os.sep + path = self.config_vars["platlib"] + if path.startswith(prefix): + return path.replace(prefix, "") + return os.path.join("lib64", f"python{self.version.up_to(2)}", "site-packages") + + @property + def purelib(self): + """Directory for site-specific, non-platform-specific files. + + Exact directory depends on platform/OS/Python version. Examples include: + + * ``lib/pythonX.Y/site-packages`` on most POSIX systems + * ``lib/pythonX/dist-packages`` on Debian/Ubuntu with system Python + * ``lib/python/site-packages`` on macOS with framework Python + * ``Lib/site-packages`` on Windows + + Returns: + str: platform-independent site-packages directory + """ + prefix = self.config_vars["base"] + os.sep + path = self.config_vars["purelib"] + if path.startswith(prefix): + return path.replace(prefix, "") + return os.path.join("lib", f"python{self.version.up_to(2)}", "site-packages") + + @property + def include(self): + """Directory for non-platform-specific header files. + + Exact directory depends on platform/Python version/ABI flags. Examples include: + + * ``include/pythonX.Y`` on most POSIX systems + * ``include/pythonX.Yd`` for debug builds + * ``include/pythonX.Ym`` for malloc builds + * ``include/pythonX.Yu`` for wide unicode builds + * ``include`` on macOS with framework Python + * ``Include`` on Windows + + Returns: + str: platform-independent header file directory + """ + prefix = self.config_vars["installed_base"] + os.sep + path = self.config_vars["include"] + if path.startswith(prefix): + return path.replace(prefix, "") + return os.path.join("include", "python{}".format(self.version.up_to(2))) + + def setup_dependent_build_environment(self, env, dependent_spec): + """Set PYTHONPATH to include the site-packages directory for the + extension and any other python extensions it depends on. + """ + # We need to make sure that the extensions are compiled and linked with + # the Spack wrapper. Paths to the executables that are used for these + # operations are normally taken from the sysconfigdata file, which we + # modify after the installation (see method filter compilers). The + # modified file contains paths to the real compilers, not the wrappers. + # The values in the file, however, can be overridden with environment + # variables. The first variable, CC (CXX), which is used for + # compilation, is set by Spack for the dependent package by default. + # That is not 100% correct because the value for CC (CXX) in the + # sysconfigdata file often contains additional compiler flags (e.g. + # -pthread), which we lose by simply setting CC (CXX) to the path to the + # Spack wrapper. Moreover, the user might try to build an extension with + # a compiler that is different from the one that was used to build + # Python itself, which might have unexpected side effects. However, the + # experience shows that none of the above is a real issue and we will + # not try to change the default behaviour. Given that, we will simply + # try to modify LDSHARED (LDCXXSHARED), the second variable, which is + # used for linking, in a consistent manner. + + for compile_var, link_var in [("CC", "LDSHARED"), ("CXX", "LDCXXSHARED")]: + # First, we get the values from the sysconfigdata: + config_compile = self.config_vars[compile_var] + config_link = self.config_vars[link_var] + + # The dependent environment will have the compilation command set to + # the following: + new_compile = join_path( + spack.paths.build_env_path, + dependent_spec.package.compiler.link_paths[compile_var.lower()], + ) + + # Normally, the link command starts with the compilation command: + if config_link.startswith(config_compile): + new_link = new_compile + config_link[len(config_compile) :] + else: + # Otherwise, we try to replace the compiler command if it + # appears "in the middle" of the link command; to avoid + # mistaking some substring of a path for the compiler (e.g. to + # avoid replacing "gcc" in "-L/path/to/gcc/"), we require that + # the compiler command be surrounded by spaces. Note this may + # leave "config_link" unchanged if the compilation command does + # not appear in the link command at all, for example if "ld" is + # invoked directly (no change would be required in that case + # because Spack arranges for the Spack ld wrapper to be the + # first instance of "ld" in PATH). + new_link = config_link.replace(f" {config_compile} ", f" {new_compile} ") + + # There is logic in the sysconfig module that is sensitive to the + # fact that LDSHARED is set in the environment, therefore we export + # the variable only if the new value is different from what we got + # from the sysconfigdata file: + if config_link != new_link and sys.platform != "win32": + env.set(link_var, new_link) + + def setup_dependent_run_environment(self, env, dependent_spec): + """Set PYTHONPATH to include the site-packages directory for the + extension and any other python extensions it depends on. + """ + if not dependent_spec.package.extends(self.spec) or dependent_spec.dependencies( + "python-venv" + ): + return + + # Packages may be installed in platform-specific or platform-independent site-packages + # directories + for directory in {self.platlib, self.purelib}: + env.prepend_path("PYTHONPATH", os.path.join(dependent_spec.prefix, directory)) + + def setup_dependent_package(self, module, dependent_spec): + """Called before python modules' install() methods.""" + module.python = self.command + module.python_include = join_path(dependent_spec.prefix, self.include) + module.python_platlib = join_path(dependent_spec.prefix, self.platlib) + module.python_purelib = join_path(dependent_spec.prefix, self.purelib) + + def test_hello_world(self): + """run simple hello world program""" + # do not use self.command because we are also testing the run env + python = self.spec["python"].command + + msg = "hello world!" + out = python("-c", f'print("{msg}")', output=str.split, error=str.split) + assert msg in out + + def test_import_executable(self): + """ensure import of installed executable works""" + python = self.spec["python"].command + + out = python("-c", "import sys; print(sys.executable)", output=str.split, error=str.split) + assert self.spec.prefix in out diff --git a/spack-repos/externals/packages/python/python-3.11-distutils-C++.patch b/spack-repos/externals/packages/python/python-3.11-distutils-C++.patch new file mode 100644 index 000000000..335e06b93 --- /dev/null +++ b/spack-repos/externals/packages/python/python-3.11-distutils-C++.patch @@ -0,0 +1,257 @@ +diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py +index aa66c8b9f4..71e6556bac 100644 +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ + # configuration variables that may contain universal build flags, + # like "-arch" or "-isdkroot", that may need customization for + # the user environment +-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', +- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', +- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', +- 'PY_CORE_CFLAGS', 'PY_CORE_LDFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_LDFLAGS', 'PY_CORE_CFLAGS') + + # configuration variables that may contain compiler calls +-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') ++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') + + # prefix added to original configuration variable names + _INITPRE = '_OSX_SUPPORT_INITIAL_' +diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py +index 66c12dd358..dddb9fd2d4 100644 +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -123,8 +123,10 @@ def __init__(self, verbose=0, dry_run=0, force=0): + # dllwrap 2.10.90 is buggy + if self.ld_version >= "2.10.90": + self.linker_dll = "gcc" ++ self.linker_dll_cxx = "g++" + else: + self.linker_dll = "dllwrap" ++ self.linker_dll_cxx = "dllwrap" + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static +@@ -138,9 +140,13 @@ def __init__(self, verbose=0, dry_run=0, force=0): + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll_cxx, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -164,8 +170,12 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + raise CompileError(msg) + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -300,9 +310,14 @@ def __init__(self, verbose=0, dry_run=0, force=0): + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, shared_option, + entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 3414a761e7..f1af560cc1 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -216,9 +216,11 @@ def customize_compiler(compiler): + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -233,19 +235,27 @@ def customize_compiler(compiler): + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: +- cflags = cflags + ' ' + os.environ['CFLAGS'] ++ cflags = os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -254,13 +264,17 @@ def customize_compiler(compiler): + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + + compiler.shared_lib_extension = shlib_suffix +diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py +index d00c48981e..4a3d271fee 100644 +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -110,12 +113,19 @@ def preprocess(self, source, output_file=None, macros=None, + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _osx_support.compiler_fixup(compiler_so, + cc_args + extra_postargs) ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, ++ cc_args + extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -173,30 +183,16 @@ def link(self, target_desc, objects, + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i += 1 +- +- if os.path.basename(linker[i]) == 'ld_so_aix': +- # AIX platforms prefix the compiler with the ld_so_aix +- # script, so we need to adjust our linker index +- offset = 1 ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] + else: +- offset = 0 +- +- linker[i+offset] = self.compiler_cxx[i] ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +diff --git a/Makefile.pre.in b/Makefile.pre.in +index f803391346..090f14c46c 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -732,9 +732,9 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + + diff --git a/spack-repos/externals/packages/python/python-3.7.2-distutils-C++.patch b/spack-repos/externals/packages/python/python-3.7.2-distutils-C++.patch new file mode 100644 index 000000000..5728fad6f --- /dev/null +++ b/spack-repos/externals/packages/python/python-3.7.2-distutils-C++.patch @@ -0,0 +1,241 @@ +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ __all__ = [ + # configuration variables that may contain universal build flags, + # like "-arch" or "-isdkroot", that may need customization for + # the user environment +-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', +- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', +- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', +- 'PY_CORE_CFLAGS', 'PY_CORE_LDFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_LDFLAGS', 'PY_CORE_CFLAGS') + + # configuration variables that may contain compiler calls +-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') ++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') + + # prefix added to original configuration variable names + _INITPRE = '_OSX_SUPPORT_INITIAL_' +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler): + # dllwrap 2.10.90 is buggy + if self.ld_version >= "2.10.90": + self.linker_dll = "gcc" ++ self.linker_dll_cxx = "g++" + else: + self.linker_dll = "dllwrap" ++ self.linker_dll_cxx = "dllwrap" + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static +@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler): + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll_cxx, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler): + raise CompileError(msg) + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler): + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, shared_option, + entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -170,9 +170,11 @@ def customize_compiler(compiler): + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -187,19 +189,27 @@ def customize_compiler(compiler): + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: +- cflags = opt + ' ' + os.environ['CFLAGS'] ++ cflags = os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -208,13 +218,17 @@ def customize_compiler(compiler): + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + + compiler.shared_lib_extension = shlib_suffix +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler): + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _osx_support.compiler_fixup(compiler_so, + cc_args + extra_postargs) ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, ++ cc_args + extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -173,22 +183,16 @@ class UnixCCompiler(CCompiler): + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i += 1 +- linker[i] = self.compiler_cxx[i] ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] ++ else: ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -584,10 +584,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + diff --git a/spack-repos/externals/packages/python/python-3.7.3-distutils-C++.patch b/spack-repos/externals/packages/python/python-3.7.3-distutils-C++.patch new file mode 100644 index 000000000..e29323bf0 --- /dev/null +++ b/spack-repos/externals/packages/python/python-3.7.3-distutils-C++.patch @@ -0,0 +1,256 @@ +diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py +index db6674e..ccbe09a 100644 +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ __all__ = [ + # configuration variables that may contain universal build flags, + # like "-arch" or "-isdkroot", that may need customization for + # the user environment +-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', +- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', +- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', +- 'PY_CORE_CFLAGS', 'PY_CORE_LDFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_LDFLAGS', 'PY_CORE_CFLAGS') + + # configuration variables that may contain compiler calls +-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') ++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') + + # prefix added to original configuration variable names + _INITPRE = '_OSX_SUPPORT_INITIAL_' +diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py +index 6c5d777..640fa2d 100644 +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler): + # dllwrap 2.10.90 is buggy + if self.ld_version >= "2.10.90": + self.linker_dll = "gcc" ++ self.linker_dll_cxx = "g++" + else: + self.linker_dll = "dllwrap" ++ self.linker_dll_cxx = "dllwrap" + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static +@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler): + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll_cxx, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler): + raise CompileError(msg) + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler): + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, shared_option, + entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 83160f8..b735369 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -183,9 +183,11 @@ def customize_compiler(compiler): + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ ++ (cc, cxx, opt, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ + get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -200,19 +202,27 @@ def customize_compiler(compiler): + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: + cflags = opt + ' ' + os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = opt + ' ' + os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -221,13 +231,17 @@ def customize_compiler(compiler): + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + + compiler.shared_lib_extension = shlib_suffix +diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py +index d10a78d..7e88781 100644 +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler): + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _osx_support.compiler_fixup(compiler_so, + cc_args + extra_postargs) ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, ++ cc_args + extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -173,30 +183,16 @@ class UnixCCompiler(CCompiler): + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i += 1 +- +- if os.path.basename(linker[i]) == 'ld_so_aix': +- # AIX platforms prefix the compiler with the ld_so_aix +- # script, so we need to adjust our linker index +- offset = 1 ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] + else: +- offset = 0 +- +- linker[i+offset] = self.compiler_cxx[i] ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 2d2e11f..8456e3f 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -615,10 +615,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + diff --git a/spack-repos/externals/packages/python/python-3.7.4+-distutils-C++-testsuite.patch b/spack-repos/externals/packages/python/python-3.7.4+-distutils-C++-testsuite.patch new file mode 100644 index 000000000..993610870 --- /dev/null +++ b/spack-repos/externals/packages/python/python-3.7.4+-distutils-C++-testsuite.patch @@ -0,0 +1,138 @@ +This patch updates the distutils test suite for: +var/spack/repos/builtin/packages/python/python-3.7.4+-distutils-C++.patch + +That patch fixes several shortcomings in the distutils C++ support, +most prominently missing support for passing CXXFLAGS from the environment. + +Since it does not update the distutils testsuite, it causes the testsuite +to fail, which this patch updates to pass. + +----------------------------------------------------------------------------- +Spack changelog +- Added patch header to aid understanding the patch and maintainance +- Updated the distutils testsuite in Lib/distutils/tests/test_sysconfig.py + +----------------------------------------------------------------------------- +Upstream status + +Upstream bug: https://bugs.python.org/issue1222585 + +Status: Closed, wont fix, comment by Eric Araujo, Python Core Dev: +"setuptools and other active build tools are the better target for this feature." +https://bugs.python.org/issue1222585#msg379348 + +But according to the last-but-oncomment, setuptools seems to be lacking there too. +https://bugs.python.org/issue1222585#msg371840 + +----------------------------------------------------------------------------- +Description + +distutils has no support for CXXFLAGS, this patch adds it. + +Upstream distutils requires to pass all CXXFLAGS (C++-specific CFLAGS) +as part of the CXX enviromnent variable instead. + +This patch: +- adds CXXFLAGS support +- adds LDCXXSHARED like LDSHARED +- passes cflags to CXX like it passes them to CC. + +The distutils testsuite is updated accordingly to pass the tests. +Since it passes, it is the authoritative info of the current effects of this patch. + +See the update of the distutils testsuite in Lib/distutils/tests/test_sysconfig.py +below for details on the effect of this patch. + +diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py +index db6674e..ccbe09a 100644 +--- a/Lib/distutils/tests/test_sysconfig.py ++++ b/Lib/distutils/tests/test_sysconfig.py +@@ -89,8 +89,10 @@ + 'CXX': 'sc_cxx', + 'ARFLAGS': '--sc-arflags', + 'CFLAGS': '--sc-cflags', ++ 'CXXFLAGS': '--sc-cxxflags', + 'CCSHARED': '--sc-ccshared', + 'LDSHARED': 'sc_ldshared', ++ 'LDCXXSHARED': 'sc_ldshared_cxx', + 'SHLIB_SUFFIX': 'sc_shutil_suffix', + + # On macOS, disable _osx_support.customize_compiler() +@@ -114,11 +116,13 @@ + os.environ['AR'] = 'env_ar' + os.environ['CC'] = 'env_cc' + os.environ['CPP'] = 'env_cpp' +- os.environ['CXX'] = 'env_cxx --env-cxx-flags' ++ os.environ['CXX'] = 'env_cxx' + os.environ['LDSHARED'] = 'env_ldshared' ++ os.environ['LDCXXSHARED'] = 'env_ldshared_cxx' + os.environ['LDFLAGS'] = '--env-ldflags' + os.environ['ARFLAGS'] = '--env-arflags' + os.environ['CFLAGS'] = '--env-cflags' ++ os.environ['CXXFLAGS'] = '--env-cxxflags' + os.environ['CPPFLAGS'] = '--env-cppflags' + + comp = self.customize_compiler() +@@ -128,16 +132,24 @@ + 'env_cpp --env-cppflags') + self.assertEqual(comp.exes['compiler'], + 'env_cc --sc-cflags --env-cflags --env-cppflags') ++ self.assertEqual(comp.exes['compiler_cxx'], ++ 'env_cxx --sc-cflags --env-cxxflags --env-cppflags') + self.assertEqual(comp.exes['compiler_so'], + ('env_cc --sc-cflags ' + '--env-cflags ''--env-cppflags --sc-ccshared')) +- self.assertEqual(comp.exes['compiler_cxx'], +- 'env_cxx --env-cxx-flags') ++ self.assertEqual(comp.exes['compiler_so_cxx'], ++ ('env_cxx --sc-cflags ' ++ '--env-cxxflags ''--env-cppflags --sc-ccshared')) + self.assertEqual(comp.exes['linker_exe'], + 'env_cc') ++ self.assertEqual(comp.exes['linker_exe_cxx'], ++ 'env_cxx') + self.assertEqual(comp.exes['linker_so'], + ('env_ldshared --env-ldflags --env-cflags' + ' --env-cppflags')) ++ self.assertEqual(comp.exes['linker_so_cxx'], ++ ('env_ldshared_cxx --env-ldflags --env-cxxflags' ++ ' --env-cppflags')) + self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix') + + del os.environ['AR'] +@@ -145,9 +157,11 @@ + del os.environ['CPP'] + del os.environ['CXX'] + del os.environ['LDSHARED'] ++ del os.environ['LDCXXSHARED'] + del os.environ['LDFLAGS'] + del os.environ['ARFLAGS'] + del os.environ['CFLAGS'] ++ del os.environ['CXXFLAGS'] + del os.environ['CPPFLAGS'] + + comp = self.customize_compiler() +@@ -157,14 +171,21 @@ + 'sc_cc -E') + self.assertEqual(comp.exes['compiler'], + 'sc_cc --sc-cflags') ++ # TODO: Likely this sould get --sc-cxxflags instead: ++ self.assertEqual(comp.exes['compiler_cxx'], ++ 'sc_cxx --sc-cflags') + self.assertEqual(comp.exes['compiler_so'], + 'sc_cc --sc-cflags --sc-ccshared') +- self.assertEqual(comp.exes['compiler_cxx'], +- 'sc_cxx') ++ self.assertEqual(comp.exes['compiler_so_cxx'], ++ 'sc_cxx --sc-cflags --sc-ccshared') + self.assertEqual(comp.exes['linker_exe'], + 'sc_cc') ++ self.assertEqual(comp.exes['linker_exe_cxx'], ++ 'sc_cxx') + self.assertEqual(comp.exes['linker_so'], + 'sc_ldshared') ++ self.assertEqual(comp.exes['linker_so_cxx'], ++ 'sc_ldshared_cxx') + self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix') + + def test_parse_makefile_base(self): diff --git a/spack-repos/externals/packages/python/python-3.7.4+-distutils-C++.patch b/spack-repos/externals/packages/python/python-3.7.4+-distutils-C++.patch new file mode 100644 index 000000000..02daf0a11 --- /dev/null +++ b/spack-repos/externals/packages/python/python-3.7.4+-distutils-C++.patch @@ -0,0 +1,257 @@ +diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py +index db6674e..ccbe09a 100644 +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ __all__ = [ + # configuration variables that may contain universal build flags, + # like "-arch" or "-isdkroot", that may need customization for + # the user environment +-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', +- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', +- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', +- 'PY_CORE_CFLAGS', 'PY_CORE_LDFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_LDFLAGS', 'PY_CORE_CFLAGS') + + # configuration variables that may contain compiler calls +-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') ++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') + + # prefix added to original configuration variable names + _INITPRE = '_OSX_SUPPORT_INITIAL_' +diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py +index 6c5d777..640fa2d 100644 +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler): + # dllwrap 2.10.90 is buggy + if self.ld_version >= "2.10.90": + self.linker_dll = "gcc" ++ self.linker_dll_cxx = "g++" + else: + self.linker_dll = "dllwrap" ++ self.linker_dll_cxx = "dllwrap" + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static +@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler): + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll_cxx, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler): + raise CompileError(msg) + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler): + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, shared_option, + entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 0a034ee..ecf4759 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -188,9 +188,11 @@ def customize_compiler(compiler): + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -205,19 +207,27 @@ def customize_compiler(compiler): + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: + cflags = cflags + ' ' + os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = cxxflags + ' ' + os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -226,13 +236,17 @@ def customize_compiler(compiler): + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + + compiler.shared_lib_extension = shlib_suffix +diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py +index d10a78d..7e88781 100644 +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler): + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _osx_support.compiler_fixup(compiler_so, + cc_args + extra_postargs) ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, ++ cc_args + extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + +@@ -173,30 +183,16 @@ class UnixCCompiler(CCompiler): + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i += 1 +- +- if os.path.basename(linker[i]) == 'ld_so_aix': +- # AIX platforms prefix the compiler with the ld_so_aix +- # script, so we need to adjust our linker index +- offset = 1 ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] + else: +- offset = 0 +- +- linker[i+offset] = self.compiler_cxx[i] ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 35ca1a8..cfa79df 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -618,10 +618,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + diff --git a/spack-repos/externals/packages/python/rpath-non-gcc.patch b/spack-repos/externals/packages/python/rpath-non-gcc.patch new file mode 100644 index 000000000..f203bbbaa --- /dev/null +++ b/spack-repos/externals/packages/python/rpath-non-gcc.patch @@ -0,0 +1,15 @@ +--- a/Lib/distutils/unixccompiler.py 2009-05-09 21:55:12.000000000 +1000 ++++ b/Lib/distutils/unixccompiler.py 2017-05-13 14:30:18.077518999 +1000 +@@ -299,10 +299,8 @@ + else: + return "-Wl,-R" + dir + else: +- # No idea how --enable-new-dtags would be passed on to +- # ld if this system was using GNU ld. Don't know if a +- # system like this even exists. +- return "-R" + dir ++ # Patched by spack to use gcc syntax by default: ++ return "-Wl,-R" + dir + + def library_option(self, lib): + return "-l" + lib diff --git a/spack-repos/externals/packages/python/tkinter-3.10.patch b/spack-repos/externals/packages/python/tkinter-3.10.patch new file mode 100644 index 000000000..e06be826b --- /dev/null +++ b/spack-repos/externals/packages/python/tkinter-3.10.patch @@ -0,0 +1,11 @@ +--- a/setup.py 2021-12-06 12:23:39.000000000 -0600 ++++ b/setup.py 2021-12-14 10:30:33.000000000 -0600 +@@ -2099,6 +2099,8 @@ + # + # Detection stops at the first successful method. + ++ return False ++ + # Check for Tcl and Tk at the locations indicated by _TCLTK_INCLUDES + # and _TCLTK_LIBS environment variables. + if self.detect_tkinter_fromenv(): diff --git a/spack-repos/externals/packages/python/tkinter-3.11.patch b/spack-repos/externals/packages/python/tkinter-3.11.patch new file mode 100644 index 000000000..fe2d54bd4 --- /dev/null +++ b/spack-repos/externals/packages/python/tkinter-3.11.patch @@ -0,0 +1,25 @@ +From a49e95e44961a0b6703ef9cb577d2ae5334c4a62 Mon Sep 17 00:00:00 2001 +From: Harmen Stoppels +Date: Thu, 3 Nov 2022 13:54:00 +0100 +Subject: [PATCH] disable tkinter explicitly + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 15d0d45..642adb3 100644 +--- a/setup.py ++++ b/setup.py +@@ -1358,7 +1358,7 @@ class PyBuildExt(build_ext): + self.detect_decimal() + self.detect_ctypes() + self.detect_multiprocessing() +- self.detect_tkinter() ++ # self.detect_tkinter() + self.detect_uuid() + + # Uncomment the next line if you want to play with xxmodule.c +-- +2.38.1 + diff --git a/spack-repos/externals/packages/python/tkinter-3.7.patch b/spack-repos/externals/packages/python/tkinter-3.7.patch new file mode 100644 index 000000000..87e190180 --- /dev/null +++ b/spack-repos/externals/packages/python/tkinter-3.7.patch @@ -0,0 +1,17 @@ +diff -Naur a/setup.py b/setup.py +--- a/setup.py 2019-01-13 18:59:14.000000000 -0600 ++++ b/setup.py 2019-01-13 19:00:31.000000000 -0600 +@@ -1787,13 +1787,6 @@ + if self.detect_tkinter_explicitly(): + return + +- # Rather than complicate the code below, detecting and building +- # AquaTk is a separate method. Only one Tkinter will be built on +- # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return +- + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without + # dots on Windows, for detection by cygwin. diff --git a/spack-repos/externals/packages/python/tkinter-3.8.patch b/spack-repos/externals/packages/python/tkinter-3.8.patch new file mode 100644 index 000000000..a1fc5729a --- /dev/null +++ b/spack-repos/externals/packages/python/tkinter-3.8.patch @@ -0,0 +1,12 @@ +diff -Naur a/setup.py b/setup.py +--- a/setup.py.orig 2021-09-29 21:28:23.000000000 -0400 ++++ a/setup.py 2021-09-29 21:28:44.000000000 -0400 +@@ -1826,6 +1826,8 @@ + def detect_tkinter(self): + # The _tkinter module. + ++ return False ++ + # Check whether --with-tcltk-includes and --with-tcltk-libs were + # configured or passed into the make target. If so, use these values + # to build tkinter and bypass the searches for Tcl and TK in standard diff --git a/spack-repos/externals/packages/rapidjson/no_march-1.0.patch b/spack-repos/externals/packages/rapidjson/no_march-1.0.patch new file mode 100644 index 000000000..c2e5428b8 --- /dev/null +++ b/spack-repos/externals/packages/rapidjson/no_march-1.0.patch @@ -0,0 +1,14 @@ +--- a/CMakeLists.txt 2015-04-21 19:26:03.000000000 -0700 ++++ b/CMakeLists.txt 2022-06-25 11:12:22.000000000 -0700 +@@ -26,9 +26,9 @@ + endif() + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) + endif() diff --git a/spack-repos/externals/packages/rapidjson/no_march-1.1.patch b/spack-repos/externals/packages/rapidjson/no_march-1.1.patch new file mode 100644 index 000000000..a759d12d9 --- /dev/null +++ b/spack-repos/externals/packages/rapidjson/no_march-1.1.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt 2016-08-25 00:59:05.000000000 -0700 ++++ b/CMakeLists.txt 2022-06-25 11:17:40.000000000 -0700 +@@ -50,7 +50,7 @@ + endif(CCACHE_FOUND) + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + if (RAPIDJSON_BUILD_CXX11) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +@@ -73,7 +73,7 @@ + endif() + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers") + if (RAPIDJSON_BUILD_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() diff --git a/spack-repos/externals/packages/rapidjson/no_march-1.2.patch b/spack-repos/externals/packages/rapidjson/no_march-1.2.patch new file mode 100644 index 000000000..dc50bd687 --- /dev/null +++ b/spack-repos/externals/packages/rapidjson/no_march-1.2.patch @@ -0,0 +1,45 @@ +--- a/CMakeLists.txt 2022-06-25 11:22:02.000000000 -0700 ++++ b/CMakeLists.txt 2022-06-25 11:23:42.000000000 -0700 +@@ -45,8 +45,6 @@ + option(RAPIDJSON_BUILD_ASAN "Build rapidjson with address sanitizer (gcc/clang)" OFF) + option(RAPIDJSON_BUILD_UBSAN "Build rapidjson with undefined behavior sanitizer (gcc/clang)" OFF) + +-option(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT "Build rapidjson with -march or -mcpu options" ON) +- + option(RAPIDJSON_HAS_STDSTRING "" OFF) + if(RAPIDJSON_HAS_STDSTRING) + add_definitions(-DRAPIDJSON_HAS_STDSTRING) +@@ -67,15 +65,7 @@ + endif(CCACHE_FOUND) + + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +- if(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT AND NOT CMAKE_CROSSCOMPILING) +- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native") +- else() +- #FIXME: x86 is -march=native, but doesn't mean every arch is this option. To keep original project's compatibility, I leave this except POWER. +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +- endif() +- endif() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + set(EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wsign-conversion) + if (RAPIDJSON_BUILD_CXX11 AND CMAKE_VERSION VERSION_LESS 3.1) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0") +@@ -101,15 +91,7 @@ + endif() + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- if(NOT CMAKE_CROSSCOMPILING) +- if(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native") +- else() +- #FIXME: x86 is -march=native, but doesn't mean every arch is this option. To keep original project's compatibility, I leave this except POWER. +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +- endif() +- endif() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-missing-field-initializers") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers") + set(EXTRA_CXX_FLAGS -Weffc++ -Wswitch-default -Wfloat-equal -Wconversion -Wimplicit-fallthrough) + if (RAPIDJSON_BUILD_CXX11 AND CMAKE_VERSION VERSION_LESS 3.1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") diff --git a/spack-repos/externals/packages/rapidjson/package.py b/spack-repos/externals/packages/rapidjson/package.py new file mode 100644 index 000000000..e483ef77c --- /dev/null +++ b/spack-repos/externals/packages/rapidjson/package.py @@ -0,0 +1,41 @@ +# Copyright 2013-2024 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 Rapidjson(CMakePackage): + """A fast JSON parser/generator for C++ with both SAX/DOM style API""" + + homepage = "https://rapidjson.org" + url = "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz" + git = "https://github.com/Tencent/rapidjson.git" + + license("MIT") + + version("1.2.0-2022-03-09", commit="8261c1ddf43f10de00fd8c9a67811d1486b2c784") + version("1.2.0-2021-08-13", commit="00dbcf2c6e03c47d6c399338b6de060c71356464") + version("1.1.0", sha256="bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e") + version("1.0.2", sha256="c3711ed2b3c76a5565ee9f0128bb4ec6753dbcc23450b713842df8f236d08666") + version("1.0.1", sha256="a9003ad5c6384896ed4fd1f4a42af108e88e1b582261766df32d717ba744ee73") + version("1.0.0", sha256="4189b32b9c285f34b37ffe4c0fd5627c1e59c2444daacffe5a96fdfbf08d139b") + + variant("doc", default=False, description="Build and install documentation") + + depends_on("doxygen+graphviz", when="+doc") + + # -march=native causes issues on ARM, with older GCC, and with Fujitsu + # Spack injects the appropriate optimization flags anyway + # https://github.com/Tencent/rapidjson/issues/1816 + patch("no_march-1.2.patch", when="@1.2") + patch("no_march-1.1.patch", when="@1.1") + patch("no_march-1.0.patch", when="@1.0") + + patch("update_cmake_minimum_required.patch", when="@1.2.0-2022-03-09", sha256="051f136b43b2d0fdb7fe0a4c062c4df240674cfbadd0a0e673375f85426547a5") + + def cmake_args(self): + args = [] + args.append(self.define_from_variant("RAPIDJSON_BUILD_DOC", "doc")) + return args diff --git a/spack-repos/externals/packages/rapidjson/update_cmake_minimum_required.patch b/spack-repos/externals/packages/rapidjson/update_cmake_minimum_required.patch new file mode 100644 index 000000000..7752bbedd --- /dev/null +++ b/spack-repos/externals/packages/rapidjson/update_cmake_minimum_required.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bdfdd677..d7f5deb9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.26) + if(POLICY CMP0025) + # detect Apple's Clang + cmake_policy(SET CMP0025 NEW) +diff --git a/RapidJSONConfig.cmake.in b/RapidJSONConfig.cmake.in +index c25d3125..28b93522 100644 +--- a/RapidJSONConfig.cmake.in ++++ b/RapidJSONConfig.cmake.in +@@ -1,6 +1,3 @@ +-################################################################################ +-# CMake minimum version required +-cmake_minimum_required(VERSION 3.0) + + ################################################################################ + # RapidJSON source dir +diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt +index 9f53c9aa..96f9f5f0 100644 +--- a/example/CMakeLists.txt ++++ b/example/CMakeLists.txt +@@ -1,5 +1,3 @@ +-cmake_minimum_required(VERSION 2.8) +- + if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) + endif() diff --git a/spack-repos/externals/packages/rclone/package.py b/spack-repos/externals/packages/rclone/package.py index d18829edb..4ffead27e 100644 --- a/spack-repos/externals/packages/rclone/package.py +++ b/spack-repos/externals/packages/rclone/package.py @@ -17,6 +17,7 @@ class Rclone(Package): maintainers("alecbcs") + version("1.69.1", sha256="02ea0fa75c0895b14153a7faf7b1a1273224c4782e6deeb60a366a48786e0722") version("1.64.0", sha256="3297838fdcf611a5ad605835f41c0e51031ce9f220c77a4ad0af6283b7805329") version("1.62.2", sha256="340371f94604e6771cc4a2c91e37d1bf00a524deab520340440fb0968e783f63") version("1.61.1", sha256="34b5f52047741c7bbf54572c02cc9998489c4736a753af3c99255296b1af125d") @@ -90,10 +91,15 @@ def install(self, spec, prefix): mkdirp(prefix.lib.cmake.rclone) install("librclone.so", prefix.lib) - copy(join_path(os.path.dirname(__file__),"rcloneConfig.cmake"), self.prefix + "/lib/cmake/rclone") - copy(join_path(os.path.dirname(__file__),"rcloneConfigVersion.cmake"), self.prefix + "/lib/cmake/rclone") - copy(join_path(os.path.dirname(__file__),"rcloneTargets.cmake"), self.prefix + "/lib/cmake/rclone") + + if self.spec.satisfies('@1.64.0'): + copy(join_path(os.path.dirname(__file__),"rcloneConfig.cmake.1.64.0"), self.prefix + "/lib/cmake/rclone/rcloneConfig.cmake") + copy(join_path(os.path.dirname(__file__),"rcloneConfigVersion.cmake.1.64.0"), self.prefix + "/lib/cmake/rclone/rcloneConfigVersion.cmake") + copy(join_path(os.path.dirname(__file__),"rcloneTargets.cmake.1.64.0"), self.prefix + "/lib/cmake/rclone/rcloneTargets.cmake") + elif self.spec.satisfies('@1.69.1'): + copy(join_path(os.path.dirname(__file__),"rcloneConfig.cmake.1.69.1"), self.prefix + "/lib/cmake/rclone/rcloneConfig.cmake") + copy(join_path(os.path.dirname(__file__),"rcloneConfigVersion.cmake.1.69.1"), self.prefix + "/lib/cmake/rclone/rcloneConfigVersion.cmake") + copy(join_path(os.path.dirname(__file__),"rcloneTargets.cmake.1.69.1"), self.prefix + "/lib/cmake/rclone/rcloneTargets.cmake") mkdirp(prefix.include) install("librclone.h", prefix.include) - diff --git a/spack-repos/externals/packages/rclone/rcloneConfig.cmake b/spack-repos/externals/packages/rclone/rcloneConfig.cmake.1.64.0 similarity index 100% rename from spack-repos/externals/packages/rclone/rcloneConfig.cmake rename to spack-repos/externals/packages/rclone/rcloneConfig.cmake.1.64.0 diff --git a/spack-repos/externals/packages/rclone/rcloneConfig.cmake.1.69.1 b/spack-repos/externals/packages/rclone/rcloneConfig.cmake.1.69.1 new file mode 100644 index 000000000..5d77e52e7 --- /dev/null +++ b/spack-repos/externals/packages/rclone/rcloneConfig.cmake.1.69.1 @@ -0,0 +1,27 @@ + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was Config.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +#################################################################################### + +include("${CMAKE_CURRENT_LIST_DIR}/rcloneTargets.cmake") diff --git a/spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake b/spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake.1.64.0 similarity index 100% rename from spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake rename to spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake.1.64.0 diff --git a/spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake.1.69.1 b/spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake.1.69.1 new file mode 100644 index 000000000..6f6b9e08d --- /dev/null +++ b/spack-repos/externals/packages/rclone/rcloneConfigVersion.cmake.1.69.1 @@ -0,0 +1,51 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major version is the same as the current one. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "1.69.1") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("1.0.0" MATCHES "^([0-9]+)\\.") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + else() + set(CVF_VERSION_MAJOR "1.0.0") + endif() + + if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/spack-repos/externals/packages/rclone/rcloneTargets.cmake b/spack-repos/externals/packages/rclone/rcloneTargets.cmake.1.64.0 similarity index 100% rename from spack-repos/externals/packages/rclone/rcloneTargets.cmake rename to spack-repos/externals/packages/rclone/rcloneTargets.cmake.1.64.0 diff --git a/spack-repos/externals/packages/rclone/rcloneTargets.cmake.1.69.1 b/spack-repos/externals/packages/rclone/rcloneTargets.cmake.1.69.1 new file mode 100644 index 000000000..858bce414 --- /dev/null +++ b/spack-repos/externals/packages/rclone/rcloneTargets.cmake.1.69.1 @@ -0,0 +1,96 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget rclone::rclone) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + +add_library(rclone::rclone SHARED IMPORTED) + +set_target_properties(rclone::rclone PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" + IMPORTED_LOCATION "${_IMPORT_PREFIX}/lib/librclone.so" +) + + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/rcloneTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/spack-repos/externals/packages/uhal/package.py b/spack-repos/externals/packages/uhal/package.py index 2e16ece8f..ccc8744c7 100644 --- a/spack-repos/externals/packages/uhal/package.py +++ b/spack-repos/externals/packages/uhal/package.py @@ -8,6 +8,7 @@ class Uhal(Package): homepage = "https://github.com/ipbus/" url = "https://codeload.github.com/ipbus/ipbus-software/tar.gz/refs/tags/v2.8.1" + version('2.8.18', sha256='72fb2b34ccaadc9db4032616e3ee25e7974ebb93aaf7aab45b432219307d2060', extension='tar.gz') version('2.8.1', sha256='73f26639a16ea65cecd367045ad0767a7eb4f5f8f488df1bbf121fc47aec3142', extension='tar.gz') #depends_on('boost@1.75.0+debug', type='build') @@ -15,10 +16,14 @@ class Uhal(Package): depends_on('pugixml', type=('build', 'link', 'run')) depends_on('gettext', type=('build', 'link', 'run')) depends_on('py-pybind11', type=('build', 'link', 'run')) + depends_on('py-setuptools', type=('build', 'run')) #patch('ipbus_2.patch', when='@2.8.0') patch('ipbus_2.patch', when='@2.8.1') + #patch("support_python3.12.patch", sha256="839dfda2b717d5917f1b126e8c4f5f0fb2dac5debd50018e19778803653c671f", when="@2.8.18: ^python@3.12:") + patch("support_python3.12.patch", sha256="839dfda2b717d5917f1b126e8c4f5f0fb2dac5debd50018e19778803653c671f", when="@2.8.18:") + def setup_build_environment(self,env): spec=self.spec env.set('Set','uhal') @@ -43,14 +48,24 @@ def setup_run_environment(self, env): env.prepend_path('PYTHONPATH', os.path.join(self.prefix.lib, "python3.8/site-packages")) if self.spec['python'].satisfies('@3.10'): env.prepend_path('PYTHONPATH', os.path.join(self.prefix.lib, "python3.10/site-packages")) + if self.spec['python'].satisfies('@3.11'): + env.prepend_path('PYTHONPATH', os.path.join(self.prefix.lib, "python3.11/site-packages")) + if self.spec['python'].satisfies('@3.12'): + env.prepend_path('PYTHONPATH', os.path.join(self.prefix.lib, "python3.12/site-packages")) def patch(self): copy(join_path(os.path.dirname(__file__), - "uhalConfig.cmake"), "uhalConfig.cmake") - copy(join_path(os.path.dirname(__file__), - "uhalConfigVersion.cmake"), "uhalConfigVersion.cmake") + "uhalConfig.cmake"), "uhalConfig.cmake") copy(join_path(os.path.dirname(__file__), - "uhalTargets.cmake"), "uhalTargets.cmake") + "uhalTargets.cmake"), "uhalTargets.cmake") + + if self.spec.satisfies('@2.8.1'): + copy(join_path(os.path.dirname(__file__), + "uhalConfigVersion.cmake.v2.8.1"), "uhalConfigVersion.cmake") + elif self.spec.satisfies('@2.8.18'): + copy(join_path(os.path.dirname(__file__), + "uhalConfigVersion.cmake.v2.8.18"), "uhalConfigVersion.cmake") + def install(self, spec, prefix): dest=prefix @@ -60,4 +75,3 @@ def install(self, spec, prefix): install('uhalConfig.cmake',prefix) install('uhalConfigVersion.cmake',prefix) install('uhalTargets.cmake',prefix) - diff --git a/spack-repos/externals/packages/uhal/support_python3.12.patch b/spack-repos/externals/packages/uhal/support_python3.12.patch new file mode 100644 index 000000000..8c117b592 --- /dev/null +++ b/spack-repos/externals/packages/uhal/support_python3.12.patch @@ -0,0 +1,10 @@ +diff --git a/uhal/config/mfPythonRPMRules.mk b/uhal/config/mfPythonRPMRules.mk +index 4756a820..33e7f19c 100644 +--- a/uhal/config/mfPythonRPMRules.mk ++++ b/uhal/config/mfPythonRPMRules.mk +@@ -100,4 +100,4 @@ install: _setup_update + # Change into rpm/pkg to finally run the customized setup.py + if [ -f setup.cfg ]; then cp setup.cfg ${RPMBUILD_DIR}/ ; fi + cd ${RPMBUILD_DIR} && \ +- $(if ${CUSTOM_INSTALL_PREFIX},PYTHONPATH=${prefix}/lib/python${PYTHON_VERSION}/site-packages,) bindir=$(bindir) ${PYTHON} ${PythonDistName}.py install $(if ${CUSTOM_INSTALL_PREFIX},--prefix=${prefix},) $(if ${CUSTOM_INSTALL_PREFIX}${CUSTOM_INSTALL_EXEC_PREFIX},--exec-prefix=${exec_prefix},) ++ $(if ${CUSTOM_INSTALL_PREFIX},PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(PYTHONPATH):${prefix}/lib/python${PYTHON_VERSION}/site-packages,) bindir=$(bindir) ${PYTHON} ${PythonDistName}.py install --single-version-externally-managed --record=record.txt --no-compile $(if ${CUSTOM_INSTALL_PREFIX},--prefix=${prefix},) $(if ${CUSTOM_INSTALL_PREFIX}${CUSTOM_INSTALL_EXEC_PREFIX},--exec-prefix=${exec_prefix},) diff --git a/spack-repos/externals/packages/uhal/uhalConfigVersion.cmake b/spack-repos/externals/packages/uhal/uhalConfigVersion.cmake.v2.8.1 similarity index 100% rename from spack-repos/externals/packages/uhal/uhalConfigVersion.cmake rename to spack-repos/externals/packages/uhal/uhalConfigVersion.cmake.v2.8.1 diff --git a/spack-repos/externals/packages/uhal/uhalConfigVersion.cmake.v2.8.18 b/spack-repos/externals/packages/uhal/uhalConfigVersion.cmake.v2.8.18 new file mode 100644 index 000000000..60ca2f2c0 --- /dev/null +++ b/spack-repos/externals/packages/uhal/uhalConfigVersion.cmake.v2.8.18 @@ -0,0 +1,51 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major version is the same as the current one. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "2.8.18") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("1.0.0" MATCHES "^([0-9]+)\\.") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + else() + set(CVF_VERSION_MAJOR "1.0.0") + endif() + + if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/spack-repos/externals/packages/yaml-cpp/package.py b/spack-repos/externals/packages/yaml-cpp/package.py new file mode 100644 index 000000000..d1199bbd1 --- /dev/null +++ b/spack-repos/externals/packages/yaml-cpp/package.py @@ -0,0 +1,93 @@ +# Copyright 2013-2024 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 * +from spack.pkg.builtin.boost import Boost +from spack.spec import ConflictsInSpecError + +yaml_cpp_tests_libcxx_error_msg = "yaml-cpp tests incompatible with libc++" + + +class YamlCpp(CMakePackage): + """A YAML parser and emitter in C++""" + + homepage = "https://github.com/jbeder/yaml-cpp" + url = "https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.5.3.tar.gz" + git = "https://github.com/jbeder/yaml-cpp.git" + maintainers("eschnett") + + license("MIT") + + version("develop", branch="master") + version("0.7.0", sha256="43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3") + version("0.6.3", sha256="77ea1b90b3718aa0c324207cb29418f5bced2354c2e483a9523d98c3460af1ed") + version("0.6.2", sha256="e4d8560e163c3d875fd5d9e5542b5fd5bec810febdcba61481fe5fc4e6b1fd05") + version("0.5.3", sha256="decc5beabb86e8ed9ebeb04358d5363a5c4f72d458b2c788cb2f3ac9c19467b2") + version("0.3.0", sha256="ab8d0e07aa14f10224ed6682065569761f363ec44bc36fcdb2946f6d38fe5a89") + + variant("shared", default=True, description="Build shared instead of static libraries") + variant("pic", default=True, description="Build with position independent code") + variant("tests", default=False, description="Build yaml-cpp tests using internal gtest") + + depends_on("boost@:1.66", when="@0.5.0:0.5.3") + + # TODO: replace this with an explicit list of components of Boost, + # for instance depends_on('boost +filesystem') + # See https://github.com/spack/spack/pull/22303 for reference + depends_on(Boost.with_default_variants, when="@0.5.0:0.5.3") + + patch("update_cmake_minimum_required.patch", when="@0.7.0", sha256="a0165fb07a2868fb8226d932a60f682b8421f521cbcdceb7fdd875f37e377a6b") + + conflicts("%gcc@:4.7", when="@0.6.0:", msg="versions 0.6.0: require c++11 support") + conflicts("%clang@:3.3.0", when="@0.6.0:", msg="versions 0.6.0: require c++11 support") + conflicts("%apple-clang@:4.0.0", when="@0.6.0:", msg="versions 0.6.0: require c++11 support") + conflicts("%intel@:11.1", when="@0.6.0:", msg="versions 0.6.0: require c++11 support") + conflicts("%xl@:13.1", when="@0.6.0:", msg="versions 0.6.0: require c++11 support") + conflicts("%xl_r@:13.1", when="@0.6.0:", msg="versions 0.6.0: require c++11 support") + conflicts( + '%clang cxxflags="-stdlib=libc++"', when="+tests", msg=yaml_cpp_tests_libcxx_error_msg + ) + + def flag_handler(self, name, flags): + # We cannot catch all conflicts with the conflicts directive because + # the user can add arbitrary strings to the flags. Here we can at least + # fail early. + # We'll include cppflags in case users mistakenly put c++ flags there. + spec = self.spec + if name in ("cxxflags", "cppflags") and spec.satisfies("+tests"): + if "-stdlib=libc++" in flags: + raise ConflictsInSpecError( + spec, + [ + ( + spec, + spec.compiler_flags[name], + spec.variants["tests"], + yaml_cpp_tests_libcxx_error_msg, + ) + ], + ) + return (flags, None, None) + + def cmake_args(self): + options = [] + + options.extend( + [ + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), + self.define_from_variant("YAML_BUILD_SHARED_LIBS", "shared"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + self.define_from_variant("YAML_CPP_BUILD_TESTS", "tests"), + ] + ) + + return options + + def url_for_version(self, version): + url = "https://github.com/jbeder/yaml-cpp/archive/{0}-{1}.tar.gz" + if version < Version("0.5.3"): + return url.format("release", version) + else: + return url.format("yaml-cpp", version) diff --git a/spack-repos/externals/packages/yaml-cpp/update_cmake_minimum_required.patch b/spack-repos/externals/packages/yaml-cpp/update_cmake_minimum_required.patch new file mode 100644 index 000000000..7ddb1a189 --- /dev/null +++ b/spack-repos/externals/packages/yaml-cpp/update_cmake_minimum_required.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b230b9e..f9a4026 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-# 3.5 is actually available almost everywhere, but this a good minimum +-cmake_minimum_required(VERSION 3.4) ++ ++cmake_minimum_required(VERSION 3.26.3) + + # enable MSVC_RUNTIME_LIBRARY target property + # see https://cmake.org/cmake/help/latest/policy/CMP0091.html +diff --git a/test/gtest-1.10.0/CMakeLists.txt b/test/gtest-1.10.0/CMakeLists.txt +index f11bbb5..38e7503 100644 +--- a/test/gtest-1.10.0/CMakeLists.txt ++++ b/test/gtest-1.10.0/CMakeLists.txt +@@ -1,7 +1,7 @@ + # Note: CMake support is community-based. The maintainers do not use CMake + # internally. + +-cmake_minimum_required(VERSION 2.8.8) ++cmake_minimum_required(VERSION 3.26.3) + + if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +diff --git a/test/gtest-1.10.0/googlemock/CMakeLists.txt b/test/gtest-1.10.0/googlemock/CMakeLists.txt +index d32b70b..11ea1c5 100644 +--- a/test/gtest-1.10.0/googlemock/CMakeLists.txt ++++ b/test/gtest-1.10.0/googlemock/CMakeLists.txt +@@ -42,7 +42,7 @@ else() + cmake_policy(SET CMP0048 NEW) + project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) + endif() +-cmake_minimum_required(VERSION 2.6.4) ++cmake_minimum_required(VERSION 3.26.3) + + if (COMMAND set_up_hermetic_build) + set_up_hermetic_build() +diff --git a/test/gtest-1.10.0/googletest/CMakeLists.txt b/test/gtest-1.10.0/googletest/CMakeLists.txt +index db29294..8bfb13e 100644 +--- a/test/gtest-1.10.0/googletest/CMakeLists.txt ++++ b/test/gtest-1.10.0/googletest/CMakeLists.txt +@@ -53,7 +53,7 @@ else() + cmake_policy(SET CMP0048 NEW) + project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) + endif() +-cmake_minimum_required(VERSION 2.6.4) ++cmake_minimum_required(VERSION 3.26.3) + + if (POLICY CMP0063) # Visibility + cmake_policy(SET CMP0063 NEW)