Skip to contentSkip to conversation

tinyxml2: fix build in static libs configuration

PATCH New Rahul Bedarkar 2 participants 2 messages May 3, 2017 – May 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tinyxml2: fix build in static libs configuration

tinyxml2 can build both static and shared libraries. By default, only shared library is built. Shared/static builds are controlled using separate cmake flags BUILD_SHARED_LIBS and BUILD_STATIC_LIBS.

In static libs configuration, we internally pass -DBUILD_SHARED_LIBS=OFF cmake flag to build system which disables both shared and static builds of library, resulting in failures while linking executable with library.

So pass -DBUILD_STATIC_LIBS=ON cmake flag in case of static libs configuration.

fixes:
http://autobuild.buildroot.net/results/d30/d301bcbe5db26068b35eaa94bd816ae8cf8ef2e1

---
 package/tinyxml2/tinyxml2.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/tinyxml2/tinyxml2.mk +4 -0
index bb1e167..e289ca9 100644
@@ -10,4 +10,8 @@ TINYXML2_LICENSE = Zlib
 TINYXML2_LICENSE_FILES = readme.md
 TINYXML2_INSTALL_STAGING = YES
 
+ifeq ($(BR2_STATIC_LIBS),y)
+TINYXML2_CONF_OPTS += -DBUILD_STATIC_LIBS=ON
+endif
+
 $(eval $(cmake-package))
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 tinyxml2: fix build in static libs configuration

Hello,

Adding Samuel Martin here, for CMake related discussion below.

Quoted 11 lines · Rahul Bedarkar

tinyxml2 can build both static and shared libraries. By default, only shared library is built. Shared/static builds are controlled using separate cmake flags BUILD_SHARED_LIBS and BUILD_STATIC_LIBS.

In static libs configuration, we internally pass -DBUILD_SHARED_LIBS=OFF cmake flag to build system which disables both shared and static builds of library, resulting in failures while linking executable with library.

So pass -DBUILD_STATIC_LIBS=ON cmake flag in case of static libs configuration.

Quoted 7 lines

fixes:
http://autobuild.buildroot.net/results/d30/d301bcbe5db26068b35eaa94bd816ae8cf8ef2e1

---
 package/tinyxml2/tinyxml2.mk | 4 ++++
 1 file changed, 4 insertions(+)

Applied to master, thanks.

I think we need to refactor things more globally here though. Why is pkg-cmake.mk passing BUILD_SHARED_LIBS and not BUILD_STATIC_LIBS ? Why are some packages passing BUILD_SHARED_LIBS even if it's already passed by pkg-cmake.mk ?

Thomas

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