guix-science
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple versions of mesa libraries in cmake runtime search path


From: Jake
Subject: Re: Multiple versions of mesa libraries in cmake runtime search path
Date: Fri, 22 Mar 2024 05:23:05 +0000

If the problem is that qtbase-5 is propagating a different mesa than the one we can install (i.e. a different /gnu/store entry), let's try installing qtbase-5 and using its propagated mesa instead of installing mesa ourselves.

#+begin_src sh

    guix shell geant4-vis cmake make gcc-toolchain qtbase@5

#+end_src

Alas, we still have 2 different mesa versions:

#+begin_example

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 /gnu/store/6imr8p8j0d59s4r0912xy8mficw8kc2y-profile/lib may be hidden by files in:
      /gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3.2/lib
    runtime library [libGL.so.1] in /gnu/store/6imr8p8j0d59s4r0912xy8mficw8kc2y-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_example

The installed qtbase-5 propagates the same mesa as the one we can install:

/gnu/store/6imr8p8j0d59s4r0912xy8mficw8kc2y-profile/lib/libEGL.so -> /gnu/store/clnk1arbkc6v21a93gxnirvsbjaz5v07-mesa-23.3.2/lib/libEGL.so

So then, where is this other mesa coming from (2rzdlwb...), if not qtbase-5?

I've included possibly relevant lines from the generated CMakeCache.txt

#+begin_example

//Path to a file.
OPENGL_EGL_INCLUDE_DIR:PATH=/gnu/store/6imr8p8j0d59s4r0912xy8mficw8kc2y-profile/
include

//Path to a file.
OPENGL_GLX_INCLUDE_DIR:PATH=/gnu/store/6imr8p8j0d59s4r0912xy8mficw8kc2y-profile/
include

//Path to a file.
OPENGL_INCLUDE_DIR:PATH=/gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3.2/
include

//Path to a library.
OPENGL_egl_LIBRARY:FILEPATH=/gnu/store/6imr8p8j0d59s4r0912xy8mficw8kc2y-profile/
lib/libEGL.so

//Path to a library.
OPENGL_gl_LIBRARY:FILEPATH=/gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3
.2/lib/libGL.so

#+end_example

Cheers
Jake

On Thu, Mar 14, 2024 at 3:25 AM Jake <jforst.mailman@gmail.com> wrote:
Hello

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.

If you use your profile instead of a shell, you can confirm the libEGL.so.1 and libGL.so.1 libraries in ~/.guix-profile/lib/ point to the same mesa in /gnu/store/ that is installed with the following:

#+begin_src sh

  $ guix package -I | grep mesa
  mesa                 23.3.2           out /gnu/store/clnk1arbkc6v21a93gxnirvsbjaz5v07-mesa-23.3.2

  $ ls -l ~/.guix-profile/lib/ | grep libEGL.so.1
  lrwxrwxrwx 1 root root   71 Jan  1  1970 libEGL.so.1 -> /gnu/store/clnk1arbkc6v21a93gxnirvsbjaz5v07-mesa-23.3.2/lib/libEGL.so.1

  $ ls -l ~/.guix-profile/lib/ | grep libGL.so.1
  lrwxrwxrwx 1 root root   70 Jan  1  1970 libGL.so.1 -> /gnu/store/clnk1arbkc6v21a93gxnirvsbjaz5v07-mesa-23.3.2/lib/libGL.so.1

#+end_src

So I'm guessing during the installation of geant4-vis, something is bringing in a different mesa from the store (/gnu/store/2rzdlwb0f7ksj7a78kjn7a7qs22avi8l-mesa-23.3.2) into the path as a runtime dependency.
I note that qtbase-5 has mesa as a propagated input, so perhaps it's that.
But it's not clear to me why the mesa propagated for qtbase-5 would be different (i.e. has a different /gnu/store/ entry) from the mesa that I install in my profile or shell.
Any suggestions for how to resolve this would be much appreciated.

Thanks!

Jake

reply via email to

[Prev in Thread] Current Thread [Next in Thread]