cmake, scribus - List all required libraries

186 views Asked by At

I'm trying to build Scribus (1.5.8 and 1.7) from source in Ubuntu 20.04. It uses cmake as its build system. I have no experience with cmake.

Is there a way to get a list of all the required and/or optional libraries from cmake or any command line tool?

Right now, my "workflow" is the following:

  1. Run cmake . in source directory.
  2. If it fails, go to 3. Else, go to 7.
  3. Search error messages for mentions of missing libraries.
  4. Run apt search to find (hopefully) right library.
  5. Run apt install to install (hopefully) right library.
  6. Goto 1.
  7. Proceed.

This is very tedious. My hope is to have something that just generates a list of libraries that cmake will look for. Ideally, this list could simply be given to apt install to pull in all the libraries.

Although the scribus developers provide lists of required libraries in their wiki, these lists do not seem to be exhaustive or up to date.

I tried using cmake --graphviz=foo.dot, but it only generates any output after I got cmake . to run successfully.

1

There are 1 answers

4
KamilCuk On BEST ANSWER

Is there a way to get a list of all the required and/or optional libraries from cmake or any command line tool?

Not in an automated way. Generally that is not possible. There may be dependencies not managed by CMake, outside of CMake code, there may be dependencies of dependencies, and many corner cases. Also, there is no clear mapping between "library name" and "project name" (I mean, between .so or .a or .h ile and the actual project where it comes from).

Generally, compiling a library requires (manual) knowledge about that library and the library dependencies. This is exactly the work that package maintainers in distributions do - they compile the libraries and list all library dependencies for package managers. While there come ever smarter "build systems", this is not a silver bullet, and C++ ecosystem is way too diverse.


But sure - you google scribus, find the sources https://github.com/scribusproject/scribus , check the documentation, and find the dependencies of a project https://github.com/scribusproject/scribus/blob/master/BUILDING , all listed:

Requirements:
    Qt >= 6.2
    Freetype >= 2.1.7 (2.3.x strongly recommended)
    cairo >= 1.14.x
    harfbuzz = > 0.9.42
    libicu
    libjpeg (depending on how Qt is packaged)
    libpng >= 1.6.0
    libtiff >= 3.6.0
    libxml2 >= 2.6.0
    LittleCMS (liblcms) >= 2.0 (2.1+ recommended)
    poppler and poppler-cpp >= 0.62.0
    hunspell
    Python >= 3.6

Recommended:
    CUPS
    Fontconfig >= 2.0
    GhostScript >= 8.0 (9.0+ or greater preferred)
    tkinter for the font sampler script
    python-imaging for the font sampler preview
    pkgconfig (to assist finding other libraries)
    podofo - 0.7.0+ for enhanced Illustrator AI/EPS import, svn versions
    boost and boost-devel

Build systems are still a huge way forward - with cmake . the library maintainer can display a fancy error message for users "Och - install libpng, it was not found", which makes it all pleasant. It is still way better than getting -lpng: not found messages from the compiler or linker. You could for example write a CMake configuration that lists all such messages, and errors later, so that users see them all.