mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
Work around cmake/ninja bug that leads to installation failure
CMake originally links build artifacts/results so that they can run from the target directory. As a result, it must first relink the binaries before installation so that they can run from the installation target directory, typically done in the preinstall stage. Ninja does not have a preinstall stage, and the CMake code that generates the build.ninja file does not take that into account [0]. Setting `CMAKE_BUILD_WITH_INSTALL_RPATH` [1] makes it originally link the files with the RPATH settings for the final destination directory, meaning that relinking is no longer needed. Technically setting the RPATH is not required for the `fish` binary as we do not have any relative dependencies; this is the output of `ldd ./build/fish`: ``` linux-vdso.so.1 => (0x00007ffffacdc000) libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f6632350000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f6632120000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6631f00000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6631b70000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6631860000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6631630000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6631410000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6631040000) /lib64/ld-linux-x86-64.so.2 (0x00007f6632600000) ``` However, since the bug only exists when the build generator is set to ninja, the workaround is only activated for that specific build generator to prevent any future problems. [0]: https://cmake.org/Bug/print_bug_page.php?bug_id=13934 [1]: https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_WITH_INSTALL_RPATH.html
This commit is contained in:
parent
0aa4c4a483
commit
36a2f2cc01
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,12 @@ PROJECT(fish-shell CXX)
|
|||
# We are C++11.
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# Work around cmake/ninja bug that fails on install with ninja
|
||||
# See https://cmake.org/Bug/print_bug_page.php?bug_id=13934
|
||||
if (NINJA)
|
||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
|
||||
endif(NINJA)
|
||||
|
||||
# Disable exception handling.
|
||||
ADD_COMPILE_OPTIONS(-fno-exceptions)
|
||||
|
||||
|
|
Loading…
Reference in a new issue