serenity
serenity copied to clipboard
LD_LIBRARY_PATH needs to be overridden to build with -DCMAKE_INSTALL_LIBDIR:PATH
[ 11s] + /usr/bin/cmake /home/abuild/rpmbuild/BUILD/serenity-0+1702743748.ac79ab0b45/Ladybird/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_BINDIR:PATH=bin -DCMAKE_INSTALL_SBINDIR:PATH=sbin -DCMAKE_INSTALL_LIBEXECDIR:PATH=lib -DCMAKE_INSTALL_SYSCONFDIR:PATH=etc -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var -DCMAKE_INSTALL_RUNSTATEDIR:PATH=run -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_INCLUDEDIR:PATH=include -DCMAKE_INSTALL_DATAROOTDIR:PATH=share -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' '-DCMAKE_CXX_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' '-DCMAKE_Fortran_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' '-DCMAKE_EXE_LINKER_FLAGS= -Wl,--as-needed -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS= -Wl,--as-needed' '-DCMAKE_SHARED_LINKER_FLAGS= -Wl,--as-needed -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/ladybird -GNinja -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_C_COMPILER=gcc-13
[ 22s] /home/abuild/rpmbuild/BUILD/serenity-0+1702743748.ac79ab0b45/Ladybird/build/bin/IPCCompiler: error while loading shared libraries: liblagom-core.so.0: cannot open shared object file: No such file or directory
Workaround: override LD_LIBRARY_PATH when running ninja
LD_LIBRARY_PATH="$(pwd)/$(basename %{_libdir})" ninja -v %{?_smp_mflags}
I'm... assuming that this is a result of your RPM build stripping RPATH from our binaries? We build C++ applications as code generators into Build/bin and expect them to be able to find their required libraries in $ORIGIN/../lib.
They need to be executable as part of the build, not just in the final install directory.
Unless I'm missing something, this is purely a packaging concern.
And the directory is not $ORIGIN/../lib but rather $ORIGIN/../lib64 because of different build options.
Ah right, this happens here in lagom_install_options.cmake:
https://github.com/SerenityOS/serenity/blob/e28ac74e0b65334c92e0ba569dfa3a6ff9ece0cf/Meta/CMake/lagom_install_options.cmake#L11-L28
The intention is that we can prevent the need to patch up RPATH or macOS equivalents (@rpath, @executable_path, etc) when executing out of the build dir or an install dir.
But, given that many distros seem to remove RPATH on principle, I'm not sure how else to make sure our code generators can execute than setting LD_LIBRARY_PATH (or do a static build :shrug: )
Maybe document that it's needed then 🤷 I don't see explicitly stripping rpath but maybe some of the linker options does it?