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:
- Run
cmake .
in source directory. - If it fails, go to 3. Else, go to 7.
- Search error messages for mentions of missing libraries.
- Run
apt search
to find (hopefully) right library. - Run
apt install
to install (hopefully) right library. - Goto 1.
- 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.
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: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.