Skip to content

Conversation

@ktf
Copy link
Member

@ktf ktf commented Jul 10, 2025

  • Remove unneeded (as of Rivet 4.0) patching of Rivet sources.
  • Avoid reinventing the wheel for dependency tracking.
  • Properly pass HDF5, CGAL and ... dependency
  • Use alice-module-tools to generate the correct modulefile

@ktf ktf requested a review from a team as a code owner July 10, 2025 15:04
@ktf
Copy link
Member Author

ktf commented Jul 10, 2025

@jackal1-66 can you please have a look? I am not 100% sure I got everything right but I think this (once verified) is more maintainable than the current solution.

@ktf ktf mentioned this pull request Jul 10, 2025
- Remove unneeded (as of Rivet 4.0) patching of Rivet sources.
- Avoid reinventing the wheel for dependency tracking.
- Properly pass HDF5, CGAL and ... dependency
- Use alice-module-tools to generate the correct modulefile
@jackal1-66
Copy link
Contributor

Ciao Giulio, this is a big refactoring that was definitely needed. I need to take some time to test it properly.

@jackal1-66
Copy link
Contributor

Ciao Giulio, the build goes well, however the environment doesn't seem to load because RIVET_ROOT is missing. I will debug this a bit further when I have a moment

@ktf
Copy link
Member Author

ktf commented Oct 31, 2025

@jackal1-66
Copy link
Contributor

jackal1-66 commented Nov 1, 2025

https://github.com/alisw/alidist/pull/5947/files#diff-7e6b5beab098b8c1b1d7a7a23aea706c876d346278a3ac2777991672a94b0de4R97 has it. Can you cut&paste the modulefile you get?

The modulefile has RIVET_ROOT, however the issue is that RIVET_ROOT is not set entirely (missing set RIVET_ROOT \$::env(BASEDIR)/$PKGNAME/\$version). An easy working solution could be to simply replace every instance of $RIVET_ROOT with $PKG_ROOT (it works this way).

P.s. feature request: would it be possible to have a --pkg or similar flag to alibuild-generate-module that does exactly setenv PACKAGE_ROOT \$PKG_ROOT?

@ktf
Copy link
Member Author

ktf commented Nov 1, 2025

I fixed the recipe. I do not like the idea of making it easy for people to add _ROOT. One of the critical features of aliBuild is to be able to use system tools. Introducing aliBuild / alidist specific variables / behaviors makes it more complicated to replace externals with their system conterpart.

@jackal1-66
Copy link
Contributor

Ciao @ktf , I had tested it before, but wanted to be sure:

Loading Rivet/rivet-4.1.0-local2
  Module ERROR: can't read "RIVET_ROOT": no such variable
        while executing
    "setenv RIVET_ANALYSIS_PATH $RIVET_ROOT/lib/Rivet"
        (file
    "/home/mgiacalo/alice/sw/MODULES/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local2"
    line 53)
    Please contact <root@localhost>

Loading O2sim/latest-o2
  ERROR: Load of requirement Rivet/rivet-4.1.0-local2 failed

All the instances of RIVET_ROOT need to be changed in the recipe, otherwise a similar error will appear...

@jackal1-66
Copy link
Contributor

Commented in the code: there's a typo.
In addition Line 117 has another RIVET_ROOT that needs to be changed in PKG_ROOT

@jackal1-66
Copy link
Contributor

jackal1-66 commented Nov 4, 2025

Going forward with the debug, I'm getting:

/home/mgiacalo/alice/sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local4/etc/profile.d/init.sh: line 2: /ubuntu2404_x86-64/HepMC3/3.3.0-34/etc/profile.d/init.sh: No such file or directory
/home/mgiacalo/alice/sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local4/etc/profile.d/init.sh: line 3: /ubuntu2404_x86-64/YODA/yoda-2.1.0-6/etc/profile.d/init.sh: No such file or directory
... etc

When running rivet-build. The content of the init.sh file is:

