Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] What is the preferred way install additional cmake modules?
@ 2015-10-20 16:52 Zoltan Gyarmati
  2015-10-20 18:54 ` Yann E. MORIN
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Gyarmati @ 2015-10-20 16:52 UTC (permalink / raw)
  To: buildroot

-----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 = YES
EXTRA_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-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] What is the preferred way install additional cmake modules?
  2015-10-20 16:52 [Buildroot] What is the preferred way install additional cmake modules? Zoltan Gyarmati
@ 2015-10-20 18:54 ` Yann E. MORIN
  2015-10-20 20:43   ` Samuel Martin
  0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2015-10-20 18:54 UTC (permalink / raw)
  To: buildroot

Zoltan, All,

On 2015-10-20 18:52 +0200, Zoltan Gyarmati spake thusly:
> 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--]
>  My instinct would say that extra-cmake-modules is supposed to be a
> host package

My instinct says so, too. ;-)

> (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.

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?

> 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.

> 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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] What is the preferred way install additional cmake modules?
  2015-10-20 18:54 ` Yann E. MORIN
@ 2015-10-20 20:43   ` Samuel Martin
  2015-10-20 21:05     ` [Buildroot] Poison $(HOST_DIR)/usr/lib [was: Re: What is the preferred way install additional cmake modules?] Arnout Vandecappelle
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Martin @ 2015-10-20 20:43 UTC (permalink / raw)
  To: buildroot

Hi Zoltan, Yann, all,

On Tue, Oct 20, 2015 at 8:54 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Zoltan, All,
>
> On 2015-10-20 18:52 +0200, Zoltan Gyarmati spake thusly:
>> 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--]
>>  My instinct would say that extra-cmake-modules is supposed to be a
>> host package
>
> My instinct says so, too. ;-)
>
>> (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.
>
> 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?

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.)

>
>> 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.
>
>> 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?

>
> 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,

-- 
Samuel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] Poison $(HOST_DIR)/usr/lib [was: Re: What is the preferred way install additional cmake modules?]
  2015-10-20 20:43   ` Samuel Martin
@ 2015-10-20 21:05     ` Arnout Vandecappelle
  0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-10-20 21:05 UTC (permalink / raw)
  To: buildroot

On 20-10-15 22:43, Samuel Martin wrote:
[snip]
> 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]

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-20 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20 16:52 [Buildroot] What is the preferred way install additional cmake modules? Zoltan Gyarmati
2015-10-20 18:54 ` Yann E. MORIN
2015-10-20 20:43   ` Samuel Martin
2015-10-20 21:05     ` [Buildroot] Poison $(HOST_DIR)/usr/lib [was: Re: What is the preferred way install additional cmake modules?] Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox