Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Ignore ldconfig failures when installing on Linux #346
Linux systems generally require an ldconfig invocation after installing shared libraries in order to refresh ld.so's library cache. Themis'
Note that ldconfig requires superuser privileges as it writes multiple files in
There are two basic use-cases for installing Themis:
The first use-case works fine now, but the second one is broken by ldconfig failing the build without superuser privileges.
Let's fix it in a simple and lazy way by ignoring any errors caused by ldconfig. (They are still printed out to stderr though.)
Strictly speaking, we should invoke ldconfig only after installing shared libraries. And it's only needed when installing into system locations. However, it's too complex for us to analyze EUID and PREFIX values. And it's certainly easier for the users to simply run "make install" all the time. Though, it's definitely possible to add a new target which will not call ldconfig:
install_static: install_soter_headers install_themis_headers \ install_static_libs install_pkgconfig install: install_static install_shared_libs ifdef IS_LINUX @ldconfig endif
However, there may be cases when shared libraries need to be installed into non-system locations as well. So it should be more easy to simply ignore ldconfig failures.
Taking into account that the global file refactoring is planned, I think we can use this as a temporary solution.
But I'd propose to ignore
ldconfig errors only when effective user (based on
$USER environment variable) is not
I think this will be in accordance with the problem described in the PR.
@shadinua that makes sense.
I have added the check so that ldconfig will faithfully fail if the build is run by a superuser. Errors will be ignored only for non-root users.
I have used bit more resilient way of checking the effective UID (