diff mbox

[1/1] package/jsoncpp: broken with musl on x86

Message ID 1445374313-30804-1-git-send-email-joerg.krause@embedded.rocks
State Rejected
Headers show

Commit Message

Jörg Krause Oct. 20, 2015, 8:51 p.m. UTC
This patch replaces a previous submission made by Bernd Kuhls some while ago
[1].

The posix_memalign declaration is incompatible with musl for C++, because of
the exception specification [2]. Note, the referenced patch is part of the a
patch series to "Add musl support to GCC".

Instead of patching gcc in Buildroot we disable jsoncpp and any reverse
dependendy with the musl toolchain on x86.

[1] https://patchwork.ozlabs.org/patch/505425/
[2] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html

Fixes:
http://autobuild.buildroot.net/results/588/5885d33b8d9f17878f565f3ae5371017dc89aede/
http://autobuild.buildroot.net/results/0d9/0d90c7c13ae1640b07709c4c686e0237ada1324d/
http://autobuild.buildroot.net/results/30b/30b98ac7362c27254218a6e521d29971070f8c3c/
http://autobuild.buildroot.net/results/292/29289c125166630aeaf884ccc006bcf12c8aa0f6/

and many more.

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
 package/cmake/Config.in            | 4 ++++
 package/jsoncpp/Config.in          | 5 +++++
 package/kodi-pvr-argustv/Config.in | 4 ++++
 package/kodi-pvr-filmon/Config.in  | 4 ++++
 package/kodi-pvr-pctv/Config.in    | 4 ++++
 package/kodi-pvr-stalker/Config.in | 4 ++++
 package/sysdig/Config.in           | 4 ++++
 7 files changed, 29 insertions(+)

Comments

Thomas Petazzoni Oct. 21, 2015, 11:50 a.m. UTC | #1
Dear Jörg Krause,

On Tue, 20 Oct 2015 22:51:53 +0200, Jörg Krause wrote:
> This patch replaces a previous submission made by Bernd Kuhls some while ago
> [1].
> 
> The posix_memalign declaration is incompatible with musl for C++, because of
> the exception specification [2]. Note, the referenced patch is part of the a
> patch series to "Add musl support to GCC".
> 
> Instead of patching gcc in Buildroot we disable jsoncpp and any reverse
> dependendy with the musl toolchain on x86.
> 
> [1] https://patchwork.ozlabs.org/patch/505425/
> [2] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html

It is indeed not very practical to fix gcc, since external toolchains
would continue to be affected. But isn't there a way of working around
the problem inside jsoncpp itself, so that we don't have to do this
complicated reverse-dependency propagation ?

Thanks,

Thomas
Thomas Petazzoni Oct. 27, 2015, 6:52 a.m. UTC | #2
Hello,

On Wed, 21 Oct 2015 13:50:29 +0200, Thomas Petazzoni wrote:

> On Tue, 20 Oct 2015 22:51:53 +0200, Jörg Krause wrote:
> > This patch replaces a previous submission made by Bernd Kuhls some while ago
> > [1].
> > 
> > The posix_memalign declaration is incompatible with musl for C++, because of
> > the exception specification [2]. Note, the referenced patch is part of the a
> > patch series to "Add musl support to GCC".
> > 
> > Instead of patching gcc in Buildroot we disable jsoncpp and any reverse
> > dependendy with the musl toolchain on x86.
> > 
> > [1] https://patchwork.ozlabs.org/patch/505425/
> > [2] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html
> 
> It is indeed not very practical to fix gcc, since external toolchains
> would continue to be affected. But isn't there a way of working around
> the problem inside jsoncpp itself, so that we don't have to do this
> complicated reverse-dependency propagation ?

There is indeed a solution: remove the -pedantic flags from

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -pedantic")

line in CMakeLists.txt. And it builds just fine. It seems a lot simpler
than propagating the reverse dependencies.

