core/cmake: better impersonate a Linux system
cover core/cmake: better impersonate a Linux system
Hello All!
Some packages rely on the system name to decide whether to enable/disable features and/or link/not link with some libraries, rather than using detection... :-(
However, the system name is now Buildroot, because we provide our own platform description, as was suggested by upstream cmake.
So, we tweak our platform description to change the system name back to "Linux", so that those packages believe they are on Linux (which is inherently true!)
Secondly, some packages completely overwrite the module path, like fastd, rather than appending to it. For now, only fastd is handled; other offenders will be dealt with as they are detected.
Regards,
Yann E. MORIN.
The following changes since commit 8d1128e8a898e32348618721473b82b09f4a6975
fontconfig: needs host-gperf (2017-03-02 09:24:35 +0100)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to dd2c4dbd9c75ecc8838363ff3b21651b6aa55373
package/fastd: do not overwrite the cmake module path (2017-03-02 22:01:02 +0100)
----------------------------------------------------------------
Yann E. MORIN (2):
support/cmake: impersonate a Linux system even more package/fastd: do not overwrite the cmake module path
...02-CMakeList-do-not-overwrite-module-path.patch | 56 ++++++++++++++++++++++ support/misc/Buildroot.cmake | 4 ++ 2 files changed, 60 insertions(+) create mode 100644 package/fastd/0002-CMakeList-do-not-overwrite-module-path.patch
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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 support/cmake: impersonate a Linux system even more
Some packages test the system name to decide whether to enable/disable features or link with specific libs.
So we forcefully set the system name form our custom system file, so that packagses still believe they are running on Linux rather than Buildroot.
Fixes:
fastd : http://autobuild.buildroot.net/results/f1d/f1dfe90068ad62e733f17a22202235415bda3974/ paho-mqtt-c: http://autobuild.buildroot.net/results/457/457d76279e16247bf58c838a2c5dd0a4f3962c21/ libiio : http://autobuild.buildroot.net/results/281/2812b008a0ab6bab5fe4d45eb9ffe4e9496a8cb4/ and so on...
--- support/misc/Buildroot.cmake | 4 ++++ 1 file changed, 4 insertions(+)
support/misc/Buildroot.cmake +4 -0
@@ -1,3 +1,7 @@ +# Impersonate a Linux system. Afterall, that's what we are... +set(CMAKE_SYSTEM_NAME Linux) include(Platform/Linux) + +# Override problematic settings, to avoid RPATH against host lib directories. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
Signature · 1 line
2.7.4
PATCH 2/2 package/fastd: do not overwrite the cmake module path
In reply to Yann E. MORINfastd's CMakeList.txt completely overwrites CMAKE_MODULE_PATH with its own, thus causing cmake to not find our own custom one.
We fix fastd by appending its custom value, rather than replacing.
Fixes;
http://autobuild.buildroot.net/results/69f/69fb2e3b549a069e2898506db918423e6742c589/--- ...02-CMakeList-do-not-overwrite-module-path.patch | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 package/fastd/0002-CMakeList-do-not-overwrite-module-path.patch
package/fastd/0002-CMakeList-do-not-overwrite-module-path.patch new file +56 -0
@@ -0,0 +1,56 @@ +From a925a4cab1b722a2a24b0c1d2a1925f3b766de61 Mon Sep 17 00:00:00 2001 +From: "Yann E. MORIN" <[email protected]> +Date: Thu, 2 Mar 2017 21:43:39 +0100 +Subject: [PATCH] CMakeList: do not overwrite module path + +Currently, the CMakeList.txt completely overwrites the CMAKE_MODULE_PATH +variable. + +This is problematic when an upper-layer buildsystem wants to set its own +module path to use custom modules. + +For example, Buldroot [0] provides a custom platform description [1] to fix +cross-compilation issue. Overwriting the module path means that this +custom platform description is not found [2]. + +Providing such a custom platform description is what the upstream cmake +devs suggest [3], quoting: + + If a toolchain file specifies CMAKE_SYSTEM_NAME such that a custom + `Platform/MySystem.cmake` file is loaded then the latter can set + them [*] as needed for the target platform. + +[*] offending settings causing RPATH issues during cross-compilation. + +So we need to append our source tree to the module path, not replace it +blindly. + +[0] https://buildroot.org/ +[1] https://git.buildroot.org/buildroot/tree/support/misc/Buildroot.cmake +[2] http://autobuild.buildroot.net/results/69f/69fb2e3b549a069e2898506db918423e6742c589/build-end.log +[3] http://public.kitware.com/pipermail/cmake/2017-February/065063.html + +Signed-off-by: "Yann E. MORIN" <[email protected]> +--- +Patch applied upstream: +https://git.universe-factory.net/fastd/commit/?id=a925a4cab1b722a2a24b0c1d2a1925f3b766de61 + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 61689b1..2c9c61a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 2.8.8) + +-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + cmake_policy(SET CMP0017 OLD) # Prefer modules in our module directory + + project(FASTD C ASM) +-- +2.7.4 +
Signature · 1 line
2.7.4
PATCH 2/2 package/fastd: do not overwrite the cmake module path
Already applied upstream:
https://git.universe-factory.net/fastd/commit/?id=a925a4cab1b722a2a24b0c1d2a1925f3b766de61
Thanks. :-)
Alex
Quoted 85 lines · Yann E. MORIN
fastd's CMakeList.txt completely overwrites
CMAKE_MODULE_PATHwith its own, thus causing cmake to not find our own custom one.We fix fastd by appending its custom value, rather than replacing.
Fixes; http://autobuild.buildroot.net/results/69f/69fb2e3b549a069e2898506db918423e6742c589/Signed-off-by "Yann E. MORIN" <[email protected]>Cc Alexander Dahl <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Baruch Siach <[email protected]>Cc Ben Boeckel <[email protected]>Cc J?rg Krause <[email protected]>Cc Vicente Olivert Riera <[email protected]>Cc Samuel Martin <[email protected]>--- ...02-CMakeList-do-not-overwrite-module-path.patch | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 package/fastd/0002-CMakeList-do-not-overwrite-module-path.patchpackage/fastd/0002-CMakeList-do-not-overwrite-module-path.patch new file +56
-0@@ -0,0 +1,56 @@ +From a925a4cab1b722a2a24b0c1d2a1925f3b766de61 Mon Sep 17 00:00:00 2001 +From: "Yann E. MORIN" <[email protected]> +Date: Thu, 2 Mar 2017 21:43:39 +0100 +Subject: [PATCH] CMakeList: do not overwrite module path + +Currently, the CMakeList.txt completely overwrites the CMAKE_MODULE_PATH +variable. + +This is problematic when an upper-layer buildsystem wants to set its own +module path to use custom modules. + +For example, Buldroot [0] provides a custom platform description [1] to fix +cross-compilation issue. Overwriting the module path means that this +custom platform description is not found [2]. + +Providing such a custom platform description is what the upstream cmake +devs suggest [3], quoting: + + If a toolchain file specifies CMAKE_SYSTEM_NAME such that a custom + `Platform/MySystem.cmake` file is loaded then the latter can set + them [*] as needed for the target platform. + +[*] offending settings causing RPATH issues during cross-compilation. + +So we need to append our source tree to the module path, not replace it +blindly. + +[0] https://buildroot.org/ +[1] https://git.buildroot.org/buildroot/tree/support/misc/Buildroot.cmake +[2] http://autobuild.buildroot.net/results/69f/69fb2e3b549a069e2898506db918423e6742c589/build-end.log +[3] http://public.kitware.com/pipermail/cmake/2017-February/065063.html + +Signed-off-by: "Yann E. MORIN" <[email protected]> +--- +Patch applied upstream: +https://git.universe-factory.net/fastd/commit/?id=a925a4cab1b722a2a24b0c1d2a1925f3b766de61 + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 61689b1..2c9c61a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 2.8.8) + +-set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + cmake_policy(SET CMP0017 OLD) # Prefer modules in our module directory + + project(FASTD C ASM) +-- +2.7.4 +Signature · 1 line
2.7.4
Signature · 11 lines
?With the first link, the chain is forged. The first speech censured, the first thought forbidden, the first freedom denied, chains us all irrevocably.? (Jean-Luc Picard, quoting Judge Aaron Satie) *** GnuPG-FP: C28E E6B9 0263 95CF 8FAF 08FA 34AD CD00 7221 5CC6 *** -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170302/6565b769/attachment.asc>
Thomas Petazzoni
Appliedcover core/cmake: better impersonate a Linux system
In reply to Yann E. MORINHello,
Quoted 3 lines · Yann E. MORIN
Yann E. MORIN (2):
support/cmake: impersonate a Linux system even more package/fastd: do not overwrite the cmake module path
Applied, thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com