Message ID | 1422220435-18689-3-git-send-email-s.martin49@gmail.com |
---|---|
State | Rejected |
Headers | show |
On 25/01/15 22:13, Samuel Martin wrote: > Only check for libxml2 when it is needed. > > This prevents CMake from falling back on the libxml2-config.cmake > installed on the host system (i.e. when libxml2 >=2.9.2 is part of the > host system), but not enabled as a target package (i.e. not existing in > the staging tree). This is worrisome... I would hope that our cmake could be convinced never to look in /usr/share/cmake when cross-compiling... Regards, Arnout > > Signed-off-by: Samuel Martin <s.martin49@gmail.com> [snip]
Dear Samuel Martin, On Sun, 25 Jan 2015 22:13:49 +0100, Samuel Martin wrote: > Only check for libxml2 when it is needed. > > This prevents CMake from falling back on the libxml2-config.cmake > installed on the host system (i.e. when libxml2 >=2.9.2 is part of the > host system), but not enabled as a target package (i.e. not existing in > the staging tree). > > Signed-off-by: Samuel Martin <s.martin49@gmail.com> > --- > ...l2-detection-try-first-the-CMake-module-f.patch | 40 +++++++++++++--------- > 1 file changed, 23 insertions(+), 17 deletions(-) Is this fixing a bug happening in practice? I.e should it be applied to master or next? Thomas
Hi Thomas, On Sat, Feb 14, 2015 at 10:15 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Samuel Martin, > > On Sun, 25 Jan 2015 22:13:49 +0100, Samuel Martin wrote: >> Only check for libxml2 when it is needed. >> >> This prevents CMake from falling back on the libxml2-config.cmake >> installed on the host system (i.e. when libxml2 >=2.9.2 is part of the >> host system), but not enabled as a target package (i.e. not existing in >> the staging tree). >> >> Signed-off-by: Samuel Martin <s.martin49@gmail.com> >> --- >> ...l2-detection-try-first-the-CMake-module-f.patch | 40 +++++++++++++--------- >> 1 file changed, 23 insertions(+), 17 deletions(-) > > Is this fixing a bug happening in practice? I.e should it be applied to > master or next? This patch does fix a bug here (that's why i explain the case triggering it). For the branch to apply it, I let you judge, but libxml2-2.9.2 will become more and more common. Archlinux already has it, the next release of Ubuntu-15.04 and Fedora-22 include it (but debian Jessy does not yet includes it); so if there is currently a few people triggering this bug, they may be more by the time we release the buildroot-2015.05. BTW, I still have to check WRT Arnout's comment (how to tell cmake to never look at /usr/share/cmake when cross-compiling). Regards,
Hi Arnout, all, On Tue, Jan 27, 2015 at 10:16 PM, Arnout Vandecappelle <arnout@mind.be> wrote: > On 25/01/15 22:13, Samuel Martin wrote: >> Only check for libxml2 when it is needed. >> >> This prevents CMake from falling back on the libxml2-config.cmake >> installed on the host system (i.e. when libxml2 >=2.9.2 is part of the >> host system), but not enabled as a target package (i.e. not existing in >> the staging tree). > > This is worrisome... I would hope that our cmake could be convinced never to > look in /usr/share/cmake when cross-compiling... I finally found some time to check the cmake thing, and it turns out that it is possible to control cmake to not searching outside of the sysroot. I'll cook a patch doing it and respin the series shortly, and reject this patch. Regards,
diff --git a/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch b/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch index 9f44169..43dcf62 100644 --- a/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch +++ b/package/libiio/0002-cmake-libxml2-detection-try-first-the-CMake-module-f.patch @@ -1,4 +1,4 @@ -From 4f849e1d2287206cfb7ff0fdeca96c22383b0d53 Mon Sep 17 00:00:00 2001 +From 238ce46fec88f5cba092ed4d8b52104eb2e31af2 Mon Sep 17 00:00:00 2001 From: Samuel Martin <s.martin49@gmail.com> Date: Mon, 29 Dec 2014 19:05:13 +0100 Subject: [PATCH] cmake: libxml2 detection: try first the CMake module from @@ -7,36 +7,42 @@ Subject: [PATCH] cmake: libxml2 detection: try first the CMake module from Libxml2 >=2.9.2 provides its own CMake module, so check for it before falling back on the CMake's module FindLibXml2.cmake. +Also, only check for libxml2 when needed (i.e. network backend is +enabled). This prevents CMake from finding the libxml2-config.cmake +when is installed on the host system, but not in the staging tree. + Signed-off-by: Samuel Martin <s.martin49@gmail.com> --- - CMakeLists.txt | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) + CMakeLists.txt | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 393fee3..b4f1d26 100644 +index dcc6617..810b329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -38,7 +38,19 @@ endif() +@@ -53,7 +53,21 @@ endif() find_library(AVAHI_CLIENT_LIBRARIES avahi-client) find_library(AVAHI_COMMON_LIBRARIES avahi-common) find_library(PTHREAD_LIBRARIES pthread) -include(FindLibXml2) + -+# Since libxml2-2.9.2, libxml2 provides its own LibXml2-config.cmake, with all -+# variables correctly set. -+# So, try first to find the CMake module provided by libxml2 package, then fallback -+# on the CMake's FindLibXml2.cmake module (which can lack some definition, especially -+# in static build case). -+find_package(LibXml2 QUIET NO_MODULE) -+if(DEFINED LIBXML2_VERSION_STRING) -+ set(LIBXML2_FOUND ON) -+ set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS}) -+else() -+ include(FindLibXml2) ++if(WITH_NETWORK_BACKEND) ++ # Since libxml2-2.9.2, libxml2 provides its own LibXml2-config.cmake, with all ++ # variables correctly set. ++ # So, try first to find the CMake module provided by libxml2 package, then fallback ++ # on the CMake's FindLibXml2.cmake module (which can lack some definition, especially ++ # in static build case). ++ find_package(LibXml2 QUIET NO_MODULE) ++ if(DEFINED LIBXML2_VERSION_STRING) ++ set(LIBXML2_FOUND ON) ++ set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS}) ++ else() ++ include(FindLibXml2) ++ endif() +endif() set(LIBIIO_CFILES channel.c device.c context.c buffer.c utilities.c) set(LIBIIO_HEADERS iio.h) -- -2.2.1 +2.2.2
Only check for libxml2 when it is needed. This prevents CMake from falling back on the libxml2-config.cmake installed on the host system (i.e. when libxml2 >=2.9.2 is part of the host system), but not enabled as a target package (i.e. not existing in the staging tree). Signed-off-by: Samuel Martin <s.martin49@gmail.com> --- ...l2-detection-try-first-the-CMake-module-f.patch | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-)