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:
cmake .
in source directory.apt search
to find (hopefully) right library.apt install
to install (hopefully) right library.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.
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.