Skip to contentSkip to conversation

package/directfb: disable for static builds

PATCH New Yann E. MORIN 2 participants 2 messages Feb 23, 2017 – Feb 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/directfb: disable for static builds

DirectFB is written in C++, but can be linked to by a C library or program.

When doing shared link, this is fine because the linker gets help from the DT_NEEDED flags and knows what libraries to pull in during the link.

However, during a static link, the linker does not get such help.

Properly fixing this would require that there is support in pkg-config and autotools to specify that the C++ runtime must be linked. Alas there is no sush support. The only option is to add -lstdc++ to the Libs.Private field in directfb.pc. But this is not upstreamable, because there are other C++ runtimes in the wild (e.g. -lc++ from llvm/clang).

However, DirectFB in a static scenario is probably not a very common scenario.

Disable DirectFB for static builds.

Fixes:

    http://autobuild.buildroot.org/results/3d3/3d3036d40ddad71d872d910aae7a24975706d2e9/
    http://autobuild.buildroot.org/results/d1c/d1c35a6003396942b584f2f2a5e8bf4ac2fbe370/
    http://autobuild.buildroot.org/results/d45/d4504871bd47930e8363032d380cdfcc5bb8aee7/
    [...]
Cc Thomas Petazzoni <[email protected]>
---
 package/directfb/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/directfb/Config.in +4 -2
index b552164..6a3d718 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_DIRECTFB
 	bool "directfb"
+	depends on !BR2_STATIC_LIBS # static link issues
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
@@ -161,7 +162,8 @@ config BR2_PACKAGE_DIRECTFB_TESTS
 
 endif # BR2_PACKAGE_DIRECTFB
 
-comment "directfb needs a glibc or uClibc toolchain w/ C++, NPTL, gcc >= 4.5"
+comment "directfb needs a glibc or uClibc toolchain w/ C++, NPTL, gcc >= 4.5, dynamic library"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || !BR2_INSTALL_LIBSTDCPP || \
-		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || BR2_TOOLCHAIN_USES_MUSL
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || BR2_TOOLCHAIN_USES_MUSL || \
+		BR2_STATIC_LIBS
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 package/directfb: disable for static builds

Hello,

Quoted 25 lines · Yann E. MORIN

DirectFB is written in C++, but can be linked to by a C library or program.

When doing shared link, this is fine because the linker gets help from the DT_NEEDED flags and knows what libraries to pull in during the link.

However, during a static link, the linker does not get such help.

Properly fixing this would require that there is support in pkg-config and autotools to specify that the C++ runtime must be linked. Alas there is no sush support. The only option is to add -lstdc++ to the Libs.Private field in directfb.pc. But this is not upstreamable, because there are other C++ runtimes in the wild (e.g. -lc++ from llvm/clang).

However, DirectFB in a static scenario is probably not a very common scenario.

Disable DirectFB for static builds.

Fixes:

    http://autobuild.buildroot.org/results/3d3/3d3036d40ddad71d872d910aae7a24975706d2e9/
    http://autobuild.buildroot.org/results/d1c/d1c35a6003396942b584f2f2a5e8bf4ac2fbe370/
    http://autobuild.buildroot.org/results/d45/d4504871bd47930e8363032d380cdfcc5bb8aee7/
    [...]
Quoted 5 lines
Cc Thomas Petazzoni <[email protected]>
---
 package/directfb/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

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