I'm trying to to build a project (https://github.com/UWQuickstep/quickstep) which seems to use cmake, against newly compiled glibc installed in a different location (https://sourceware.org/glibc/wiki/Testing/Builds#Compile_against_glibc_in_an_installed_location). The project builds quickstep_cli_shell
executable as the only target.
I would like to build the project with the following compile options added to the build (where SYSROOT=<new glibc installation dir>
)
-L${SYSROOT}/usr/lib64 \
-I${SYSROOT}/include \
--sysroot=${SYSROOT} \
-Wl,-rpath=${SYSROOT}/lib64 \
-Wl,--dynamic-linker=${SYSROOT}/lib64/ld-2.18.90.so\
- I added the following lines at the top of the cmake file (https://github.com/UWQuickstep/quickstep/blob/master/CMakeLists.txt)
set(CMAKE_VERBOSE_MAKEFILE on)
set(SYSROOT /fastdisk/glibc-master-install)
add_compile_options("-L${SYSROOT}/usr/lib64" "--sysroot=${SYSROOT}" "-Wl,-rpath=${SYSROOT}/lib64" "-Wl,--dynamic-linker=${SYSROOT}/lib64/ld-2.30.so")
include_directories(BEFORE "${SYSROOT}/include")
- When I run
cmake .. && make
from the build directory, I see that all object files are built with proper compile options, except for the final executable.
Any other object file -
/usr/bin/c++ -I/fastdisk/glibc-master-install/include <some other includes> -std=c++14 <some other options> -L/fastdisk/glibc-master-install/usr/lib64 --sysroot=/fastdisk/glibc-master-install -Wl,-rpath=/fastdisk/glibc-master-install/lib64 -Wl,--dynamic-linker=/fastdisk/glibc-master-install/lib64/ld-2.30.so -o CMakeFiles/quickstep_utility_Macros.dir/__/empty_src.cpp.o -c /fastdisk/quickstep/empty_src.cpp
Final quickstep_cli_shell build
/usr/bin/c++ -std=c++14 <some other options> -rdynamic CMakeFiles/quickstep_cli_shell.dir/cli/QuickstepCli.cpp.o -o quickstep_cli_shell <all .a dependencies>
$ quickstep/build# ldd quickstep_cli_shell
linux-vdso.so.1 (0x00007ffc5ff6f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f09b6d50000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f09b69c7000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f09b6629000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f09b6411000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f09b6020000) ------> should point to libc in $SYSROOT
/lib64/ld-linux-x86-64.so.2 (0x00007f09c50a1000)
I have spent lots of hours trying to figure out a way to build the final target executable by linking it against the new glibc but haven't found any success yet (I use cmake 3.10.2, if it helps).
Is there something wrong with my cmake changes? How do I build the target properly?