MantisBT - CMake
View Issue Details
0014974CMakeCMakepublic2014-06-13 09:152016-06-10 14:31
Evan 
Kitware Robot 
normalminoralways
closedmoved 
CMake 2.8.12.2 
 
0014974: Need to be able to generate absolute paths in install(EXPORT)
As per the description at https://github.com/Homebrew/homebrew/issues/29938 [^] the Qt homebrew packages have build problems because the generated Cmake files use relative paths which don't work with Homebrew's symlinking style. The current recommendation from that ticket seems to be to request absolute paths from cmake.
No tags attached.
Issue History
2014-06-13 09:15EvanNew Issue
2014-06-13 09:29Brad KingNote Added: 0036189
2014-06-13 09:39EvanNote Added: 0036190
2014-06-13 09:40EvanNote Edited: 0036190bug_revision_view_page.php?bugnote_id=36190#r1476
2014-06-13 09:50Brad KingNote Added: 0036191
2014-06-13 10:31Stephen KellyNote Added: 0036193
2014-06-13 10:34Brad KingStatusnew => backlog
2014-06-13 10:34Brad KingSummaryNeed to be able to generate absolute paths => Need to be able to generate absolute paths in install(EXPORT)
2014-06-13 10:41Brad KingNote Added: 0036194
2015-01-03 00:48宋文武Note Added: 0037543
2016-06-10 14:29Kitware RobotNote Added: 0042567
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0036189)
Brad King   
2014-06-13 09:29   
CMake generates a lot of paths in a lot of places. Please provide an isolated example.
(0036190)
Evan   
2014-06-13 09:39   
(edited on: 2014-06-13 09:40)
(I'm not entirely sure what kind of example you're looking for - I don't know much about cmake internals, I just filed this here per the recommendation of the upstream ticket.)

If I understand correctly, Qt uses cmake to generate cmake files for other apps to use when linking against Qt. These generated cmake files use relative paths to locate the various Qt headers and libraries, which doesn't work because sometimes the cmake files are installed in a different PREFIX from the rest of the Qt library (specific example, the generated cmake variable "_qt5Core_install_prefix" uses a relative path, which causes the search for "mkspecs/macx-clang" to fail on OSX when installed with homebrew - this is what caused me to file the original upstream ticket).

Ideally the generated cmake files would contain absolute paths so that this issue doesn't occur.

For more context and some intelligent discussion by people who know more than me about the underlying frameworks, please read the homebrew ticket I originally linked.

(0036191)
Brad King   
2014-06-13 09:50   
Files like /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake are provided by Qt5 and are not generated by CMake. Qt5 uses qmake and as part of their build they generate some .cmake files and install them.
(0036193)
Stephen Kelly   
2014-06-13 10:31   
The issue is that homebrew creates symlinks from /usr/local to another location. An issue similar to the usr-move problem seen with ArchLinux can therefore arise if homebrew does not symlink everything. This issue became known because they do not symlink the plugins/ or mkspecs/ directories installed to by Qt.

This problem can affect any file generated by cmake install(EXPORT) which contains relative paths (eg any include directory in INTERFACE_INCLUDE_DIRECTORIES, any plugin installed to $PREFIX/plugins) if the package is found in /usr/local but it actually exists elsewhere.
(0036194)
Brad King   
2014-06-13 10:41   
Re 0014974:0036193: Ahh, another example of cross-prefix symlinks breaking relocatable packages.

For the usr-move case the logic is here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmExportInstallFileGenerator.cxx;hb=v3.0.0#l81 [^]

and similarly here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakePackageConfigHelpers.cmake;hb=v3.0.0#l254 [^]

The approach is to detect when the package is found in a path that is a symlink to the original installation path and then switch to the latter. The logic to do all this is only activated right now when the installation path is in /lib or /usr/lib (or lib64 versions). Perhaps we need an explicit option to enable it so packagers producing non-reloctable packages can use it.
(0037543)
宋文武   
2015-01-03 00:48   
Hi, when using CMake/Qt5 in Guix, we get executables build with no RPATH to Qt's
libraries. IIUC, it's the desired behaviors of imported targets. But we really
want to get non-relocatable one.

In Guix:
  there is in no /lib, /lib64, /usr ...
  every package install into its own directory
  every executable should link explicitly with RPATHs to find libraries
  every executable should be non-relocatable

We definitely need an option to let import targets export full path, and will be linked with full rpath.

Thanks!
(0042567)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.