From cdb2dae831084d365d84bb0aed545ccd9f32e09d Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:06:44 +0100 Subject: [PATCH 01/52] Install LHAPDF on macOS --- .github/workflows/release.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c816d503..6e1c6f89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ on: env: GH_TOKEN: ${{ github.token }} + LHAPDF_V: '6.4.0' jobs: # create a release on github @@ -57,8 +58,18 @@ jobs: - uses: actions/checkout@v4 - name: Compile binary run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --target=${{ matrix.target }} + # install LHAPDF + curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${{ env.LHAPDF_V }}.tar.gz" | tar xzf - + cd LHAPDF-${{ env.LHAPDF_V }} + ./configure --disable-dynamic --enable-static + make -j V=1 + make install + cd .. + # install Rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} + # build the CLI cargo build --release --features=evolve,fktable,static --bin pineappl --target=${{ matrix.target }} + # package the CLI cp target/release/pineappl prefix/bin/ cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . From 211e0cb074a54717f9ebf35549df3e3db93efe5f Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:09:31 +0100 Subject: [PATCH 02/52] Disable Python --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e1c6f89..c6b75298 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: # install LHAPDF curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${{ env.LHAPDF_V }}.tar.gz" | tar xzf - cd LHAPDF-${{ env.LHAPDF_V }} - ./configure --disable-dynamic --enable-static + ./configure --disable-dynamic --enable-static --without-python make -j V=1 make install cd .. From e60610a908dadea5ee9b4c313d8b844865f72c03 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:11:45 +0100 Subject: [PATCH 03/52] Correctly disable Python --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6b75298..ca17fbbd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: # install LHAPDF curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${{ env.LHAPDF_V }}.tar.gz" | tar xzf - cd LHAPDF-${{ env.LHAPDF_V }} - ./configure --disable-dynamic --enable-static --without-python + ./configure --disable-dynamic --disable-python --enable-static make -j V=1 make install cd .. From 436f5bf4a3a89533d13a7d5ebc59c43a2f1a7a26 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:13:34 +0100 Subject: [PATCH 04/52] Fix `--disable-dynamic` with `--disable-shared` --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca17fbbd..a155ad51 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: # install LHAPDF curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${{ env.LHAPDF_V }}.tar.gz" | tar xzf - cd LHAPDF-${{ env.LHAPDF_V }} - ./configure --disable-dynamic --disable-python --enable-static + ./configure --disable-python --disable-shared --enable-static make -j V=1 make install cd .. From 838ede069d455b29ef1d2a263b223b73098bd749 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:22:46 +0100 Subject: [PATCH 05/52] Do not run workflows in this branch --- .github/workflows/capi.yaml | 3 +++ .github/workflows/msrv.yml | 3 +++ .github/workflows/python.yml | 3 +++ .github/workflows/rust.yml | 3 +++ 4 files changed, 12 insertions(+) diff --git a/.github/workflows/capi.yaml b/.github/workflows/capi.yaml index 4d15a0ad..6bf5f990 100644 --- a/.github/workflows/capi.yaml +++ b/.github/workflows/capi.yaml @@ -2,6 +2,9 @@ name: CAPI on: push: + pull-request: + branches-ignore: + - fix-macos-cli-generation jobs: capi: diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml index 25ef4b9a..5b8e2962 100644 --- a/.github/workflows/msrv.yml +++ b/.github/workflows/msrv.yml @@ -2,6 +2,9 @@ name: MSRV on: push: + pull-request: + branches-ignore: + - fix-macos-cli-generation env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index c4777316..8e56113d 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -2,6 +2,9 @@ name: Python on: push: + pull-request: + branches-ignore: + - fix-macos-cli-generation jobs: test: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a2751695..89566806 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,6 +2,9 @@ name: Rust on: push: + pull-request: + branches-ignore: + - fix-macos-cli-generation defaults: run: From 3d2cc9faad8d9b5d1ad3b875ef15062302df4d65 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:24:22 +0100 Subject: [PATCH 06/52] Use brew to install LHAPDF on macOS --- .github/workflows/release.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a155ad51..fa06148e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,6 @@ on: env: GH_TOKEN: ${{ github.token }} - LHAPDF_V: '6.4.0' jobs: # create a release on github @@ -59,12 +58,8 @@ jobs: - name: Compile binary run: | # install LHAPDF - curl "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${{ env.LHAPDF_V }}.tar.gz" | tar xzf - - cd LHAPDF-${{ env.LHAPDF_V }} - ./configure --disable-python --disable-shared --enable-static - make -j V=1 - make install - cd .. + brew tap davidchall/hep + brew install lhapdf # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From 8bd5c7b6c0fcca31ca39a8417a0ab3529bf6723a Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:29:07 +0100 Subject: [PATCH 07/52] Run Release workflow automatically in this branch --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa06148e..ce382b3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,8 @@ on: push: tags: - 'v[0-9]+*' + branches: + - fix-macos-cli-generation workflow_dispatch: env: From 893ccd17ec4878509b082f384d12a193fe95b29b Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:29:32 +0100 Subject: [PATCH 08/52] Create missing directory --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce382b3c..e1aab7f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,6 +67,7 @@ jobs: # build the CLI cargo build --release --features=evolve,fktable,static --bin pineappl --target=${{ matrix.target }} # package the CLI + mkdir -p prefix/bin cp target/release/pineappl prefix/bin/ cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . From f4785c1d5e59ba1fde5625cb9054b4a118026075 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:35:10 +0100 Subject: [PATCH 09/52] Fix problems with workflow syntax --- .github/workflows/capi.yaml | 1 - .github/workflows/msrv.yml | 1 - .github/workflows/python.yml | 1 - .github/workflows/release.yml | 4 ++-- .github/workflows/rust.yml | 1 - 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/capi.yaml b/.github/workflows/capi.yaml index 6bf5f990..64e1a545 100644 --- a/.github/workflows/capi.yaml +++ b/.github/workflows/capi.yaml @@ -2,7 +2,6 @@ name: CAPI on: push: - pull-request: branches-ignore: - fix-macos-cli-generation diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml index 5b8e2962..5d77ba80 100644 --- a/.github/workflows/msrv.yml +++ b/.github/workflows/msrv.yml @@ -2,7 +2,6 @@ name: MSRV on: push: - pull-request: branches-ignore: - fix-macos-cli-generation diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 8e56113d..ca63e312 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -2,7 +2,6 @@ name: Python on: push: - pull-request: branches-ignore: - fix-macos-cli-generation diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1aab7f5..15c10ffd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,8 @@ on: push: tags: - 'v[0-9]+*' - branches: - - fix-macos-cli-generation + branches: + - fix-macos-cli-generation workflow_dispatch: env: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 89566806..4e47550d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,7 +2,6 @@ name: Rust on: push: - pull-request: branches-ignore: - fix-macos-cli-generation From b979e647848d9a95bf9ffc8478534b971315e63c Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:50:29 +0100 Subject: [PATCH 10/52] Simplify matrix strategy a bit --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15c10ffd..fab3dc81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,6 @@ jobs: cli-macos: strategy: matrix: - os: [macos-latest, macos-14] include: - os: macos-latest target: x86_64-apple-darwin From 8f92f10ab53a11252c00b77f9852667578545628 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 15:53:33 +0100 Subject: [PATCH 11/52] Try to fix packaging the CLI --- .github/workflows/release.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fab3dc81..7cdc1a95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,10 +64,7 @@ jobs: # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI - cargo build --release --features=evolve,fktable,static --bin pineappl --target=${{ matrix.target }} - # package the CLI - mkdir -p prefix/bin - cp target/release/pineappl prefix/bin/ + cargo install --features=evolve,fktable,static --path pineappl_cli --root=prefix --target=${{ matrix.target }} cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact From 17982539d4f96f96dc51781b52c46c1fd7f2c7d0 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 16:01:13 +0100 Subject: [PATCH 12/52] Add comment why we can't cross compile --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cdc1a95..440fcbd4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,6 +52,7 @@ jobs: - os: macos-latest target: x86_64-apple-darwin - os: macos-14 + # we cannot cross-compile, because we need also all dependencies for the specified target target: aarch64-apple-darwin runs-on: ${{ matrix.os }} steps: From 55487a114390e31ea31741303417fac15eb91c90 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Sat, 30 Mar 2024 16:01:34 +0100 Subject: [PATCH 13/52] Simplify CLI installation on Linux --- .github/workflows/release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 440fcbd4..a691d297 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,9 +110,7 @@ jobs: - uses: actions/checkout@v3 - name: Compile binary run: | - cargo build --release --all-features --bin pineappl - mkdir -p prefix/bin - cp target/release/pineappl prefix/bin/ + cargo install --all-features --path pineappl_cli --root=prefix --target=${{ matrix.target }} cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact From ff7d97245cfdbc1b548e9950b25fb4a199836522 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 14:03:09 +0200 Subject: [PATCH 14/52] Add missing `--locked` switch to installation --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a691d297..07fd7a03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,9 +33,9 @@ jobs: - name: Compile library run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --target=${{ matrix.target }} - cargo install cargo-c + cargo install --locked cargo-c cd pineappl_capi - cargo cinstall --verbose --destdir=prefix --library-type=cdylib --prefix=/ --target=${{ matrix.target }} + cargo cinstall --destdir=prefix --library-type=cdylib --locked --prefix=/ --target=${{ matrix.target }} --verbose cd prefix tar czf ../../pineappl_capi-${{ matrix.target }}.tar.gz . - name: Upload artifact @@ -65,7 +65,7 @@ jobs: # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI - cargo install --features=evolve,fktable,static --path pineappl_cli --root=prefix --target=${{ matrix.target }} + cargo install --features=evolve,fktable,static --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact @@ -87,7 +87,7 @@ jobs: - name: Compile library run: | cd pineappl_capi - cargo cinstall --verbose --destdir=prefix --library-type=cdylib --prefix=/ --target=${{ matrix.target }} + cargo cinstall --destdir=prefix --library-type=cdylib --locked --prefix=/ --target=${{ matrix.target }} --verbose cd prefix tar czf ../../pineappl_capi-${{ matrix.target }}.tar.gz . # print the glibc version requirement @@ -110,7 +110,7 @@ jobs: - uses: actions/checkout@v3 - name: Compile binary run: | - cargo install --all-features --path pineappl_cli --root=prefix --target=${{ matrix.target }} + cargo install --all-features --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact From b0ed2308560175ead4947bbb2cc872cb280ce64d Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 14:16:44 +0200 Subject: [PATCH 15/52] Install and use APPLgrid on macOS --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07fd7a03..58d4721f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,13 +59,15 @@ jobs: - uses: actions/checkout@v4 - name: Compile binary run: | - # install LHAPDF brew tap davidchall/hep + # install LHAPDF brew install lhapdf + # install APPLgrid + brew install applgrid # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI - cargo install --features=evolve,fktable,static --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} + cargo install --features=applgrid,evolve,fktable,static --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact From ca7d1981fbf94d228a21eb8bef65e8f8e3fb7893 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 15:01:48 +0200 Subject: [PATCH 16/52] Download sources and export `APPL_IGRID_DIR` on macOS --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 58d4721f..3408a873 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,9 @@ jobs: brew install lhapdf # install APPLgrid brew install applgrid + # install APPLgrid's sources - TODO: find a better version independent way to do this + wget 'https://applgrid.hepforge.org/downloads/applgrid-1.6.35.tgz' -O- | tar xzf - -C /tmp + export APPL_IGRID_DIR=/tmp/applgrid-1.6.35/src # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From 71eb9e7c5f81600c79920c368e57585f623ebbbb Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 15:19:49 +0200 Subject: [PATCH 17/52] Add some diagnostics for homebrew --- .github/workflows/release.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3408a873..e0292898 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,11 +62,14 @@ jobs: brew tap davidchall/hep # install LHAPDF brew install lhapdf - # install APPLgrid - brew install applgrid - # install APPLgrid's sources - TODO: find a better version independent way to do this - wget 'https://applgrid.hepforge.org/downloads/applgrid-1.6.35.tgz' -O- | tar xzf - -C /tmp - export APPL_IGRID_DIR=/tmp/applgrid-1.6.35/src + # install APPLgrid's dependencies + brew install --only-dependencies applgrid + export HOMEBREW_TEMP="$(pwd)"/tmp + mkdir -p ${HOMEBREW_TEMP} + echo "HOMEBREW_TEMP = ${HOMEBREW_TEMP}" + brew install --build-from-source applgrid + find ${HOMEBREW_TEMP} + export APPL_IGRID_DIR=${HOMEBREW_TEMP}/applgrid-1.6.35/src # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From 508cf265a42eb5de8345750051970b18df13d4c5 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 15:26:13 +0200 Subject: [PATCH 18/52] Keep temporary directory when compiling with brew --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0292898..e084be5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,7 +67,7 @@ jobs: export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} echo "HOMEBREW_TEMP = ${HOMEBREW_TEMP}" - brew install --build-from-source applgrid + brew install --build-from-source --keep-tmp applgrid find ${HOMEBREW_TEMP} export APPL_IGRID_DIR=${HOMEBREW_TEMP}/applgrid-1.6.35/src # install Rust From 294f966e6a0c79fc12516bce782619cbac674d2d Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 15:35:57 +0200 Subject: [PATCH 19/52] Fix `APPL_IGRID_DIR` determination --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e084be5e..c61853e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,12 +64,11 @@ jobs: brew install lhapdf # install APPLgrid's dependencies brew install --only-dependencies applgrid + # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} - echo "HOMEBREW_TEMP = ${HOMEBREW_TEMP}" brew install --build-from-source --keep-tmp applgrid - find ${HOMEBREW_TEMP} - export APPL_IGRID_DIR=${HOMEBREW_TEMP}/applgrid-1.6.35/src + export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From 32d3edebf1189d7bb0d230bf8e6ea899e255d846 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 15:49:58 +0200 Subject: [PATCH 20/52] Print more diagnostics --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c61853e7..28317046 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,6 +69,10 @@ jobs: mkdir -p ${HOMEBREW_TEMP} brew install --build-from-source --keep-tmp applgrid export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) + # try to find root header path + cat $(command -v applgrid-config) + pkg-config --cflags-only-I root || true + root-config --cflags || true # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From d8768da0c00a07837c9563c500d2959564172149 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 16:17:10 +0200 Subject: [PATCH 21/52] Add missing include paths for `pineappl_applgrid` --- pineappl_applgrid/build.rs | 41 +++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/pineappl_applgrid/build.rs b/pineappl_applgrid/build.rs index c30b2f9a..8ab347df 100644 --- a/pineappl_applgrid/build.rs +++ b/pineappl_applgrid/build.rs @@ -34,22 +34,39 @@ fn main() { println!("cargo:rustc-link-search={}", lib_path.trim()); - let include_path = String::from_utf8( + let appl_igrid_dir = env::var("APPL_IGRID_DIR").unwrap_or_else(|_| { + Path::new( + &String::from_utf8( + Command::new("applgrid-config") + .arg("--incdir") + .output() + .expect("did not find `applgrid-config`, please install APPLgrid") + .stdout, + ) + .unwrap(), + ) + .join("appl_grid") + .to_str() + .unwrap() + .to_owned() + }); + + let cxx_flags: Vec<_> = String::from_utf8( Command::new("applgrid-config") - .arg("--incdir") + .arg("--cxxflags") .output() .expect("did not find `applgrid-config`, please install APPLgrid") .stdout, ) - .unwrap(); + .unwrap() + .split_ascii_whitespace() + .map(ToOwned::to_owned) + .collect(); - let appl_igrid_dir = env::var("APPL_IGRID_DIR").unwrap_or_else(|_| { - Path::new(&include_path) - .join("appl_grid") - .to_str() - .unwrap() - .to_owned() - }); + let include_dirs: Vec<_> = cxx_flags + .iter() + .filter_map(|token| token.strip_prefix("-I").map(ToOwned::to_owned)) + .collect(); let libs = String::from_utf8( Command::new("applgrid-config") @@ -85,7 +102,7 @@ fn main() { Build::new() .cpp(true) .file("src/check_appl_igrid.cpp") - .include(include_path.trim()) + .includes(&include_dirs) .include(&appl_igrid_dir) .try_compile("appl_igrid") .expect( @@ -107,7 +124,7 @@ fn main() { cxx_build::bridge("src/lib.rs") .file("src/applgrid.cpp") - .include(include_path.trim()) + .includes(&include_dirs) .include(appl_igrid_dir) .includes(lhapdf.include_paths) .compile("appl-bridge"); From 64d9a8e41f3c1b1ee57d7d3ce94664741833507e Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 16:23:03 +0200 Subject: [PATCH 22/52] Add more tested versions of APPLgrid --- pineappl_applgrid/build.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pineappl_applgrid/build.rs b/pineappl_applgrid/build.rs index 8ab347df..0f713210 100644 --- a/pineappl_applgrid/build.rs +++ b/pineappl_applgrid/build.rs @@ -16,7 +16,14 @@ fn main() { ) .unwrap(); - if version.trim() != "1.6.27" { + let tested_versions = [ + "1.6.27", "1.6.28", "1.6.29", "1.6.30", "1.6.31", "1.6.32", "1.6.35", + ]; + + if !tested_versions + .iter() + .any(|&tested| tested == version.trim()) + { println!( "cargo:warning=found APPLgrid version {}, which has not been tested", version.trim() From 1d9af8cfb173a4dd2df41ba833346b7240a49b90 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Mon, 1 Apr 2024 17:13:06 +0200 Subject: [PATCH 23/52] Set C++ standard in `pineappl_applgrid` --- pineappl_applgrid/build.rs | 51 ++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/pineappl_applgrid/build.rs b/pineappl_applgrid/build.rs index 0f713210..9eb5facd 100644 --- a/pineappl_applgrid/build.rs +++ b/pineappl_applgrid/build.rs @@ -6,6 +6,14 @@ use std::env; use std::path::Path; use std::process::Command; +fn conditional_std<'a>(build: &'a mut Build, std: Option<&str>) -> &'a mut Build { + if let Some(std) = std { + build.std(std) + } else { + build + } +} + fn main() { let version = String::from_utf8( Command::new("applgrid-config") @@ -72,9 +80,14 @@ fn main() { let include_dirs: Vec<_> = cxx_flags .iter() - .filter_map(|token| token.strip_prefix("-I").map(ToOwned::to_owned)) + .filter_map(|token| token.strip_prefix("-I")) .collect(); + let std = cxx_flags + .iter() + .filter_map(|token| token.strip_prefix("-std=")) + .last(); + let libs = String::from_utf8( Command::new("applgrid-config") .arg("--ldflags") @@ -106,16 +119,19 @@ fn main() { } } - Build::new() - .cpp(true) - .file("src/check_appl_igrid.cpp") - .includes(&include_dirs) - .include(&appl_igrid_dir) - .try_compile("appl_igrid") - .expect( - "could not find file `appl_igrid.h`, please set the environment variable \ + conditional_std( + Build::new() + .cpp(true) + .file("src/check_appl_igrid.cpp") + .includes(&include_dirs) + .include(&appl_igrid_dir), + std, + ) + .try_compile("appl_igrid") + .expect( + "could not find file `appl_igrid.h`, please set the environment variable \ `APPL_IGRID_DIR` to the directory containing it", - ); + ); println!("cargo:rerun-if-env-changed=APPL_IGRID_DIR"); @@ -129,12 +145,15 @@ fn main() { println!("cargo:rustc-link-lib={link_modifier}{lib}"); } - cxx_build::bridge("src/lib.rs") - .file("src/applgrid.cpp") - .includes(&include_dirs) - .include(appl_igrid_dir) - .includes(lhapdf.include_paths) - .compile("appl-bridge"); + conditional_std( + cxx_build::bridge("src/lib.rs") + .file("src/applgrid.cpp") + .includes(&include_dirs) + .include(appl_igrid_dir) + .includes(lhapdf.include_paths), + std, + ) + .compile("appl-bridge"); println!("cargo:rerun-if-changed=src/lib.rs"); println!("cargo:rerun-if-changed=src/applgrid.cpp"); From 6ad166b1f4043d685406b98c66db8e9f8c1cdcb9 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Tue, 2 Apr 2024 09:34:00 +0200 Subject: [PATCH 24/52] Reduce APPLgrid dependencies and install zlib --- .github/workflows/release.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28317046..b4eee271 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,16 +63,14 @@ jobs: # install LHAPDF brew install lhapdf # install APPLgrid's dependencies - brew install --only-dependencies applgrid + brew install --only-dependencies --without-hoppet --without-lhapdf applgrid + # install zlib, system doesn't seem to have static library + brew install zlib # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} - brew install --build-from-source --keep-tmp applgrid + brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf applgrid export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) - # try to find root header path - cat $(command -v applgrid-config) - pkg-config --cflags-only-I root || true - root-config --cflags || true # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From 966d6afe95c71a154106413ea8ba97ab95c761ee Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Tue, 2 Apr 2024 09:45:19 +0200 Subject: [PATCH 25/52] Fix C++ warning --- pineappl_applgrid/src/applgrid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pineappl_applgrid/src/applgrid.cpp b/pineappl_applgrid/src/applgrid.cpp index 1d31949c..592a16d8 100644 --- a/pineappl_applgrid/src/applgrid.cpp +++ b/pineappl_applgrid/src/applgrid.cpp @@ -233,7 +233,7 @@ struct appl_igrid_m_reweight friend type access(appl_igrid_m_reweight); }; -template class access_private_member_variable; +template struct access_private_member_variable; // we need access to `m_reweight`, but it is private bool igrid_m_reweight(appl::igrid const& igrid) @@ -254,7 +254,7 @@ struct appl_grid_m_grids friend type access(appl_grid_m_grids); }; -template class access_private_member_variable; +template struct access_private_member_variable; appl::igrid& grid_get_igrid(appl::grid& grid, std::size_t order, std::size_t bin) { From 1bf9207e00f4ff3279708c43904346c340f3ccfc Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Tue, 2 Apr 2024 09:48:13 +0200 Subject: [PATCH 26/52] Force installation of zlib and list contents --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4eee271..a830698b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,7 +65,8 @@ jobs: # install APPLgrid's dependencies brew install --only-dependencies --without-hoppet --without-lhapdf applgrid # install zlib, system doesn't seem to have static library - brew install zlib + brew reinstall zlib + brew ls --verbose zlib # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} From 382c1600d9c24b567c923396a4e4419327d122b7 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Tue, 2 Apr 2024 10:00:17 +0200 Subject: [PATCH 27/52] Print zlib search path --- pineappl_applgrid/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pineappl_applgrid/build.rs b/pineappl_applgrid/build.rs index 9eb5facd..be23b201 100644 --- a/pineappl_applgrid/build.rs +++ b/pineappl_applgrid/build.rs @@ -100,6 +100,7 @@ fn main() { let link_modifier = if cfg!(feature = "static") { // for some reason `libz.a` isn't found, although `libz.so` is for link_path in Config::new().probe("zlib").unwrap().link_paths { + println!("cargo:warning={}", link_path.to_str().unwrap()); println!("cargo:rustc-link-search={}", link_path.to_str().unwrap()); } From 2838f9daca86b97e9fe90e8692f68d48194116bf Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Tue, 2 Apr 2024 10:06:58 +0200 Subject: [PATCH 28/52] Install `pkg-config` to find zlib from brew --- .github/workflows/release.yml | 2 ++ pineappl_applgrid/build.rs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a830698b..f20392ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,8 +65,10 @@ jobs: # install APPLgrid's dependencies brew install --only-dependencies --without-hoppet --without-lhapdf applgrid # install zlib, system doesn't seem to have static library + brew install pkg-config brew reinstall zlib brew ls --verbose zlib + pkg-config --libs-only-L --keep-system-libs pkg-config # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} diff --git a/pineappl_applgrid/build.rs b/pineappl_applgrid/build.rs index be23b201..9eb5facd 100644 --- a/pineappl_applgrid/build.rs +++ b/pineappl_applgrid/build.rs @@ -100,7 +100,6 @@ fn main() { let link_modifier = if cfg!(feature = "static") { // for some reason `libz.a` isn't found, although `libz.so` is for link_path in Config::new().probe("zlib").unwrap().link_paths { - println!("cargo:warning={}", link_path.to_str().unwrap()); println!("cargo:rustc-link-search={}", link_path.to_str().unwrap()); } From 204d977a6a96ecf265bbbbf295e5d306b390afd0 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Tue, 2 Apr 2024 10:11:41 +0200 Subject: [PATCH 29/52] Fix `pkg-config` call --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f20392ad..cc3fe340 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,7 @@ jobs: brew install pkg-config brew reinstall zlib brew ls --verbose zlib - pkg-config --libs-only-L --keep-system-libs pkg-config + pkg-config --libs-only-L pkg-config || true # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} From 3f42594ebd6564a3a2fdfbc3af7498f776cea2d1 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 09:38:18 +0200 Subject: [PATCH 30/52] Add more diagnostic to pkg-config call --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc3fe340..a6cd0b90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,6 +68,10 @@ jobs: brew install pkg-config brew reinstall zlib brew ls --verbose zlib + which -a pkg-config + which pkg-config + echo "PATH = ${PATH}" + echo "PKG_CONFIG_PATH = ${PKG_CONFIG_PATH}" pkg-config --libs-only-L pkg-config || true # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp From 0d39e0e8303b35e60894de32dc426d13dff4e978 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 17:07:35 +0200 Subject: [PATCH 31/52] Print more diagnostic strings --- .github/workflows/release.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6cd0b90..3fea2aab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,15 +64,12 @@ jobs: brew install lhapdf # install APPLgrid's dependencies brew install --only-dependencies --without-hoppet --without-lhapdf applgrid - # install zlib, system doesn't seem to have static library - brew install pkg-config - brew reinstall zlib - brew ls --verbose zlib - which -a pkg-config - which pkg-config - echo "PATH = ${PATH}" + ## diagnostics + export PKG_CONFIG_PATH=$(find /opt/homebrew/Cellar/ -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':') + echo "cellar = $(brew --cellar)" echo "PKG_CONFIG_PATH = ${PKG_CONFIG_PATH}" - pkg-config --libs-only-L pkg-config || true + pkg-config --libs-only-L zlib || true + ## end diagnostics # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} From d2069cdb17e04273bb4eba1d8db49cfebc380342 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 17:36:03 +0200 Subject: [PATCH 32/52] List contents of the ROOT installation --- .github/workflows/release.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fea2aab..33cab964 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,12 +64,15 @@ jobs: brew install lhapdf # install APPLgrid's dependencies brew install --only-dependencies --without-hoppet --without-lhapdf applgrid - ## diagnostics - export PKG_CONFIG_PATH=$(find /opt/homebrew/Cellar/ -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':') - echo "cellar = $(brew --cellar)" - echo "PKG_CONFIG_PATH = ${PKG_CONFIG_PATH}" - pkg-config --libs-only-L zlib || true - ## end diagnostics + # print ROOT diagnostics + echo "1:" + ls /opt/homebrew/Cellar/root/6.30.04/lib/root + echo "2:" + ls /opt/homebrew/Cellar/root/6.30.04/lib + echo "3:" + ls /opt/homebrew/Cellar/root/6.30.04 + # find all brew *.pc files and make them available + export PKG_CONFIG_PATH=$(find $(brew --cellar) -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':') # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} From a196b1b4e25d7e430814ed436a6c592405efbb77 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 17:44:20 +0200 Subject: [PATCH 33/52] Compile APPLgrid without ROOT --- .github/workflows/release.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33cab964..602dc1ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,17 +63,12 @@ jobs: # install LHAPDF brew install lhapdf # install APPLgrid's dependencies - brew install --only-dependencies --without-hoppet --without-lhapdf applgrid - # print ROOT diagnostics - echo "1:" - ls /opt/homebrew/Cellar/root/6.30.04/lib/root - echo "2:" - ls /opt/homebrew/Cellar/root/6.30.04/lib - echo "3:" - ls /opt/homebrew/Cellar/root/6.30.04 - # find all brew *.pc files and make them available + # - disable HOPPET because don't need evolution + # - disable ROOT because its static libraries are missing + brew install --only-dependencies --without-hoppet --without-lhapdf --without-root applgrid + # APPLgrid wants to be linked against zlib, and we need to find its static library via pkg-config export PKG_CONFIG_PATH=$(find $(brew --cellar) -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':') - # manually compile APPLgrid, because we need the file `appl_igrid.h` and the file it includes + # manually compile APPLgrid, because we need the file `appl_igrid.h` and the files it includes, which are possibly generated export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf applgrid From 47edd07e0cc89d05627223dd1decb4604741769b Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 17:48:09 +0200 Subject: [PATCH 34/52] Add missing `--without-root` --- .github/workflows/release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 602dc1ad..1867920c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,16 +62,14 @@ jobs: brew tap davidchall/hep # install LHAPDF brew install lhapdf - # install APPLgrid's dependencies - # - disable HOPPET because don't need evolution - # - disable ROOT because its static libraries are missing + # install APPLgrid's dependencies; disable ROOT because its static libraries are missing brew install --only-dependencies --without-hoppet --without-lhapdf --without-root applgrid # APPLgrid wants to be linked against zlib, and we need to find its static library via pkg-config export PKG_CONFIG_PATH=$(find $(brew --cellar) -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':') # manually compile APPLgrid, because we need the file `appl_igrid.h` and the files it includes, which are possibly generated export HOMEBREW_TEMP="$(pwd)"/tmp mkdir -p ${HOMEBREW_TEMP} - brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf applgrid + brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf --without-root applgrid export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} From 2363abcd9c9f93847352c80e2f78fa342e871d58 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 17:56:12 +0200 Subject: [PATCH 35/52] Manually install zlib --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1867920c..50e1a89e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,8 @@ jobs: brew install lhapdf # install APPLgrid's dependencies; disable ROOT because its static libraries are missing brew install --only-dependencies --without-hoppet --without-lhapdf --without-root applgrid + # install zlib, which is a dependency of APPLgrid but somehow missing + brew install zlib # APPLgrid wants to be linked against zlib, and we need to find its static library via pkg-config export PKG_CONFIG_PATH=$(find $(brew --cellar) -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':') # manually compile APPLgrid, because we need the file `appl_igrid.h` and the files it includes, which are possibly generated From fee20cf221c8e620b8b0c8da9378f685b65f3bed Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 18:03:14 +0200 Subject: [PATCH 36/52] Print `applgrid-config` script to diagnose building failure --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50e1a89e..959a6b43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,6 +73,9 @@ jobs: mkdir -p ${HOMEBREW_TEMP} brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf --without-root applgrid export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) + echo ">>> ---" + cat $(which applgrid-config) + echo ">>> ---" # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From dc1e31b6c9b69f144559a61f5106b51f83940a97 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 18:09:44 +0200 Subject: [PATCH 37/52] Force-remove linking to `gfortran` --- .github/workflows/release.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 959a6b43..1b84e3b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,6 +76,18 @@ jobs: echo ">>> ---" cat $(which applgrid-config) echo ">>> ---" + ls -al $(command -v applgrid-config) + echo ">>> ---" + sed 's/-lgfortran//g' $(command -v applgrid-config) > tmp + echo ">>> ---" + ls -al tmp + echo ">>> ---" + mv tmp $(command -v applgrid-config) + echo ">>> ---" + ls -al $(command -v applgrid-config) + echo ">>> ---" + chmod +x $(command -v applgrid-config) + echo ">>> ---" # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From f66ad69c90e8e561690fbfcaf15f077e7ca1f507 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 18:19:14 +0200 Subject: [PATCH 38/52] Rename existing `tmp` with `new` --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b84e3b3..02f86270 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,11 +78,11 @@ jobs: echo ">>> ---" ls -al $(command -v applgrid-config) echo ">>> ---" - sed 's/-lgfortran//g' $(command -v applgrid-config) > tmp + sed 's/-lgfortran//g' $(command -v applgrid-config) > new echo ">>> ---" - ls -al tmp + ls -al new echo ">>> ---" - mv tmp $(command -v applgrid-config) + mv new $(command -v applgrid-config) echo ">>> ---" ls -al $(command -v applgrid-config) echo ">>> ---" From fd7efcce0145deb19990fb6160047a2874cba7b8 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 18:31:36 +0200 Subject: [PATCH 39/52] Remove diagnostics and simplify `sed` call --- .github/workflows/release.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02f86270..11d91baf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,21 +73,9 @@ jobs: mkdir -p ${HOMEBREW_TEMP} brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf --without-root applgrid export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) - echo ">>> ---" - cat $(which applgrid-config) - echo ">>> ---" - ls -al $(command -v applgrid-config) - echo ">>> ---" - sed 's/-lgfortran//g' $(command -v applgrid-config) > new - echo ">>> ---" - ls -al new - echo ">>> ---" - mv new $(command -v applgrid-config) - echo ">>> ---" - ls -al $(command -v applgrid-config) - echo ">>> ---" - chmod +x $(command -v applgrid-config) - echo ">>> ---" + # do not link against `gfortran` + sed -i.bak 's/-lgfortran//g' $(command -v applgrid-config) + rm $(command -v applgrid-config).bak # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From 8a34da20a10cad9e91accecb12ae7173ed4eef7c Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 18:39:56 +0200 Subject: [PATCH 40/52] Revert last commit except the removal of diagnostics --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11d91baf..feaf6a52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,8 +74,9 @@ jobs: brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf --without-root applgrid export APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +) # do not link against `gfortran` - sed -i.bak 's/-lgfortran//g' $(command -v applgrid-config) - rm $(command -v applgrid-config).bak + sed 's/-lgfortran//g' $(command -v applgrid-config) > applgrid-config.new + mv applgrid-config.new $(command -v applgrid-config) + chmod +x $(command -v applgrid-config) # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI From e8741dd157c5f5c99246fb4d03afd4819f98ce37 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 21:53:12 +0200 Subject: [PATCH 41/52] Compile CLI on macOS against fastNLO --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index feaf6a52..2d1a2804 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,10 +77,12 @@ jobs: sed 's/-lgfortran//g' $(command -v applgrid-config) > applgrid-config.new mv applgrid-config.new $(command -v applgrid-config) chmod +x $(command -v applgrid-config) + # install fastNLO + brew install --without-fastjet fastnlo # install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI - cargo install --features=applgrid,evolve,fktable,static --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} + cargo install --all-features --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact From 6439141a483e3b10831d1febb821074ca7ba29a5 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 22:08:15 +0200 Subject: [PATCH 42/52] Update `cc` create to fix yet another problem on macOS --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3b5390ad..1e1395fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,9 +204,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cfg-if" From 31573c5aba3043979458005d5d9a98e22e00e871 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 22:13:43 +0200 Subject: [PATCH 43/52] Update `cxx` and related crates to hopefull fix missing compiler flag --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e1395fb..5dd7b950 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -347,9 +347,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.115" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de00f15a6fa069c99b88c5c78c4541d0e7899a33b86f7480e23df2431fce0bc" +checksum = "ff4dc7287237dd438b926a81a1a5605dad33d286870e5eee2db17bf2bcd9e92a" dependencies = [ "cc", "cxxbridge-flags", @@ -374,15 +374,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.115" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3fed61d56ba497c4efef9144dfdbaa25aa58f2f6b3a7cf441d4591c583745c" +checksum = "701a1ac7a697e249cdd8dc026d7a7dafbfd0dbcd8bd24ec55889f2bc13dd6287" [[package]] name = "cxxbridge-macro" -version = "1.0.115" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8908e380a8efd42150c017b0cfa31509fc49b6d47f7cb6b33e93ffb8f4e3661e" +checksum = "b404f596046b0bb2d903a9c786b875a126261b52b7c3a64bbb66382c41c771df" dependencies = [ "proc-macro2", "quote", From ad0de9aa5536b242e76cbd9ac9781864ecf9a8d1 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 22:23:43 +0200 Subject: [PATCH 44/52] Explicitly set C++11 standard --- pineappl_fastnlo/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pineappl_fastnlo/build.rs b/pineappl_fastnlo/build.rs index c384b86e..4724b6a6 100644 --- a/pineappl_fastnlo/build.rs +++ b/pineappl_fastnlo/build.rs @@ -34,6 +34,7 @@ fn main() { cxx_build::bridge("src/lib.rs") .file("src/fastnlo.cpp") .include(fnlo_include_path.trim()) + .std("c++11") // apparently not supported by MSVC, but fastNLO probably can't be compiled on Windows .compile("fnlo-bridge"); println!("cargo:rerun-if-changed=src/lib.rs"); From b7aa30466b6660846b358edbd438339f050271b4 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Wed, 3 Apr 2024 22:36:24 +0200 Subject: [PATCH 45/52] Add LHAPDF include paths to fastNLO --- Cargo.lock | 1 + pineappl_fastnlo/Cargo.toml | 1 + pineappl_fastnlo/build.rs | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 5dd7b950..80a1600a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1328,6 +1328,7 @@ version = "0.7.4-rc.1" dependencies = [ "cxx", "cxx-build", + "pkg-config", "thiserror", ] diff --git a/pineappl_fastnlo/Cargo.toml b/pineappl_fastnlo/Cargo.toml index 6d3e2a2a..de1694c4 100644 --- a/pineappl_fastnlo/Cargo.toml +++ b/pineappl_fastnlo/Cargo.toml @@ -21,6 +21,7 @@ thiserror = "1.0.30" [build-dependencies] cxx-build = { version = "1.0.65" } +pkg-config = "0.3" [features] static = [] diff --git a/pineappl_fastnlo/build.rs b/pineappl_fastnlo/build.rs index 4724b6a6..9d9f627a 100644 --- a/pineappl_fastnlo/build.rs +++ b/pineappl_fastnlo/build.rs @@ -1,6 +1,7 @@ #![allow(missing_docs)] use std::process::Command; +use pkg_config::Config; fn main() { let fnlo_lib_path = String::from_utf8( @@ -31,9 +32,12 @@ fn main() { println!("cargo:rustc-link-lib={link_modifier}fastnlotoolkit"); + let lhapdf = Config::new().atleast_version("6").probe("lhapdf").unwrap(); + cxx_build::bridge("src/lib.rs") .file("src/fastnlo.cpp") .include(fnlo_include_path.trim()) + .includes(lhapdf.include_paths) .std("c++11") // apparently not supported by MSVC, but fastNLO probably can't be compiled on Windows .compile("fnlo-bridge"); From 98403f5f7cf361f50c9693a5093b1f8111a4a96c Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 4 Apr 2024 09:08:58 +0200 Subject: [PATCH 46/52] Install manpages on both Linux and macOS --- .github/workflows/release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d1a2804..f7f326f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,6 +83,9 @@ jobs: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host=${{ matrix.target }} # build the CLI cargo install --all-features --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} + # build manpages + mkdir -p prefix/share/man/man1 + cargo xtask install-manpages prefix/share/man/man1 cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact @@ -128,6 +131,9 @@ jobs: - name: Compile binary run: | cargo install --all-features --locked --path pineappl_cli --root=prefix --target=${{ matrix.target }} + # build manpages + mkdir -p prefix/share/man/man1 + cargo xtask install-manpages prefix/share/man/man1 cd prefix tar czf ../pineappl_cli-${{ matrix.target }}.tar.gz . - name: Upload artifact From 41514a7575b079eb44db447afbb6d2a26aa47fcb Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 4 Apr 2024 09:22:31 +0200 Subject: [PATCH 47/52] Debug version string when installing manpages --- xtask/src/install_manpages.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtask/src/install_manpages.rs b/xtask/src/install_manpages.rs index e75223fa..4b3d41ee 100644 --- a/xtask/src/install_manpages.rs +++ b/xtask/src/install_manpages.rs @@ -47,7 +47,7 @@ impl Subcommand for Opts { .unwrap() .strip_prefix('v') // UNWRAP: the version string must start with a 'v' - .unwrap() + .expect(&format!("version string should contain 'v': {:?}", cmd.get_version())) .to_string(); let mut cmd = cmd.version(version.clone()); From 708f58d3b6df5161f4d6993a9fc9be60ba8acf85 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 4 Apr 2024 09:36:10 +0200 Subject: [PATCH 48/52] Try to fix version string patching on GitHub --- xtask/src/install_manpages.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xtask/src/install_manpages.rs b/xtask/src/install_manpages.rs index 4b3d41ee..62c9aea1 100644 --- a/xtask/src/install_manpages.rs +++ b/xtask/src/install_manpages.rs @@ -41,14 +41,13 @@ fn render_manpages(path: &Path, cmd: &clap::Command, version: &str) -> Result<() impl Subcommand for Opts { fn run(&self) -> Result<()> { let cmd = pineappl_cli::Opts::command(); - let version: String = cmd + let version = cmd .get_version() // UNWRAP: the command must have a version - .unwrap() - .strip_prefix('v') - // UNWRAP: the version string must start with a 'v' - .expect(&format!("version string should contain 'v': {:?}", cmd.get_version())) - .to_string(); + .unwrap(); + + // TODO: why does the version string not start with a 'v' on GitHub? + let version = version.strip_prefix('v').unwrap_or(version).to_string(); let mut cmd = cmd.version(version.clone()); // this is needed so subcommands return the correct `bin_name` From 40d962aae716d713ab9ff58b60bf8c1181531f69 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 5 Apr 2024 09:25:34 +0200 Subject: [PATCH 49/52] Add zlib when linking statically --- pineappl_fastnlo/build.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pineappl_fastnlo/build.rs b/pineappl_fastnlo/build.rs index 9d9f627a..040b9c8a 100644 --- a/pineappl_fastnlo/build.rs +++ b/pineappl_fastnlo/build.rs @@ -25,6 +25,17 @@ fn main() { .unwrap(); let link_modifier = if cfg!(feature = "static") { + let zlib = Config::new().probe("zlib").unwrap(); + + // for some reason `libz.a` isn't found, although `libz.so` is + for link_path in zlib.link_paths { + println!("cargo:rustc-link-search={}", link_path.to_str().unwrap()); + } + + for lib in zlib.libs { + println!("cargo:rustc-link-lib=static={lib}"); + } + "static=" } else { "" From 43791240f3807b184673c4870116a46fb6132fb2 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 26 Apr 2024 10:59:13 +0200 Subject: [PATCH 50/52] Revert "refactor: Use Rust version of convolute_with_one" This reverts commit 0d9876fb5bc857beddf4eb4eec323e4cf037d509. --- pineappl_py/pineappl/fk_table.py | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/pineappl_py/pineappl/fk_table.py b/pineappl_py/pineappl/fk_table.py index 813f7a7b..91a7080c 100644 --- a/pineappl_py/pineappl/fk_table.py +++ b/pineappl_py/pineappl/fk_table.py @@ -1,3 +1,5 @@ +import numpy as np + from .pineappl import PyFkTable, PyFkAssumptions from .utils import PyWrapper @@ -50,6 +52,42 @@ def optimize(self, assumptions = "Nf6Ind"): assumptions = FkAssumptions(assumptions) return self._raw.optimize(assumptions._raw) + def convolute_with_one( + self, + pdg_id, + xfx, + bin_indices=np.array([], dtype=np.uint64), + lumi_mask=np.array([], dtype=bool), + ): + r"""Convolute FkTable with a pdf. + + Parameters + ---------- + pdg_id : int + PDG Monte Carlo ID of the hadronic particle `xfx` is the PDF for + xfx : callable + lhapdf like callable with arguments `pid, x, Q2` returning x*pdf for :math:`x`-grid + bin_indices : sequence(int) + A list with the indices of the corresponding bins that should be calculated. An + empty list means that all orders should be calculated. + lumi_mask : sequence(bool) + Mask for selecting specific luminosity channels. The value `True` means the + corresponding channel is included. An empty list corresponds to all channels being + enabled. + + Returns + ------- + list(float) : + cross sections for all bins, for each scale-variation tuple (first all bins, then + the scale variation) + """ + return self.raw.convolute_with_one( + pdg_id, + xfx, + np.array(bin_indices), + np.array(lumi_mask), + ) + class FkAssumptions(PyWrapper): """ From d1ed86320c3230f10603320821c50c73b26bbc09 Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 26 Apr 2024 10:59:39 +0200 Subject: [PATCH 51/52] Remove `signature` macro that breaks Python 3.6 support This commit and the previous should be reverted when we drop Python 3.6 support --- pineappl_py/src/fk_table.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/pineappl_py/src/fk_table.rs b/pineappl_py/src/fk_table.rs index f561b535..b1565afe 100644 --- a/pineappl_py/src/fk_table.rs +++ b/pineappl_py/src/fk_table.rs @@ -223,7 +223,6 @@ impl PyFkTable { /// ------- /// numpy.ndarray(float) : /// cross sections for all bins - #[pyo3(signature = (pdg_id, xfx, bin_indices = None, lumi_mask= None))] pub fn convolute_with_one<'py>( &self, pdg_id: i32, From 0e5127ea02246d406c2bad92f3341301333c221f Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 26 Apr 2024 12:21:18 +0200 Subject: [PATCH 52/52] Try to fix problems on macOS --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7f326f1..97d899a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: strategy: matrix: include: - - os: macos-latest + - os: macos-13 target: x86_64-apple-darwin - os: macos-14 # we cannot cross-compile, because we need also all dependencies for the specified target @@ -262,7 +262,7 @@ jobs: path: dist wheels-macos: - runs-on: macos-latest + runs-on: macos-13 strategy: matrix: target: [aarch64, x86_64]