What is the preferred way install additional cmake modules?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear All,
i am about to add the modemmanager-qt[1] package to Buildroot, which for building depends on a set of additional cmake modules also provided by the KDE project, called extra-cmake-modules[2], which itself also uses cmake for building and installing.
I managed to set up a working configuration to install the
extra-cmake-modules package with the following in my extra-cmake-modules/extra-cmake-modules.mk file (_VERSION and other variables are omitted here):
EXTRA_CMAKE_MODULES_INSTALL_STAGING = YESEXTRA_CMAKE_MODULES_INSTALL_TARGET = NO
$(eval $(cmake-package))
and in my target package i add the 'extra-cmake-modules' to the dependencies. In this case the .cmake files get installed in the
path-to-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/us r/share/ECM/cmake/
directory.
My instinct would say that extra-cmake-modules is supposed to be a
host package (as then i wouldn't need to explicitly set EXTRA_CMAKE_MODULES_INSTALL_TARGET to NO), so i tried this to define as a host-cmake-package, make modemmanager-qt depending on host-extra-cmake-modules, but then the cmake modules not found by the modemmanager-qt build config.
In this latter case the .cmake files gets installed under:
path-to-buildroot/output/host/usr/share/ECM/cmake/
What is the preferred way to install this package? Install it as a host-package, and specify a custom install target dir, or leave it as plain cmake-package?
Thanks, regards
zgyarmati
[1]
https://projects.kde.org/projects/frameworks/modemmanager-qt/repository
[2] https://projects.kde.org/projects/kdesupport/extra-cmake-modules
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQEcBAEBAgAGBQJWJnE1AAoJEAGmEeeR8iVhh20IAJPBBxS0h2nYHnqeNsaLg7nr Om9yviFOVSfyPB2kouFP/C9bGZ5DGXM66tMgjjVbUpxbLkLyUoFAFLXp2ORdwTT2 aMJWLGurDD16iePOKyDjxEgv4C6Fl7gWgzPLHTRyyLAdJIxzHP5dykCZBwo1t2hW AXH9mCS+pAM1yfa5Mk5Nw4uYeLqJ0NAttDQmXnMwilu9AV1bNejyzLeGSge5gdjb YvbBDRkVRS8KMlZ2aG5JI/RKbK/RabSM4Mhtka4NYOGOqhDyQ2FpDj4b+FVaFeQn opSJFuAecKT9RRb73N9ZT3Se+sYuBwB2sMdUZT3A30KzLbNnmoSDR9Itw/0RSfw= =tPVc
-----END PGP SIGNATURE-----
Zoltan, All,
On 2015-10-20 18:52 +0200, Zoltan Gyarmati spake thusly:
Quoted 4 lines
i am about to add the modemmanager-qt[1] package to Buildroot, which for building depends on a set of additional cmake modules also provided by the KDE project, called extra-cmake-modules[2], which itself also uses cmake for building and installing.
[--SNIP--]
Quoted 2 lines
My instinct would say that extra-cmake-modules is supposed to be a
host package
My instinct says so, too. ;-)
Quoted 5 lines
(as then i wouldn't need to explicitly set
EXTRA_CMAKE_MODULES_INSTALL_TARGETto NO), so i tried this to define as a host-cmake-package, make modemmanager-qt depending on host-extra-cmake-modules, but then the cmake modules not found by the modemmanager-qt build config.
So:
- if extra-cmake-modules are in staging/ then it works
- if extra-cmake-modules are in host/ then it does not work
But what is not found? The ECM files themselves? Can you paste the few lines that exhibit the error, please?
Quoted 2 lines
In this latter case the .cmake files gets installed under:
path-to-buildroot/output/host/usr/share/ECM/cmake/
I would have indeed expected to see them installed there.
Quoted 3 lines
What is the preferred way to install this package? Install it as a host-package, and specify a custom install target dir, or leave it as plain cmake-package?
My stance:
- it is a host-package
We need to understand why cmake can't find those modules.
I CCed Samuel, our cmake expert, so he can shine some light on this.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Hi Zoltan, Yann, all,
Quoted 19 lines · Yann E. MORIN
Zoltan, All,
On 2015-10-20 18:52 +0200, Zoltan Gyarmati spake thusly:
Quoted 4 lines
i am about to add the modemmanager-qt[1] package to Buildroot, which for building depends on a set of additional cmake modules also provided by the KDE project, called extra-cmake-modules[2], which itself also uses cmake for building and installing.
[--SNIP--]
Quoted 2 lines
My instinct would say that extra-cmake-modules is supposed to be a
host packageMy instinct says so, too. ;-)
Quoted 5 lines
(as then i wouldn't need to explicitly set
EXTRA_CMAKE_MODULES_INSTALL_TARGETto NO), so i tried this to define as a host-cmake-package, make modemmanager-qt depending on host-extra-cmake-modules, but then the cmake modules not found by the modemmanager-qt build config.
Quoted 6 lines
So:
- if extra-cmake-modules are in staging/ then it works
- if extra-cmake-modules are in host/ then it does not workBut what is not found? The ECM files themselves? Can you paste the few lines that exhibit the error, please?
The CMake module files installed by ECM, when configuring a target package.
As explained in [1] (in the second half of the page), CMake (find_package) looks into a series of paths to find the modules. The prefix of these paths is sensitive to the CMAKE_SYSROOT variable, that's why modules installed in the host/ are not found when configuring some package for cross-compilation.
My understanding behind this behavior is that CMake does not trust too much 3rd-party modules.
I mean CMake has no way to know:
- that modules located in <buildroot>/output/host/usr/share/ECM/cmake/ are only for the host or for target;
- that <buildroot>/output/host/usr/share/ECM/cmake/ is a collection of modules specially written to extend to default collection;
- if a 3rd-party module would contain absolute paths to the libraries/programs/headers/etc, so stuff not compiled for the target.
So, CMake just assumes that everything that is for the target should be located in the sysroot. That's a safe way IMHO;
(Side note: For pkg-config, it is the same we look for *.pc in host/ for when building for the host, and in staging/ for target, the only difference is that it does not comes with a lot of *.pc files.)
Quoted 4 lines
Quoted 3 lines
In this latter case the .cmake files gets installed under:
path-to-buildroot/output/host/usr/share/ECM/cmake/
Quoted 8 lines
I would have indeed expected to see them installed there.
Quoted 3 lines
What is the preferred way to install this package? Install it as a host-package, and specify a custom install target dir, or leave it as plain cmake-package?
My stance:
- it is a host-package
I second.
I worked on something similar a while ago, and I ended up with a hack I'm not really proud of: line 15 in [2] (the ugly symlink).
Another way to do this more properly is using CMAKE_FIND_ROOT_PATH_MODE_PACKAGE [3], like this [4]. But this solution does not prevent from badly written module with absolute paths (pointing to some host binaries).
This may be caught later during the build by the poison paths detection, but I doubt it can spot paths to the paths like <output>/host/usr/lib/; can it?
Quoted 4 lines
We need to understand why cmake can't find those modules.
I CCed Samuel, our cmake expert, so he can shine some light on this.
Hope this help! ;-)
[1] https://cmake.org/cmake/help/v3.3/command/find_package.html?highlight=find_package
[2] https://github.com/tSed/buildroot-2/commit/2f5c52bfc8da80461d589efa97898b51ab42021b
[3] https://cmake.org/cmake/help/v3.3/variable/CMAKE_FIND_ROOT_PATH_MODE_PACKAGE.html
[4] http://code.bulix.org/h0jy9o-89332
Regards,
Signature · 1 line
Samuel
[Buildroot] Poison $(HOST_DIR)/usr/lib [was: Re: What is the preferred way install additional cmake modules?]
On 20-10-15 22:43, Samuel Martin wrote:
[snip]
Quoted 5 lines
But this solution does not prevent from badly written module with absolute paths (pointing to some host binaries).
This may be caught later during the build by the poison paths detection, but I doubt it can spot paths to the paths like <output>/host/usr/lib/; can it?
It can't, but it probably should, since that is equally bad as /usr/lib.
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF