package/libiqrf: fix static link
PATCH 1/5 package/libiqrf: fix static link
- libiqrf depends on pthread, so add a patch fixing the build-system that way
- disable shared object build when BR2_PREFER_STATIC_LIB is set
Fixes:
http://autobuild.buildroot.net/results/210/2108f37e4a41af0b527c78e646e82f1cafa0353d/
--- ...e-static-library-and-find-required-thread.patch | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 package/libiqrf/libiqrf-0001-cmake-handle-static-library-and-find-required-thread.patch
package/libiqrf/libiqrf-0001-cmake-handle-static-library-and-find-required-thread.patch new file +45 -0
@@ -0,0 +1,45 @@ +From 46660112b76664473cc98b8ae6c863fd27c27d2d Mon Sep 17 00:00:00 2001 +From: Samuel Martin <[email protected]> +Date: Fri, 29 Aug 2014 23:40:59 +0200 +Subject: [PATCH 1/1] cmake: handle static library and find required thread + module + +Signed-off-by: Samuel Martin <[email protected]> +--- + CMakeLists.txt | 2 ++ + src/CMakeLists.txt | 4 +++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 79f644c..7779a2a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,9 @@ enable_testing() + # use local module (for Findlibusb-1.0.cmake) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + ++find_package(Threads REQUIRED) + find_package(libusb-1.0 REQUIRED) ++ + if (NOT LIBUSB_1_FOUND) + message(FATAL_ERROR "libusb-1.0 not installed. (try apt-get install libusb-1.0-0-dev)") + endif (NOT LIBUSB_1_FOUND) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 149d198..0597ccd 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -18,8 +18,10 @@ set (iqrf_sources + + include_directories ("${LIBUSB_1_INCLUDE_DIRS}") + +-add_library(iqrf SHARED ${iqrf_sources} ${iqrf_headers}) ++add_library(iqrf ${iqrf_sources} ${iqrf_headers}) ++ + target_link_libraries(iqrf ${LIBUSB_1_LIBRARIES}) ++target_link_libraries(iqrf ${CMAKE_THREAD_LIBS_INIT}) + + set_target_properties(iqrf PROPERTIES + VERSION "${iqrf_version_major}.${iqrf_version_minor}" +-- +2.1.0 +
Signature · 1 line
2.1.0
PATCH 2/5 package/libwebsockets: fix static link
- disable shared object build when BR2_PREFER_STATIC_LIB is set
Fixes:
http://autobuild.buildroot.net/results/0a9/0a9f0c3c101550e73f7100f2b88a88c1f2bbad95/
--- ...le-shared-library-build-when-BUILD_SHARED.patch | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 package/libwebsockets/libwebsockets-0002-cmake-disable-shared-library-build-when-BUILD_SHARED.patch
package/libwebsockets/libwebsockets-0002-cmake-disable-shared-library-build-when-BUILD_SHARED.patch new file +86 -0
@@ -0,0 +1,86 @@ +From 990835b15e3713e6c34d64b4bed8e55dcca6e6e2 Mon Sep 17 00:00:00 2001 +From: Samuel Martin <[email protected]> +Date: Sat, 30 Aug 2014 00:40:03 +0200 +Subject: [PATCH 2/2] cmake: disable shared library build when + BUILD_SHARED_LIBS is off + +Signed-off-by: Samuel Martin <[email protected]> +--- + CMakeLists.txt | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 72391b0..8f28680 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -320,14 +320,19 @@ source_group("Sources" FILES ${SOURCES}) + # + # Create the lib. + # ++set(_libs_websockets websockets) + add_library(websockets STATIC + ${HDR_PRIVATE} + ${HDR_PUBLIC} + ${SOURCES}) ++ ++if(BUILD_SHARED_LIBS) ++list(APPEND _libs_websockets websockets_shared) + add_library(websockets_shared SHARED + ${HDR_PRIVATE} + ${HDR_PUBLIC} + ${SOURCES}) ++endif() + + if (WIN32) + # On Windows libs have the same file ending (.lib) +@@ -348,15 +353,17 @@ endif(WIN32) + + # We want the shared lib to be named "libwebsockets" + # not "libwebsocket_shared". ++if(BUILD_SHARED_LIBS) + set_target_properties(websockets_shared +- PROPERTIES ++ PROPERTIES + OUTPUT_NAME websockets) ++endif() + + # Set the so version of the lib. + # Equivalent to LDFLAGS=-version-info x:x:x + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) +- foreach(lib websockets websockets_shared) +- set_target_properties(${lib} ++ foreach(lib ${_libs_websockets}) ++ set_target_properties(${lib} + PROPERTIES + SOVERSION ${SOVERSION}) + endforeach() +@@ -408,7 +415,7 @@ if (NOT WITHOUT_EXTENSIONS) + endif() + + # Make sure ZLib is compiled before the libs. +- foreach (lib websockets websockets_shared) ++ foreach (lib ${_libs_websockets}) + add_dependencies(${lib} ZLIB) + endforeach() + +@@ -462,7 +469,7 @@ if (UNIX) + endif() + + # Setup the linking for all libs. +-foreach (lib websockets websockets_shared) ++foreach (lib ${_libs_websockets}) + target_link_libraries(${lib} ${LIB_LIST}) + endforeach() + +@@ -727,7 +734,7 @@ install(FILES ${HDR_PUBLIC} + set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Header files") + + # Install libs. +-install(TARGETS websockets websockets_shared ++install(TARGETS ${_libs_websockets} + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + COMPONENT libraries) +-- +2.1.0 +
Signature · 1 line
2.1.0
PATCH 2/5 package/libwebsockets: fix static link
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Samuel" == Samuel Martin <[email protected]> writes:
- disable shared object build when
BR2_PREFER_STATIC_LIBis set Fixes:
http://autobuild.buildroot.net/results/0a9/0a9f0c3c101550e73f7100f2b88a88c1f2bbad95/Signed-off-by Samuel Martin <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 3/5 package/polarssl: fix static link
In reply to Samuel Martin- disable shared object build when BR2_PREFER_STATIC_LIB is set
Fixes:
http://autobuild.buildroot.net/results/754/754947d2a77a4dbe91057d8ce64fc4996e716ece/
--- package/polarssl/polarssl.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/polarssl/polarssl.mk +1 -1
@@ -8,7 +8,7 @@ POLARSSL_SITE = https://polarssl.org/code/releases POLARSSL_VERSION = 1.2.11 POLARSSL_SOURCE = polarssl-$(POLARSSL_VERSION)-gpl.tgz POLARSSL_CONF_OPT = \ - -DUSE_SHARED_POLARSSL_LIBRARY=ON \ + -DUSE_SHARED_POLARSSL_LIBRARY=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \ -DUSE_STATIC_POLARSSL_LIBRARY=ON \ -DBUILD_TESTS=OFF \ -DENABLE_PROGRAMS=$(if $(BR2_PACKAGE_POLARSSL_PROGRAMS),ON,OFF)
Signature · 1 line
2.1.0
PATCH 4/5 package/libplist: fix static link
In reply to Samuel Martin- libplist depends on libm and zlib (via libxml2), so add a patch fixing the build-system that way
- disable shared object build when BR2_PREFER_STATIC_LIB is set
Fixes:
http://autobuild.buildroot.net/results/9a3/9a364e3d91634a2da2bc481da1dee0ad0e870941/
--- ...ibxml2-missing-dependencies-when-linking-.patch | 49 ++++++++++++++++++++++ ...2-cmake-let-CMake-drives-the-library-type.patch | 37 ++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 package/libplist/libplist-0001-cmake-add-libxml2-missing-dependencies-when-linking-.patch create mode 100644 package/libplist/libplist-0002-cmake-let-CMake-drives-the-library-type.patch
package/libplist/libplist-0001-cmake-add-libxml2-missing-dependencies-when-linking-.patch new file +49 -0
@@ -0,0 +1,49 @@ +From f7bda53dd85298884dd5d127de393a57400c6aea Mon Sep 17 00:00:00 2001 +From: Samuel Martin <[email protected]> +Date: Sat, 30 Aug 2014 11:18:37 +0200 +Subject: [PATCH 1/2] cmake: add libxml2 missing dependencies when linking + statically + +libxml2 depends on libm and zlib, but CMake fails to add these dependencies +to the LDFLAGS, especially when linking statically. + +So, extend the CMAKE_MODULE_PATH with the ones from libplist, then make +sure libm and zlib libraries are correctly found and added to +LIBXML2_LIBRARIES. + +Signed-off-by: Samuel Martin <[email protected]> +--- + CMakeLists.txt | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a13546e..c59d969 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,7 +7,7 @@ SET( LIBPLIST_VERSION "${LIBPLIST_VERSION_MAJOR}.${LIBPLIST_VERSION_MINOR}" ) + SET( LIBPLIST_LIBVERSION "${LIBPLIST_SOVERSION}.${LIBPLIST_VERSION}" ) + SET( PLUTIL_VERSION ${LIBPLIST_VERSION} ) + +-SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/modules ) ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/modules ) + + cmake_minimum_required(VERSION 2.6) + +@@ -16,6 +16,14 @@ IF(NOT DEFINED CMAKE_INSTALL_LIBDIR) + ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR) + + FIND_PACKAGE( LibXml2 REQUIRED ) ++# libxml2 depends on libm and zlib. ++# CMake fails to find these dependencies/LDFLAGS, especially when linking ++# statically. ++IF(NOT BUILD_SHARED_LIBS) ++ FIND_PACKAGE(ZLIB REQUIRED) ++ FIND_LIBRARY(LIBM libm.a) ++ list(APPEND LIBXML2_LIBRARIES ${LIBM} ${ZLIB_LIBRARIES}) ++ENDIF() + + OPTION(ENABLE_PYTHON "Enable Python bindings (needs Swig)" ON) + +-- +2.1.0 +
package/libplist/libplist-0002-cmake-let-CMake-drives-the-library-type.patch new file +37 -0
@@ -0,0 +1,37 @@ +From f70208b93d120e46f201f11f31f42cf0ae5b6fee Mon Sep 17 00:00:00 2001 +From: Samuel Martin <[email protected]> +Date: Sat, 30 Aug 2014 11:20:36 +0200 +Subject: [PATCH 2/2] cmake: let CMake drives the library type + +Do not force CMake to build shared object when BUILD_SHARED_LIBS is off. + +Signed-off-by: Samuel Martin <[email protected]> +--- + src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a0d6179..78946b1 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -34,7 +34,7 @@ SET(libcnary_object_files + + SET_SOURCE_FILES_PROPERTIES(${libcnary_object_files} PROPERTIES EXTERNAL_OBJECT true GENERATED true) + +-ADD_LIBRARY( plist SHARED ${libplist_SRC} ${libcnary_object_files} ) ++ADD_LIBRARY( plist ${libplist_SRC} ${libcnary_object_files} ) + TARGET_LINK_LIBRARIES( plist ${LIBXML2_LIBRARIES} ) + SET_TARGET_PROPERTIES( plist PROPERTIES VERSION ${LIBPLIST_LIBVERSION} ) + SET_TARGET_PROPERTIES( plist PROPERTIES SOVERSION ${LIBPLIST_SOVERSION} ) +@@ -42,7 +42,7 @@ if(APPLE) + SET_TARGET_PROPERTIES( plist PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") + endif() + +-ADD_LIBRARY( plist++ SHARED ${libplist++_SRC} ) ++ADD_LIBRARY( plist++ ${libplist++_SRC} ) + TARGET_LINK_LIBRARIES( plist++ plist ) + SET_TARGET_PROPERTIES( plist++ PROPERTIES VERSION ${LIBPLIST_LIBVERSION} ) + SET_TARGET_PROPERTIES( plist++ PROPERTIES SOVERSION ${LIBPLIST_SOVERSION} ) +-- +2.1.0 +
Signature · 1 line
2.1.0
Samuel Martin
NAKPATCH 4/5 package/libplist: fix static link
Quoted 2 lines · Samuel Martin
- libplist depends on libm and zlib (via libxml2), so add a patch fixing the build-system that way
Nack!
Because libxml2 only depends on zlib if BR2_PACKAGE_ZLIB=y.(the same with libiconv).
So this patch fix some failure and will create new ones :-(
I'll repost a fix as soon as I've figured out how to handle this.
Signature · 1 line
Samuel
PATCH 5/5 package/taglib: fix static link
In reply to Samuel Martin- disable shared object build when BR2_PREFER_STATIC_LIB is set
Fixes:
http://autobuild.buildroot.net/results/a9c/a9cfe66c57bffc5a4560b2e4dcb41994da59e294/
--- package/taglib/taglib.mk | 2 ++ 1 file changed, 2 insertions(+)
package/taglib/taglib.mk +2 -0
@@ -22,6 +22,8 @@ ifeq ($(BR2_PACKAGE_TAGLIB_MP4),y) TAGLIB_CONF_OPT += -DWITH_MP4=ON endif +TAGLIB_CONF_OPT += -DENABLE_STATIC=$(if $(BR2_PREFER_STATIC_LIB),ON,OFF) + define TAGLIB_REMOVE_DEVFILE rm -f $(TARGET_DIR)/usr/bin/taglib-config endef
Signature · 1 line
2.1.0
PATCH 1/5 package/libiqrf: fix static link
In reply to Samuel MartinDear Samuel Martin,
Quoted 11 lines · Samuel Martin
- libiqrf depends on pthread, so add a patch fixing the build-system that way
- disable shared object build whenBR2_PREFER_STATIC_LIBis setFixes:
http://autobuild.buildroot.net/results/210/2108f37e4a41af0b527c78e646e82f1cafa0353d/Signed-off-by Samuel Martin <[email protected]>--- ...e-static-library-and-find-required-thread.patch | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 package/libiqrf/libiqrf-0001-cmake-handle-static-library-and-find-required-thread.patch
Thanks for those patches. Could you submit them to the respective upstream projects?
Regarding patches 3 and 5 (polarssl and taglib), shouldn't the upstream package be patched to use instead the standardized -DBUILD_SHARED_LIBS CMake variable?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/5 package/libiqrf: fix static link
In reply to Samuel MartinQuoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Samuel" == Samuel Martin <[email protected]> writes:
- libiqrf depends on pthread, so add a patch fixing the build-system that way
- disable shared object build whenBR2_PREFER_STATIC_LIBis setFixes:
http://autobuild.buildroot.net/results/210/2108f37e4a41af0b527c78e646e82f1cafa0353d/Signed-off-by Samuel Martin <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard