cmake not always replacing symlinks in the path used to access a build.dir?!

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

cmake not always replacing symlinks in the path used to access a build.dir?!

René J. V.  Bertin
Hi,

I'm seeing a weird issue with a large project: KDevelop. It was reorganised recently but I think that's what exposes the issue, rather than causing it.
My workflow puts both source and out-of-source build directories rather deep in a dedicated "playground"; for convenience I create symlinks to the parent of both directories in one of my own work directories under my $HOME:

%> ls -l kdevd-lnx-work
lrwxrwxrwx 1 bertin bertin 92 Sep  5 15:18 kdevld-lnx-work -> /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work

As long as I chdir directly into that "hidden" build.dir, invoke cmake and then make from there things are fine. Problems occur though when I change something in one of the project's CMakeLists.txt files, chdir into the build.dir via the symlink and then issue a make without running cmake by hand.

Consider the example below where I tried to do partial rebuild (something that's always worked reliably for me, a feature I really appreciate with cmake!). Evidently make is being executed in the actual directory, as shown by the output from `pwd` just underneath the `CD` line. Somewhere during the snipped part (which I don't have anymore) cmake was called automatically and that's where the symlink must have found its way into the
Notice how the failing build of iplugin.cpp uses search paths that include the link that don't work with the relative include paths generated by the moc compiler.

How can happen, for all I can tell cmake has no way of knowing about the symlink?!
FWIW, it's not something I can reproduce easily.

%> where CD
CD is aliased to (cd  !:^ ; !:2*)
%> CD kdevld-lnx-work/build/plugins/ wmake
### now in /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build/plugins
### make -w
### Sun Sep 17 20:32:06 CEST 2017
make: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build/plugins'
<SNIP>
[  0%] Building CXX object kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/iplugin.cpp.o
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces && /opt/local/bin/ccache /opt/local/bin/clang++-mp-4.0  -DKCOREADDONS_LIB -DKDevPlatformInterfaces_EXPORTS -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050500 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"kdevplatform\" -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces -I/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces -I/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces/KDevPlatformInterfaces_autogen/include -I/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5 -I
 /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build -I/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform -I/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform -isystem /opt/local/include/KF5/KParts -isystem /opt/local/include/KF5 -isystem /opt/local/include/KF5/KIOWidgets -isystem /opt/local/include/KF5/KIOCore -isystem /opt/local/include/KF5/KCoreAddons -isystem /opt/local/include/qt5 -isystem /opt/local/include/qt5/QtCore -isystem /opt/local/share/qt5/mkspecs/linux-g++-64 -isystem /opt/local/include/KF5/KService -isystem /opt/local/include/KF5/KConfigCore -isystem /opt/local/include/KF5/KJobWidgets -isystem /opt/local/include/qt5/QtWidgets -isystem /opt/local/include/qt5/QtGui -isystem /opt/local/include/qt5/QtNetwork -isystem /opt/local/include/KF5/KCompletion -isystem /opt/local/include/KF5/KWidgetsAddons -isystem /opt/local/include/KF5/KXmlGui -isystem /opt/local/include/qt5/QtDBu
 s -isystem /opt/local/include/qt5/QtXml -isystem /opt/local/include/KF5/KConfigWidgets -isystem /opt/local/include/KF5/KCodecs -isystem /opt/local/include/KF5/KConfigGui -isystem /opt/local/include/KF5/KAuth -isystem /opt/local/include/KF5/KTextWidgets -isystem /opt/local/include/KF5/SonnetUi -isystem /opt/local/include/KF5/KI18n -isystem /opt/local/include/KF5/KTextEditor  -Ofast -g -DNDEBUG -std=c++11 -m64 -std=c++0x -fno-operator-names -fno-exceptions -DQT_NO_EXCEPTIONS -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -Wno-missing-field-initializers -Werror=undefined-bool-conversion -Werror=tautological-undefined-compare -Wdocumentation -Wno-gnu-zero-variadic-macro-arguments -pedantic -fPIC -std=gnu++11 -o CMakeFiles/KDevPlatformInterfaces.dir/iplugin.cpp.o
 -c /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces/iplugin.cpp
In file included from /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces/iplugin.cpp:207:
/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces/KDevPlatformInterfaces_autogen/include/moc_iplugin.cpp:9:10: fatal error:
      '../../../../../../kdevelop-git-5/kdevplatform/interfaces/iplugin.h' file not found
#include "../../../../../../kdevelop-git-5/kdevplatform/interfaces/iplugin.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/iplugin.cpp.o] Error 1


Thanks,
R.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake not always replacing symlinks in the path used to access a build.dir?!

René J. V.  Bertin
WTH, apparently this can even happen without regeneration (that I know of, at least):

%> CD kdevld-lnx-work/build/plugins/ wmake --MP -w
### /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build/plugins
### /home/bertin/script/wmake --MP -w
### Mon Sep 18 11:06:15 CEST 2017

