sbmlteam / libsbml

LibSBML is a native library for reading, writing and manipulating files and data streams containing the Systems Biology Markup Language (SBML). It offers language bindings for C, C++, C#, Java, JavaScript, MATLAB, Perl, PHP, Python, R and Ruby.

Home Page:https://sbml.org/software/libsbml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

find_package does not work on Ubuntu 22.10

kaiserls opened this issue · comments

I tried to compile one of the example programs from examples using cmake. However CMake cant find libsbml using the find_package command. Could someone who has a better knowledge about cmake help to resolve this issue?

Expected behaviour

The cmake command find_package(sbml REQUIRED) successfully finds libsbml.

Observed behaviour

CMake can not find the file sbml-config.cmake and therefore can not find the library and header files of sbml. Moving the config files into a subfolder, like most libraries do it, allows cmake to find them but messes up the path variables.

Steps to reproduce

  1. Install Ubuntu 22.10
  2. sudo apt install libsbml5-dev
  3. Download CMakeLists.txt and one of the examples, rename to example.cpp
  4. mkdir build && cd build && cmake .. && make -j

Package version

Package: libsbml5-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 32111
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Source: libsbml
Version: 5.19.0+dfsg-1ubuntu2
Provides: libsbml-dev
Depends: libsbml5 (= 5.19.0+dfsg-1ubuntu2)

cmake version: 3.24.2

Similar issues:

Probably related to Issue #245

Fixing the issue

I tried to track down the problem and came to the following conclusion:
The sbml-config-*.cmake files are written directly to "/urs/lib/x86_64-linux-gnu/cmake" and not into a subfolder sbml. After moving the files into this newly created subfolder a new issue occurs: The variable _IMPORT_PREFIX is set to /usr/lib and used as prefix for /lib/x86_64-linux-gnu/libsbml.so.5.19.0. Manually fixing the paths leads to the successful compilation of the example program.

CMakeLists.txt

we are actually not maintainers of the ubuntu package. I'm not sure what we could do to help resolving the issue.

The error also occurs if I build the library from the source code.