Could you submit a patch doing this ?

Best regards,

Thomas
Jörg Krause Oct. 27, 2015, 7:54 a.m. UTC | #3
Hi Thomas,

On Di, 2015-10-27 at 07:52 +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 21 Oct 2015 13:50:29 +0200, Thomas Petazzoni wrote:
> 
> > On Tue, 20 Oct 2015 22:51:53 +0200, Jörg Krause wrote:
> > > This patch replaces a previous submission made by Bernd Kuhls
> > > some while ago
> > > [1].
> > > 
> > > The posix_memalign declaration is incompatible with musl for C++,
> > > because of
> > > the exception specification [2]. Note, the referenced patch is
> > > part of the a
> > > patch series to "Add musl support to GCC".
> > > 
> > > Instead of patching gcc in Buildroot we disable jsoncpp and any
> > > reverse
> > > dependendy with the musl toolchain on x86.
> > > 
> > > [1] https://patchwork.ozlabs.org/patch/505425/
> > > [2] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html
> > 
> > It is indeed not very practical to fix gcc, since external
> > toolchains
> > would continue to be affected. But isn't there a way of working
> > around
> > the problem inside jsoncpp itself, so that we don't have to do this
> > complicated reverse-dependency propagation ?
> 
> There is indeed a solution: remove the -pedantic flags from
> 
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion
> -Wshadow -Wextra -pedantic")
> 
> line in CMakeLists.txt. And it builds just fine. It seems a lot
> simpler
> than propagating the reverse dependencies.
> 
> Could you submit a patch doing this ?

Indeed, this is much simpler. Many thanks for investigation ... I did
not had the time. I'll prepare a patch for this soon!

Best regards
Jörg Krause
Thomas Petazzoni Oct. 27, 2015, 8:11 a.m. UTC | #4
Dear Jörg Krause,

On Tue, 27 Oct 2015 08:54:13 +0100, Jörg Krause wrote:

> > line in CMakeLists.txt. And it builds just fine. It seems a lot
> > simpler
> > than propagating the reverse dependencies.
> > 
> > Could you submit a patch doing this ?
> 
> Indeed, this is much simpler. Many thanks for investigation ... I did
> not had the time. I'll prepare a patch for this soon!

I actually didn't do much investigation. I just googled the issue, and
in the discussion around the musl related patches sent to gcc, this was
discussed, and it was pointed out that the error only occurs if
-pedantic is used.

Thomas
diff mbox

Patch

diff --git a/package/cmake/Config.in b/package/cmake/Config.in
index 6f04a4a..4ba844a 100644
--- a/package/cmake/Config.in
+++ b/package/cmake/Config.in
@@ -20,6 +20,7 @@  config BR2_PACKAGE_CMAKE_CTEST
 	select BR2_PACKAGE_EXPAT
 	select BR2_PACKAGE_BZIP2
 	select BR2_PACKAGE_XZ
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64)) # jsoncpp
 	depends on BR2_PACKAGE_CMAKE_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # from jsoncpp
 	depends on BR2_USE_WCHAR # libarchive
@@ -38,3 +39,6 @@  comment "ctest needs a toolchain w/ C++, wchar, dynamic library, gcc >= 4.7"
 	depends on BR2_PACKAGE_CMAKE_ARCH_SUPPORTS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
 		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+
+comment "ctest needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
diff --git a/package/jsoncpp/Config.in b/package/jsoncpp/Config.in
index 83118c4..a29e569 100644
--- a/package/jsoncpp/Config.in
+++ b/package/jsoncpp/Config.in
@@ -1,4 +1,6 @@ 
 config BR2_PACKAGE_JSONCPP
+	# posix_memalign is incompatible with musl for C++ on x86
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11
 	depends on BR2_INSTALL_LIBSTDCPP
 	bool "jsoncpp"