: "${ALIBUILD_ARCH_PREFIX:=ubuntu2404_x86-64}"
[ -n "${HEPMC3_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/HepMC3/3.3.0-34/etc/profile.d/init.sh
[ -n "${YODA_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/YODA/yoda-2.1.0-6/etc/profile.d/init.sh
[ -n "${FASTJET_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/fastjet/v3.4.1_1.052-alice3-7/etc/profile.d/init.sh
[ -n "${CGAL_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/cgal/4.12.2-23/etc/profile.d/init.sh
[ -n "${GMP_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/GMP/v6.2.1-6/etc/profile.d/init.sh
[ -n "${PYTHON_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/Python/v3.9.16-16/etc/profile.d/init.sh
[ -n "${PYTHON_MODULES_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/Python-modules/1.0-24/etc/profile.d/init.sh
[ -n "${GCC_TOOLCHAIN_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/GCC-Toolchain/v14.2.0-alice2-1/etc/profile.d/init.sh
[ -n "${PYTHON_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/Python/v3.9.16-16/etc/profile.d/init.sh
[ -n "${ALIBUILD_RECIPE_TOOLS_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/alibuild-recipe-tools/0.2.5-1/etc/profile.d/init.sh
[ -n "${DEFAULTS_RELEASE_REVISION}" ] || . "$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/defaults-release/v1-1/etc/profile.d/init.sh
export RIVET_ROOT="$WORK_DIR/$ALIBUILD_ARCH_PREFIX"/Rivet/rivet-4.1.0-local4
export RIVET_VERSION=rivet-4.1.0
export RIVET_REVISION=local4
export RIVET_HASH=5a1579d0a8b86ba869e47a2591188a8f0d74f587
export RIVET_COMMIT=rivet-4.1.0
export PYTHONPATH="$RIVET_ROOT/lib/python/site-packages${PYTHONPATH+:$PYTHONPATH}"
export PATH="$RIVET_ROOT/bin${PATH+:$PATH}"
export LD_LIBRARY_PATH="$RIVET_ROOT/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"

Possibly related to the removal of rivet_3rdparty.sh?

P.s. PGK_ROOT ==> PKG_ROOT typo reminder

@ktf
Copy link
Member Author

ktf commented Nov 5, 2025

I have fixed the typo and adapted the loading of the 3rd party stuff.

@jackal1-66
Copy link
Contributor

I tested the PR on a local machine and everything seems to work fine now. A lot of problems usually arise when running directly on GRID machines, so we might discover other bugs later. So far I would consider the recipe cleaning a success. CI issues seem to be unrelated to the PR.

@jackal1-66
Copy link
Contributor

Unfortunately I retested everything again, but this time using a docker configuration. In this case there are problems that I'm quite sure will appear as well on lxplus/GRID.

/home/mgiacalo/docker-alice/sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local1/bin/rivet-build: line 133: /sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local1/etc/profile.d/init.sh: No such file or directory
g++ -std=c++17 -o "RivetALICE_2025_TEST.so" -shared -fPIC -I/local/workspace/DailyBuilds/DailyO2-ubuntu2404/daily-tags.O42uEgMqD2/ubuntu2404_x86-64/hdf5/1.14.6-1/include -I/sw/ubuntu2404_x86-64/cgal/4.12.2-23/include -I/sw/ubuntu2404_x86-64/fastjet/v3.4.1_1.052-alice3-7/include -I/sw/ubuntu2404_x86-64/GMP/v6.2.1-6/include -I/sw/ubuntu2404_x86-64/hdf5/1.14.6-1/include -I/sw/ubuntu2404_x86-64/HepMC3/3.3.0-34/include -I/sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local1/include -I/sw/ubuntu2404_x86-64/YODA/yoda-2.1.0-6/include -I/usr/include   -pedantic -Wall -Wunused-variable -Wno-long-long -Wno-format -Werror=uninitialized -Werror=delete-non-virtual-dtor -fopenmp -fPIC -O2 -std=c++20    -lCGAL -lfastjet -lfastjetcontribfragile -lfastjetplugins -lfastjettools -lgmp -lm -lsiscone -lsiscone_spherical -L/sw/ubuntu2404_x86-64/cgal/4.12.2-23/lib -L/sw/ubuntu2404_x86-64/fastjet/v3.4.1_1.052-alice3-7/lib -L/sw/ubuntu2404_x86-64/GMP/v6.2.1-6/lib -L/sw/ubuntu2404_x86-64/hdf5/1.14.6-1/lib -L/sw/ubuntu2404_x86-64/HepMC3/3.3.0-34/lib -L/sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local1/lib -L/sw/ubuntu2404_x86-64/YODA/yoda-2.1.0-6/lib -Wl,--no-as-needed   -lRivet    ALICE_2025_TEST.cc 
ALICE_2025_TEST.cc:1:10: fatal error: Rivet/Analysis.hh: No such file or directory
    1 | #include "Rivet/Analysis.hh"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

I get this when running a simple rivet-build test command

# rivet-config and rivet-build
cat << EOF > source3rd
test -f \$prefix/etc/rivet_3rdparty.sh && source \$prefix/etc/rivet_3rdparty.sh
WORK_DIR=${WORK_DIR:-$INSTALLROOT/../../../} source $INSTALLROOT/etc/profile.d/init.sh
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WORK_DIR=${WORK_DIR:-$INSTALLROOT/../../../} source $INSTALLROOT/etc/profile.d/init.sh
WORK_DIR=$(dirname $(type rivet-build))/../../../../ source $(dirname $(type rivet-build))/../etc/profile.d/init.sh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one possibility. The other one is to simply consider all dependencies as runtime dependencies since using Rivet seems to imply building stuff at runtime, so the distinction does not really make sense for it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/home/mgiacalo/docker-alice/sw/ubuntu2404_x86-64/Rivet/rivet-4.1.0-local2/bin/rivet-build: line 133: /../etc/profile.d/init.sh: No such file or directory
This doesn't seem to work unfortunately

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's have a look later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants