Skip to contentSkip to conversation

cmake: use system libzma when the xz package is enabled

PATCH New Fabio Porcedda 2 participants 4 messages Mar 4, 2015 – Mar 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmake: use system libzma when the xz package is enabled

Fix build failure:
.../output/build/host-cmake-3.1.3/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c:17:1: error: conflicting types for ?lzma_block_buffer_decode?
lzma_block_buffer_decode(lzma_block *block, lzma_allocator *allocator,
^
In file included from /home/tetsuya/buildroot/br2/output/host/usr/include/lzma.h:296:0,
from /home/tetsuya/buildroot/br2/output/build/host-cmake-3.1.3/Utilities/cmliblzma/liblzma/common/common.h:34, from /home/tetsuya/buildroot/br2/output/build/host-cmake-3.1.3/Utilities/cmliblzma/liblzma/common/block_decoder.h:16, from /home/tetsuya/buildroot/br2/output/build/host-cmake-3.1.3/Utilities/cmliblzma/liblzma/common/block_buffer_decoder.c:13:
/home/tetsuya/buildroot/br2/output/host/usr/include/lzma/block.h:577:27: note: previous declaration of ?lzma_block_buffer_decode? was here
extern LZMA_API(lzma_ret) lzma_block_buffer_decode(

                           ^

Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/build.make:261: recipe for target 'Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/common/block_buffer_decoder.c.o' failed make[3]: *** [Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/common/block_buffer_decoder.c.o] Error 1

Fixes:
http://autobuild.buildroot.org/results/4edf6e169dc4a00d8a8bd16a86eba2316cbbd9e5
http://autobuild.buildroot.org/results/a9ff38b22a36a2f8427d33085d3263a8cbfbd746
http://autobuild.buildroot.org/results/ecaa0227249207b5450519832a193c1585ac8177

---
 package/cmake/cmake.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/cmake/cmake.mk +6 -0
index 8c64b58..4b53559 100644
@@ -12,6 +12,11 @@ CMAKE_LICENSE_FILES = Copyright.txt
 
 HOST_CMAKE_DEPENDENCIES = host-pkgconf
 
+ifeq ($(BR2_PACKAGE_XZ),y)
+ HOST_CMAKE_DEPENDENCIES += host-xz
+ HOST_CMAKE_CONF_OPTS += -DCMAKE_USE_SYSTEM_LIBLZMA=ON
+endif
+
 define HOST_CMAKE_CONFIGURE_CMDS
 	(cd $(@D); \
 		LDFLAGS="$(HOST_LDFLAGS)" \
@@ -22,6 +27,7 @@ define HOST_CMAKE_CONFIGURE_CMDS
 			-DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
 			-DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
 			-DBUILD_CursesDialog=OFF \
+			$(HOST_CMAKE_CONF_OPTS) \
 	)
 endef
 
Signature · 1 line
2.3.1
#1 lore raw

PATCH 1/1 cmake: use system libzma when the xz package is enabled

Dear Fabio Porcedda,

package/cmake/cmake.mk CMAKE_LICENSE_FILES = Copyright.txt · line 18

Quoted 4 lines · Fabio Porcedda
package/cmake/cmake.mk +4 -0
+ifeq ($(BR2_PACKAGE_XZ),y)
+ HOST_CMAKE_DEPENDENCIES += host-xz
+ HOST_CMAKE_CONF_OPTS += -DCMAKE_USE_SYSTEM_LIBLZMA=ON
+endif

This doesn't make any sense. Why would a dependency on host-xz be tied to the activation of the target xz package ?

You have two choices here:

* Ask host-cmake to *always* use its internal copy of the xz library, and to never look for a host-installed one.

* Depend on host-xz unconditionally, and ask host-cmake to always use this system-provided host-xz.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 cmake: use system libzma when the xz package is enabled

Quoted 11 lines · Thomas Petazzoni

Dear Fabio Porcedda,

package/cmake/cmake.mk CMAKE_LICENSE_FILES = Copyright.txt · line 18

Quoted 4 lines · Fabio Porcedda
package/cmake/cmake.mk +4 -0
+ifeq ($(BR2_PACKAGE_XZ),y)
+ HOST_CMAKE_DEPENDENCIES += host-xz
+ HOST_CMAKE_CONF_OPTS += -DCMAKE_USE_SYSTEM_LIBLZMA=ON
+endif

This doesn't make any sense. Why would a dependency on host-xz be tied to the activation of the target xz package ?

Well.. you are damn right!

Quoted 4 lines

You have two choices here:

* Ask host-cmake to *always* use its internal copy of the xz library, and to never look for a host-installed one.

I have found the problem, the problem is that we add in the HOST_CFLAGS the -I$(HOST_DIR)/usr/include, but CMAKE_F_FLAGS are before the internal -I<dir> in the gcc command line, so the xz headers was found before the cmake ones.

I will get rid of the -I$(HOST_DIR)/usr/include in the HOST_CFLAGS before passing it to cmake because we don't want that it uses anything from it.

Quoted 2 lines

* Depend on host-xz unconditionally, and ask host-cmake to always use this system-provided host-xz.

Maybe it's not the preferred one?

BR

Signature · 1 line
Fabio Porcedda