make: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build/plugins'
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build && /opt/local/bin/cmake -H/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5 -B/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build --check-build-system CMakeFiles/Makefile.cmake 0
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build && /opt/local/bin/cmake -E cmake_progress_start /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/CMakeFiles /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/plugins/CMakeFiles/progress.marks
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build && make -f CMakeFiles/Makefile2 plugins/all
make[1]: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
make -f kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces_autogen.dir/build.make kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces_autogen.dir/depend
make[2]: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5 /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces_autogen.dir/DependInfo.cmake --color=
Scanning dependencies of target KDevPlatformInterfaces_autogen
make[2]: Leaving directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
make -f kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces_autogen.dir/build.make kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces_autogen.dir/build
make[2]: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
[  0%] Automatic MOC for target KDevPlatformInterfaces
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces && /opt/local/bin/cmake -E cmake_autogen /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces_autogen.dir MacPorts
Generating MOC predefs moc_predefs.h
Generating MOC source include/moc_iplugin.cpp
Generating MOC source EWIEGA46WW/moc_configpage.cpp
Generating MOC source EWIEGA46WW/moc_iassistant.cpp
Generating MOC source EWIEGA46WW/moc_icompletionsettings.cpp
Generating MOC source EWIEGA46WW/moc_icore.cpp
Generating MOC source EWIEGA46WW/moc_idebugcontroller.cpp
Generating MOC source EWIEGA46WW/moc_idocumentation.cpp
Generating MOC source EWIEGA46WW/moc_idocumentationcontroller.cpp
Generating MOC source EWIEGA46WW/moc_idocumentcontroller.cpp
Generating MOC source EWIEGA46WW/moc_ilanguagecontroller.cpp
Generating MOC source EWIEGA46WW/moc_ipartcontroller.cpp
Generating MOC source EWIEGA46WW/moc_iplugincontroller.cpp
Generating MOC source EWIEGA46WW/moc_iproject.cpp
Generating MOC source EWIEGA46WW/moc_iprojectcontroller.cpp
Generating MOC source EWIEGA46WW/moc_iprojectprovider.cpp
Generating MOC source EWIEGA46WW/moc_iruncontroller.cpp
Generating MOC source EWIEGA46WW/moc_iruntime.cpp
Generating MOC source EWIEGA46WW/moc_iruntimecontroller.cpp
Generating MOC source EWIEGA46WW/moc_iselectioncontroller.cpp
Generating MOC source EWIEGA46WW/moc_isession.cpp
Generating MOC source EWIEGA46WW/moc_isourceformatter.cpp
Generating MOC source EWIEGA46WW/moc_isourceformattercontroller.cpp
Generating MOC source EWIEGA46WW/moc_itestcontroller.cpp
Generating MOC source EWIEGA46WW/moc_launchconfigurationpage.cpp
Generating MOC source EWIEGA46WW/moc_launchconfigurationtype.cpp
make[2]: Leaving directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
[  0%] Built target KDevPlatformInterfaces_autogen
make -f kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/build.make kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/depend
make[2]: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build && /opt/local/bin/cmake -E cmake_depends "Unix Makefiles" /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5 /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/DependInfo.cmake --color=
Scanning dependencies of target KDevPlatformInterfaces
make[2]: Leaving directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
make -f kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/build.make kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/build
make[2]: Entering directory `/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/build'
[  0%] Building CXX object kdevplatform/interfaces/CMakeFiles/KDevPlatformInterfaces.dir/iassistant.cpp.o
cd /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces && /opt/local/bin/ccache /opt/local/bin/clang++-mp-4.0  -DKCOREADDONS_LIB -DKDevPlatformInterfaces_EXPORTS -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050500 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"kdevplatform\" -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces -I/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces -I/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform/interfaces/KDevPlatformInterfaces_autogen/include -I/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5 -I
 /home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build -I/opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform -I/home/bertin/work/src/Scratch/KDE/KF5/kdevld-lnx-work/build/kdevplatform -isystem /opt/local/include/KF5/KParts -isystem /opt/local/include/KF5 -isystem /opt/local/include/KF5/KIOWidgets -isystem /opt/local/include/KF5/KIOCore -isystem /opt/local/include/KF5/KCoreAddons -isystem /opt/local/include/qt5 -isystem /opt/local/include/qt5/QtCore -isystem /opt/local/share/qt5/mkspecs/linux-g++-64 -isystem /opt/local/include/KF5/KService -isystem /opt/local/include/KF5/KConfigCore -isystem /opt/local/include/KF5/KJobWidgets -isystem /opt/local/include/qt5/QtWidgets -isystem /opt/local/include/qt5/QtGui -isystem /opt/local/include/qt5/QtNetwork -isystem /opt/local/include/KF5/KCompletion -isystem /opt/local/include/KF5/KWidgetsAddons -isystem /opt/local/include/KF5/KXmlGui -isystem /opt/local/include/qt5/QtDBu
 s -isystem /opt/local/include/qt5/QtXml -isystem /opt/local/include/KF5/KConfigWidgets -isystem /opt/local/include/KF5/KCodecs -isystem /opt/local/include/KF5/KConfigGui -isystem /opt/local/include/KF5/KAuth -isystem /opt/local/include/KF5/KTextWidgets -isystem /opt/local/include/KF5/SonnetUi -isystem /opt/local/include/KF5/KI18n -isystem /opt/local/include/KF5/KTextEditor  -Ofast -g -DNDEBUG -std=c++11 -m64 -std=c++0x -fno-operator-names -fno-exceptions -DQT_NO_EXCEPTIONS -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -Wno-missing-field-initializers -Werror=undefined-bool-conversion -Werror=tautological-undefined-compare -Wdocumentation -Wno-gnu-zero-variadic-macro-arguments -pedantic -fPIC -std=gnu++11 -o CMakeFiles/KDevPlatformInterfaces.dir/iassistant.cpp
 .o -c /opt/local/var/lnxports/build/_opt_local_site-ports_kf5_kf5-kdevelop/kf5-kdevelop-devel/work/kf5-kdevelop-5/kdevplatform/interfaces/iassistant.cpp

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake