make sure that OpenFOAM's wmake can find MPFR and GMP if CGAL >= 5.0 (header-only) is used#3366
Conversation
| else: | ||
| env.setvar("%s_ROOT" % depend.upper(), dependloc) | ||
| for dep in self.cfg.dependencies(): | ||
| # CGAL >= 5.x is header-only, but when using it OpenFOAM still needs MPFR and GMP. |
There was a problem hiding this comment.
comment mentions GMP, but nothing is being done for GMP below, only MPFR?
There was a problem hiding this comment.
Yeah, good question. It does look like it needs GMP, but there's no GMP_LIB_DIR... In for instance https://develop.openfoam.com/Development/openfoam/-/blob/OpenFOAM-v2312/wmake/rules/General/cgal-header-only?ref_type=tags they do add -lgmp. So I'm not completely sure what to do here...
There was a problem hiding this comment.
With the current approach it does build fine, but we did have undefined references to GMP before. So I guess it does somehow find GMP.
There was a problem hiding this comment.
I checked the successful build from EESSI/software-layer#563 (comment) (without any modules loaded):
bedroge@x86-64-amd-zen3-node3 /project/def-users/SHARED/jobs/2024.06/pr_563/12933 $ ldd /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/OpenFOAM/v2312-foss-2023a/OpenFOAM-v2312/platforms/linux64GccDPInt32Opt/bin/* | grep -i mpfr
libmpfr.so.6 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/MPFR/4.2.0-GCCcore-12.3.0/lib/../lib64/libmpfr.so.6 (0x00001540bb46c000)
libmpfr.so.6 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/MPFR/4.2.0-GCCcore-12.3.0/lib/../lib64/libmpfr.so.6 (0x00001513a0015000)
libmpfr.so.6 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/MPFR/4.2.0-GCCcore-12.3.0/lib/../lib64/libmpfr.so.6 (0x00001554b0428000)
bedroge@x86-64-amd-zen3-node3 /project/def-users/SHARED/jobs/2024.06/pr_563/12933 $ ldd /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/OpenFOAM/v2312-foss-2023a/OpenFOAM-v2312/platforms/linux64GccDPInt32Opt/bin/* | grep -i gmp
libgmp.so.10 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/GMP/6.2.1-GCCcore-12.3.0/lib/../lib64/libgmp.so.10 (0x0000148dbb6f7000)
libgmp.so.10 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/GMP/6.2.1-GCCcore-12.3.0/lib/../lib64/libgmp.so.10 (0x00001530f2753000)
libgmp.so.10 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/GMP/6.2.1-GCCcore-12.3.0/lib/../lib64/libgmp.so.10 (0x000014d73d988000)
So it did indeed pick up the right GMP.
only append MPFR info to `have_cgal` script in OpenFOAM easyblock if it exists
…ks into openfoam_cgal
|
@boegelbot please test @ jsc-zen3 |
|
@boegel: Request for testing this PR well received on jsczen3l1.int.jsc-zen3.fz-juelich.de PR test command '
Test results coming soon (I hope)... Details- notification for comment with ID 2176198762 processed Message to humans: this is just bookkeeping information for me, |
|
Test report by @boegelbot Overview of tested easyconfigs (in order)
Build succeeded for 6 out of 6 (3 easyconfigs in total) |
With EESSI we ran into several undefined references to GMP and MPFR when building OpenFOAM v2312, see EESSI/software-layer#563 (comment)
This seems related to CGAL, which is header-only since version 5.0. Apparently, here's still some kind of indirect dependency on GMP and MPFR (the Ubuntu installation instructions also have these packages listed: https://gitlab.com/openfoam/openfoam/-/blob/master/doc/Requirements.md#ubuntu-eg-2204), which are lacking in the EESSI build container.
Even though OpenFOAM's wmake scripts seems to contain functionality for handling these situations (there is a
cgal-no-mpfrrule, for instance: https://gitlab.com/openfoam/openfoam/-/blob/master/wmake/rules/General/cgal-no-mpfr?ref_type=heads), there are lots of issues about the same topic, e.g. this one related to Spack: https://develop.openfoam.com/Development/openfoam/-/issues/3101.They even stick to CGAL 4.x: https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/openfoam/package.py#L372.
This PR fixes this by overriding some variables in the
have_cgalscript, which finds CGAL and MPFR, in case CGAL >= 5.0 is used and MPFR is listed as dependency in the easyconfig. For the latter I'll open an easyconfigs PR.