If the build
directory is a symbolic link, or when the entire source directory is symlinked (and we build from there), the current cmake build runs into trouble finding its own generated files.
To reproduce:
0git clone --depth=1 https://github.com/bitcoin/bitcoin.git
1mkdir build
2cd bitcoin/
3ln -s ../build .
4cmake -Bbuild -DBUILD_GUI=ON
5cd build
6make
0[ 37%] Building CXX object src/CMakeFiles/bitcoin_node.dir/validation.cpp.o
1In file included from /data/src/tmp/bitcoin/build/src/qt/bitcoinqt_autogen/mocs_compilation.cpp:2:
2/data/src/tmp/bitcoin/build/src/qt/bitcoinqt_autogen/EWIEGA46WW/moc_addressbookpage.cpp:10:10: fatal error: ../../../../../src/qt/addressbookpage.h: No such file or directory
3 10 | #include "../../../../../src/qt/addressbookpage.h"
4 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5compilation terminated.
6make[2]: *** [src/qt/CMakeFiles/bitcoinqt.dir/build.make:784: src/qt/CMakeFiles/bitcoinqt.dir/bitcoinqt_autogen/mocs_compilation.cpp.o] Error 1
7make[2]: *** Waiting for unfinished jobs...
This affects the build with Qt as well as the build with multiprocess, both which have generated files.
With autotools this wasn’t an issue, so i think it can be considered a regression. But not a high-priority one as it can be worked around by specifying the full paths instead.