@@ -13,3 +15,6 @@  config BR2_PACKAGE_JSONCPP
 
 comment "jsoncpp needs a toolchain w/ C++, gcc >= 4.7"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+
+comment "jsoncpp needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
diff --git a/package/kodi-pvr-argustv/Config.in b/package/kodi-pvr-argustv/Config.in
index 247d83c..c9b74e0 100644
--- a/package/kodi-pvr-argustv/Config.in
+++ b/package/kodi-pvr-argustv/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_KODI_PVR_ARGUSTV
 	bool "kodi-pvr-argustv"
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64)) # jsoncpp
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # jsoncpp
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
@@ -10,3 +11,6 @@  config BR2_PACKAGE_KODI_PVR_ARGUSTV
 
 comment "kodi-pvr-argustv needs a toolchain w/ gcc >= 4.7"
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+
+comment "kodi-pvr-argustv needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
diff --git a/package/kodi-pvr-filmon/Config.in b/package/kodi-pvr-filmon/Config.in
index 3d87ec8..a6e2a7d 100644
--- a/package/kodi-pvr-filmon/Config.in
+++ b/package/kodi-pvr-filmon/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_KODI_PVR_FILMON
 	bool "kodi-pvr-filmon"
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64)) # jsoncpp
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # jsoncpp
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
@@ -10,3 +11,6 @@  config BR2_PACKAGE_KODI_PVR_FILMON
 
 comment "kodi-pvr-filmon needs a toolchain w/ gcc >= 4.7"
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+
+comment "kodi-pvr-filmon needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
diff --git a/package/kodi-pvr-pctv/Config.in b/package/kodi-pvr-pctv/Config.in
index 1bef551..bd32349 100644
--- a/package/kodi-pvr-pctv/Config.in
+++ b/package/kodi-pvr-pctv/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_KODI_PVR_PCTV
 	bool "kodi-pvr-pctv"
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64)) # jsoncpp
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # jsoncpp
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
@@ -10,3 +11,6 @@  config BR2_PACKAGE_KODI_PVR_PCTV
 
 comment "kodi-pvr-pctv needs a toolchain w/ gcc >= 4.7"
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+
+comment "kodi-pvr-pctv needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
diff --git a/package/kodi-pvr-stalker/Config.in b/package/kodi-pvr-stalker/Config.in
index 26a8c3f..1d570cd 100644
--- a/package/kodi-pvr-stalker/Config.in
+++ b/package/kodi-pvr-stalker/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_KODI_PVR_STALKER
 	bool "kodi-pvr-stalker"
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64)) # jsoncpp
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # jsoncpp
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
@@ -10,3 +11,6 @@  config BR2_PACKAGE_KODI_PVR_STALKER
 
 comment "kodi-pvr-stalker needs a toolchain w/ gcc >= 4.7"
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+
+comment "kodi-pvr-stalker needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))
diff --git a/package/sysdig/Config.in b/package/sysdig/Config.in
index dc71d5f..c1908b5 100644
--- a/package/sysdig/Config.in
+++ b/package/sysdig/Config.in
@@ -3,6 +3,7 @@  config BR2_PACKAGE_SYSDIG
 	select BR2_PACKAGE_ZLIB
 	select BR2_PACKAGE_LUAJIT
 	select BR2_PACKAGE_JSONCPP
+	depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64)) # jsoncpp
 	depends on BR2_LINUX_KERNEL
 	depends on BR2_INSTALL_LIBSTDCPP # libjson
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
@@ -19,3 +20,6 @@  config BR2_PACKAGE_SYSDIG
 comment "sysdig needs a toolchain w/ C++, dynamic library and a Linux kernel to be built"
 	depends on !BR2_LINUX_KERNEL || !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
+
+comment "sysdig needs a (e)glibc or uClibc toolchain w/ C++ on x86"
+	depends on (BR2_TOOLCHAIN_USES_MUSL && (BR2_i386 || BR2_x86_64))