Skip to contentSkip to conversation

package/jsoncpp: Broken on musl

PATCH New Bernd Kuhls 2 participants 6 messages Aug 9, 2015 – Aug 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/jsoncpp: Broken on musl

Also propagate to reverse dependencies, to keep bisectability do this in one commit.

Fixes compile error:

[ 16%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o
In file included from /home/fli4l/br3/output/host/usr/lib/gcc/x86_64-buildroot-linux-musl/4.9.2/include/xmmintrin.h:34:0,

                 from /home/fli4l/br3/output/host/usr/lib/gcc/x86_64-buildroot-linux-musl/4.9.2/include/x86intrin.h:31,
                 from /home/fli4l/br3/output/host/usr/x86_64-buildroot-linux-musl/include/c++/4.9.2/x86_64-buildroot-linux-musl/bits/opt_random.h:33,
                 from /home/fli4l/br3/output/host/usr/x86_64-buildroot-linux-musl/include/c++/4.9.2/random:50,
                 from /home/fli4l/br3/output/host/usr/x86_64-buildroot-linux-musl/include/c++/4.9.2/bits/stl_algo.h:66,
                 from /home/fli4l/br3/output/host/usr/x86_64-buildroot-linux-musl/include/c++/4.9.2/algorithm:62,
                 from /home/fli4l/br3/output/build/jsoncpp-1.6.1/src/lib_json/json_value.cpp:20:
/home/fli4l/br3/output/host/usr/lib/gcc/x86_64-buildroot-linux-musl/4.9.2/include/mm_malloc.h:34:64: error: declaration of 'int posix_memalign(void**, size_t, size_t) throw ()' has a different exception specifier
 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
                                                                ^
In file included from /home/fli4l/br3/output/build/jsoncpp-1.6.1/include/json/assertions.h:9:0,
                 from /home/fli4l/br3/output/build/jsoncpp-1.6.1/src/lib_json/json_value.cpp:7:
/home/fli4l/br3/output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/stdlib.h:98:5: error: from previous declaration 'int posix_memalign(void**, size_t, size_t)'
 int posix_memalign (void **, size_t, size_t);
     ^

make[2]: *** [src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o] Error 1

using this defconfig:

BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_JSONCPP=y

---
v3: - rebased
- updated comments (Yann)
- added reverse dependencies to kodi-pvr-filmon & kodi-pvr-pctv
v2: Disable jsoncpp and reverse dependency with musl toolchain instead of patching gcc (Thomas)
FTR: gcc patches can be found here: http://patchwork.ozlabs.org/patch/460337/

---
 package/jsoncpp/Config.in         | 5 +++--
 package/kodi-pvr-filmon/Config.in | 4 ++++
 package/kodi-pvr-pctv/Config.in   | 4 ++++
 package/sysdig/Config.in          | 6 ++++--
 4 files changed, 15 insertions(+), 4 deletions(-)
package/jsoncpp/Config.in +3 -2
index 2c96f13..fb9da7a 100644
@@ -1,4 +1,5 @@
 config BR2_PACKAGE_JSONCPP
+	depends on !BR2_TOOLCHAIN_USES_MUSL # posix_memalign
 	depends on BR2_INSTALL_LIBSTDCPP
 	bool "jsoncpp"
 	help
@@ -10,5 +11,5 @@ config BR2_PACKAGE_JSONCPP
 
 	  https://github.com/open-source-parsers/jsoncpp
 
-comment "jsoncpp needs a toolchain w/ C++"
-	depends on !BR2_INSTALL_LIBSTDCPP
+comment "jsoncpp needs a (e)glibc or uClibc toolchain w/ C++"
+	depends on BR2_TOOLCHAIN_USES_MUSL || !BR2_INSTALL_LIBSTDCPP
package/kodi-pvr-filmon/Config.in +4 -0
index 0b662df..491b3ac 100644
@@ -2,7 +2,11 @@ config BR2_PACKAGE_KODI_PVR_FILMON
 	bool "kodi-pvr-filmon"
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
+	depends on !BR2_TOOLCHAIN_USES_MUSL # jsoncpp
 	help
 	  Filmon PVR client addon for Kodi
 
 	  https://github.com/kodi-pvr/pvr.filmon
+
+comment "kodi-pvr-filmon needs a (e)glibc or uClibc toolchain"
+	depends on BR2_TOOLCHAIN_USES_MUSL
package/kodi-pvr-pctv/Config.in +4 -0
index 255cd4a..97c367d 100644
@@ -2,7 +2,11 @@ config BR2_PACKAGE_KODI_PVR_PCTV
 	bool "kodi-pvr-pctv"
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
+	depends on !BR2_TOOLCHAIN_USES_MUSL # jsoncpp
 	help
 	  PCTV PVR client addon for Kodi
 
 	  https://github.com/kodi-pvr/pvr.vdr.vnsi
+
+comment "kodi-pvr-pctv needs a (e)glibc or uClibc toolchain"
+	depends on BR2_TOOLCHAIN_USES_MUSL
package/sysdig/Config.in +4 -2
index dc71d5f..50ebbba 100644
@@ -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 # jsoncpp
 	depends on BR2_LINUX_KERNEL
 	depends on BR2_INSTALL_LIBSTDCPP # libjson
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
@@ -16,6 +17,7 @@ config BR2_PACKAGE_SYSDIG
 
 	  http://sysdig.org
 
-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
+comment "sysdig needs a (e)glibc or uClibc toolchain w/ C++, dynamic library and a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL || !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS \
+		|| BR2_TOOLCHAIN_USES_MUSL
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/1 package/jsoncpp: Broken on musl

Hi Bernd,

Quoted 140 lines · Bernd Kuhls

Also propagate to reverse dependencies, to keep bisectability do this in
one commit.

Fixes compile error:

[ 16%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o In file included from /home/fli4l/br3/output/host/usr/lib/gcc/x86_64

(quoted diff) +0 -8
-buildroot-linux-musl/4.9.2/include/xmmintrin.h:34:0,
                 from /home/fli4l/br3/output/host/usr/lib/gcc/x86_64
-buildroot-linux-musl/4.9.2/include/x86intrin.h:31,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/x86_64-buildroot-linux
-musl/bits/opt_random.h:33,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/random:50,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/bits/stl_algo.h:66,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/algorithm:62,
                 from /home/fli4l/br3/output/build/jsoncpp
-1.6.1/src/lib_json/json_value.cpp:20:

/home/fli4l/br3/output/host/usr/lib/gcc/x86_64-buildroot-linux -musl/4.9.2/include/mm_malloc.h:34:64: error: declaration of 'int posix_memalign(void**, size_t, size_t) throw ()' has a different exception specifier

 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
                                                                ^

In file included from /home/fli4l/br3/output/build/jsoncpp -1.6.1/include/json/assertions.h:9:0,
from /home/fli4l/br3/output/build/jsoncpp
-1.6.1/src/lib_json/json_value.cpp:7:
/home/fli4l/br3/output/host/usr/x86_64-buildroot-linux -musl/sysroot/usr/include/stdlib.h:98:5: error: from previous declaration 'int posix_memalign(void**, size_t, size_t)'

 int posix_memalign (void **, size_t, size_t);
     ^

make[2]: *** [src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o] Error 1

using this defconfig:

BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_JSONCPP=y

---
v3: - rebased
- updated comments (Yann)
- added reverse dependencies to kodi-pvr-filmon & kodi-pvr-pctv
v2: Disable jsoncpp and reverse dependency with musl toolchain instead of patching gcc (Thomas)
FTR: gcc patches can be found here:
http://patchwork.ozlabs.org/patch/460337/

---
 package/jsoncpp/Config.in         | 5 +++--
 package/kodi-pvr-filmon/Config.in | 4 ++++
 package/kodi-pvr-pctv/Config.in   | 4 ++++
 package/sysdig/Config.in          | 6 ++++--
 4 files changed, 15 insertions(+), 4 deletions(-)
package/jsoncpp/Config.in +3 -2
index 2c96f13..fb9da7a 100644
@@ -1,4 +1,5 @@
 config BR2_PACKAGE_JSONCPP
+	depends on !BR2_TOOLCHAIN_USES_MUSL # posix_memalign
 	depends on BR2_INSTALL_LIBSTDCPP
 	bool "jsoncpp"
 	help
@@ -10,5 +11,5 @@ config BR2_PACKAGE_JSONCPP
 
 	  https://github.com/open-source-parsers/jsoncpp
 
-comment "jsoncpp needs a toolchain w/ C++"
-	depends on !BR2_INSTALL_LIBSTDCPP
+comment "jsoncpp needs a (e)glibc or uClibc toolchain w/ C++"
+	depends on BR2_TOOLCHAIN_USES_MUSL || !BR2_INSTALL_LIBSTDCPP
package/kodi-pvr renamed from package/kodi-pvr-filmon/Config.in +0 -1
-filmon/Config.in

index 0b662df..491b3ac 100644

package/kodi-pvr-filmon/Config.in +4 -0
@@ -2,7 +2,11 @@ config BR2_PACKAGE_KODI_PVR_FILMON
 	bool "kodi-pvr-filmon"
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
+	depends on !BR2_TOOLCHAIN_USES_MUSL # jsoncpp
 	help
 	  Filmon PVR client addon for Kodi
 
 	  https://github.com/kodi-pvr/pvr.filmon
+
+comment "kodi-pvr-filmon needs a (e)glibc or uClibc toolchain"
+	depends on BR2_TOOLCHAIN_USES_MUSL
package/kodi-pvr renamed from package/kodi-pvr-pctv/Config.in +0 -1
-pctv/Config.in

index 255cd4a..97c367d 100644

package/kodi-pvr-pctv/Config.in +4 -0
@@ -2,7 +2,11 @@ config BR2_PACKAGE_KODI_PVR_PCTV
 	bool "kodi-pvr-pctv"
 	select BR2_PACKAGE_JSONCPP
 	select BR2_PACKAGE_KODI_PLATFORM
+	depends on !BR2_TOOLCHAIN_USES_MUSL # jsoncpp
 	help
 	  PCTV PVR client addon for Kodi
 
 	  https://github.com/kodi-pvr/pvr.vdr.vnsi
+
+comment "kodi-pvr-pctv needs a (e)glibc or uClibc toolchain"
+	depends on BR2_TOOLCHAIN_USES_MUSL
package/sysdig/Config.in +1 -1
index dc71d5f..50ebbba 100644
@@ -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 # jsoncpp
 	depends on BR2_LINUX_KERNEL
 	depends on BR2_INSTALL_LIBSTDCPP # libjson
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS
@@ -16,6 +17,7 @@ config BR2_PACKAGE_SYSDIG
 
 	  http://sysdig.org
 
-comment "sysdig needs a toolchain w/ C++, dynamic library and a 

Linux kernel to be built"

package/sysdig/Config.in +0 -1
-	depends on !BR2_LINUX_KERNEL || !BR2_INSTALL_LIBSTDCPP || 

BR2_STATIC_LIBS
+comment "sysdig needs a (e)glibc or uClibc toolchain w/ C++, dynamic library and a Linux kernel to be built"

package/sysdig/Config.in +1 -0
+	depends on !BR2_LINUX_KERNEL || !BR2_INSTALL_LIBSTDCPP || 

BR2_STATIC_LIBS \

package/sysdig/Config.in config BR2_PACKAGE_SYSDIG · line 23

Quoted 2 lines
package/sysdig/Config.in +1 -0
+		|| BR2_TOOLCHAIN_USES_MUSL
 	depends on BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS

I cannot reproduce this error.

Building jsoncpp 1.6.1 works fine for me with the external musl toolchain (BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS) and the internal musl toolchain (tested with gcc 4.9.3 and 5.2.0).

Internal toolchain (gcc 4.9.3) tested with the following defconfig:
BR2_arm=y
BR2_COMPILER_PARANOID_UNSAFE_PATH=y BR2_TOOLCHAIN_BUILDROOT_MUSL=y BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_INIT_NONE=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set BR2_SYSTEM_BIN_SH_NONE=y
# BR2_TARGET_GENERIC_GETTY is not set
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
# BR2_PACKAGE_BUSYBOX is not set BR2_PACKAGE_JSONCPP=y
# BR2_TARGET_ROOTFS_TAR is not set

Best regards
J?rg Krause

#2 lore raw

PATCH v3 1/1 package/jsoncpp: Broken on musl

In reply to Bernd Kuhls

Dear Bernd Kuhls,

Quoted 48 lines · Bernd Kuhls

Also propagate to reverse dependencies, to keep bisectability do this in
one commit.

Fixes compile error:

[ 16%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o In file included from /home/fli4l/br3/output/host/usr/lib/gcc/x86_64

(quoted diff) +0 -8
-buildroot-linux-musl/4.9.2/include/xmmintrin.h:34:0,
                 from /home/fli4l/br3/output/host/usr/lib/gcc/x86_64
-buildroot-linux-musl/4.9.2/include/x86intrin.h:31,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/x86_64-buildroot-linux
-musl/bits/opt_random.h:33,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/random:50,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/bits/stl_algo.h:66,
                 from /home/fli4l/br3/output/host/usr/x86_64
-buildroot-linux-musl/include/c++/4.9.2/algorithm:62,
                 from /home/fli4l/br3/output/build/jsoncpp
-1.6.1/src/lib_json/json_value.cpp:20:

/home/fli4l/br3/output/host/usr/lib/gcc/x86_64-buildroot-linux -musl/4.9.2/include/mm_malloc.h:34:64: error: declaration of 'int posix_memalign(void**, size_t, size_t) throw ()' has a different exception specifier

 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
                                                                ^

In file included from /home/fli4l/br3/output/build/jsoncpp -1.6.1/include/json/assertions.h:9:0,
from /home/fli4l/br3/output/build/jsoncpp
-1.6.1/src/lib_json/json_value.cpp:7:
/home/fli4l/br3/output/host/usr/x86_64-buildroot-linux -musl/sysroot/usr/include/stdlib.h:98:5: error: from previous declaration 'int posix_memalign(void**, size_t, size_t)'

 int posix_memalign (void **, size_t, size_t);
     ^

make[2]: *** [src/lib_json/CMakeFiles/jsoncpp_lib.dir/json_value.cpp.o] Error 1

using this defconfig:

BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_JSONCPP=y

Quoted 9 lines

---
v3: - rebased
- updated comments (Yann)
- added reverse dependencies to kodi-pvr-filmon & kodi-pvr-pctv
v2: Disable jsoncpp and reverse dependency with musl toolchain instead of patching gcc (Thomas)
FTR: gcc patches can be found here:
http://patchwork.ozlabs.org/patch/460337/

After a short investigation [1] I realized this error only applies for x86 targets.

[1] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html

Best regards
J?rg Krause

#4 lore raw

PATCH v3 1/1 package/jsoncpp: Broken on musl

Quoted 8 lines · Bernd Kuhls

Hi J?rg,

Am Sun, 09 Aug 2015 20:59:54 +0200 schrieb J?rg Krause:

Quoted 4 lines

After a short investigation [1] I realized this error only applies for
x86 targets.

Quoted 5 lines
Quoted 1 line

[1] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html

v1 of my patch tried to fix it that way but it does not work for external
toolchains: http://patchwork.ozlabs.org/patch/460337/

I see! How about something like
depends on !(BR2_i386 || BR2_x86_64) && !BR2_TOOLCHAIN_USES_MUSL?

Best regards
J?rg Krause

#5 lore raw

PATCH v3 1/1 package/jsoncpp: Broken on musl

Am Mon, 10 Aug 2015 08:58:58 +0200 schrieb J?rg Krause:

Quoted 8 lines · Bernd Kuhls
Quoted 7 lines

Hi J?rg,

Am Sun, 09 Aug 2015 20:59:54 +0200 schrieb J?rg Krause:

Quoted 3 lines

After a short investigation [1] I realized this error only applies for x86 targets.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

[1] https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01084.html

v1 of my patch tried to fix it that way but it does not work for external toolchains: http://patchwork.ozlabs.org/patch/460337/

I see! How about something like depends on !(BR2_i386 || BR2_x86_64) && !BR2_TOOLCHAIN_USES_MUSL?

Hi J?rg,

lgtm.

Regards, Bernd