In short, I have the mesa package installed and another package I installed appears to have a different mesa in /gnu/store/ as a runtime dependency.
As a result, cmake is unable to generate a safe runtime search path, because there are 2 different libGL.so.1 and libEGL.so.1 files in the path, one from the mesa I installed and another from the other mesa that was brought in as a runtime dependency.
Here is the cmake warning:
#+begin_src sh
CMake Warning at CMakeLists.txt:35 (add_executable):
Cannot generate a safe runtime search path for target exampleA1 because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libEGL.so.1] in /home/jake/.guix-profile/lib may be hidden by files in:
/gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3.2/lib
runtime library [libGL.so.1] in /home/jake/.guix-profile/lib may be hidden by files in:
/gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3.2/lib
Some of these libraries may not be found correctly.
#+end_src
I think the guix package definition below is somewhere introducing the additional mesa at /gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3.2.
The input clhep-2.4.6.2 and native inputs are omitted for brevity because I don't think they're relevant, but the full package definition and inputs can be found at
https://github.com/jakeforster/guix-channel/blob/master/jforst/packages/geant4.scm#+begin_src scheme
(define-public geant4-vis-11-1-1
(package
(name "geant4-vis")
(version "11.1.1")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "
https://gitlab.cern.ch/geant4/geant4")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "141fhmh0w8sbp6cckccf3dswn596ds4vgqwc3gz6i53ypyxmv2fw"))))
(build-system cmake-build-system)
(inputs (list coreutils
gcc-toolchain
xerces-c
expat
clhep-2.4.6.2
python-2
python-3.10
perl
tcsh
qtbase-5
libxmu
libxt))
(arguments
`(#:configure-flags (let* ((out (assoc-ref %outputs "out"))
(qt-path (string-append (assoc-ref
%build-inputs
"qtbase")
"/lib/cmake/Qt5")))
(list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
(string-append "-DCMAKE_PREFIX_PATH=" qt-path)
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DGEANT4_BUILD_MULTITHREADED=ON"
"-DGEANT4_ENABLE_TESTING=OFF"
"-DGEANT4_INSTALL_DATA=OFF"
"-DGEANT4_USE_GDML=ON" ;xerces-c is needed for GDML
"-DGEANT4_USE_SYSTEM_CLHEP=ON"
"-DGEANT4_USE_SYSTEM_EXPAT=ON"
"-DGEANT4_USE_OPENGL_X11=ON"
"-DGEANT4_USE_QT=ON"
(let ((datadir (string-append out
"/share/geant4/data")))
(string-append "-DGEANT4_INSTALL_DATADIR="
datadir "/share/geant4/data"))))
#:phases (modify-phases %standard-phases
(add-after 'install 'install-data
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((G4NDL (assoc-ref inputs "G4NDL"))
(G4EMLOW (assoc-ref inputs "G4EMLOW"))
(G4PhotonEvaporation (assoc-ref inputs
"G4PhotonEvaporation"))
(G4RadioactiveDecay (assoc-ref inputs
"G4RadioactiveDecay"))
(G4PARTICLEXS (assoc-ref inputs "G4PARTICLEXS"))
(G4PII (assoc-ref inputs "G4PII"))
(G4RealSurface (assoc-ref inputs "G4RealSurface"))
(G4SAIDDATA (assoc-ref inputs "G4SAIDDATA"))
(G4ABLA (assoc-ref inputs "G4ABLA"))
(G4INCL (assoc-ref inputs "G4INCL"))
(G4ENSDFSTATE (assoc-ref inputs "G4ENSDFSTATE"))
(G4TENDL (assoc-ref inputs "G4TENDL"))
(datadir (string-append (assoc-ref outputs "out")
"/share/geant4/data")))
(display (list "Data archives:"
G4NDL
G4EMLOW
G4PhotonEvaporation
G4RadioactiveDecay
G4PARTICLEXS
G4PII
G4RealSurface
G4SAIDDATA
G4ABLA
G4INCL
G4ENSDFSTATE))
(newline)
(mkdir-p datadir)
(invoke "tar" "xvf" G4NDL "-C" datadir)
(invoke "tar" "xvf" G4EMLOW "-C" datadir)
(invoke "tar" "xvf" G4PhotonEvaporation "-C" datadir)
(invoke "tar" "xvf" G4RadioactiveDecay "-C" datadir)
(invoke "tar" "xvf" G4PARTICLEXS "-C" datadir)
(invoke "tar" "xvf" G4PII "-C" datadir)
(invoke "tar" "xvf" G4RealSurface "-C" datadir)
(invoke "tar" "xvf" G4SAIDDATA "-C" datadir)
(invoke "tar" "xvf" G4ABLA "-C" datadir)
(invoke "tar" "xvf" G4INCL "-C" datadir)
(invoke "tar" "xvf" G4ENSDFSTATE "-C" datadir)
(invoke "tar" "xvf" G4TENDL "-C" datadir)))))
;; no tests in Makefile
#:tests? #f))
(native-inputs `(("G4NDL" ,g4ndl-4.7)
("G4EMLOW" ,g4emlow-8.2)
("G4PhotonEvaporation" ,photon-evaporation-5.7)
("G4RadioactiveDecay" ,radioactive-decay-5.6)
("G4PARTICLEXS" ,g4particlexs-4.0)
("G4PII" ,g4pii-1.3)
("G4RealSurface" ,real-surface-2.2)
("G4SAIDDATA" ,g4saiddata-2.0)
("G4ABLA" ,g4abla-3.1)
("G4INCL" ,g4incl-1.0)
("G4ENSDFSTATE" ,g4ensdfstate-2.3)
("G4TENDL" ,g4tendl-1.4)))
(home-page "
https://geant4.web.cern.ch")
(synopsis "Monte Carlo particle track simulations")
(description
"Geant4 is a toolkit for the simulation of the passage of particles
through matter. Its areas of application include high energy,
nuclear and accelerator physics, as well as studies
in medical and space science.
This package supports visualisation with OpenGL and Qt.")
(license (license:non-copyleft
"
https://geant4.web.cern.ch/download/license"))))
#+end_src
Steps to reproduce the cmake warning given above:
#+begin_src sh
git clone
https://github.com/jakeforster/guix-channel.git guix shell -L ./guix-channel geant4-vis cmake make gcc-toolchain mesa
# copy an example app
INSTALL_DIR=$(guix build geant4-vis)
cp -rf $INSTALL_DIR/share/Geant4/examples/basic/B1 .
# the store is read only
chmod -R 751 B1/
mkdir B1/build
cd B1/build
cmake ..
#+end_src
I have also reproduced the warning using a guix shell -C --pure. There's just some extra hassle with making the build dir first and sharing the B1 directory containing the CMakeLists.txt file.
Any suggestions for how to resolve this would be much appreciated.
Thanks!
Jake