package/flatbuffers: fix locale independent on musl
PATCH 1/1 package/flatbuffers: fix locale independent on musl
Fix locale indepdendent which is enabled on musl since version 1.11.0 and
https://github.com/google/flatbuffers/commit/5f32f948102e65eaeea461b44f3b43f96c7a7a5a
resulting in the following build failure on snort3 since bump to version
3.1.6 in commit e66f2fd310374779d415fa683813cc5f5ccf6be9:
In file included from /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/flexbuffers.h:24,
from /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/idl.h:26,
from /tmp/instance-0/output-1/build/snort3-3.1.6.0/src/network_inspectors/perf_monitor/fbs_formatter.cc:29:
/tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(int64_t*, const char*, char**, int)':
/tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/util.h:258:12: error: 'strtoll_l' was not declared in this scope; did you mean 'strcoll_l'?
258 | *val = __strtoll_impl(str, endptr, base);
| ^~~~~~~~~~~~~~Fixes:
- http://autobuild.buildroot.org/results/68045b83e94f8caa337b1af7ed5f493ac1a55c47
--- ...flatbuffers-base.h-fix-build-on-musl.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 package/flatbuffers/0001-include-flatbuffers-base.h-fix-build-on-musl.patch
package/flatbuffers/0001-include-flatbuffers-base.h-fix-build-on-musl.patch new file +51 -0
@@ -0,0 +1,51 @@ +From 0315cef04a5a8a953072691faa48af9acb6009bd Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Tue, 10 Aug 2021 13:39:58 +0200 +Subject: [PATCH] include/flatbuffers/base.h: fix build on musl + +Build of applications using flatbuffers such as snort3 are broken on +musl since version 1.11.0 and +https://github.com/google/flatbuffers/commit/5f32f948102e65eaeea461b44f3b43f96c7a7a5a +because strtoll_l (and strtoull_l) are not available on musl. +flatbuffers checks for the availability of strtoull_l in CMakeLists.txt +so flatbuffers builds successfully but for applications using +flatbuffers, the result of this check is not available and +FLATBUFFERS_LOCALE_INDEPENDENT is set to 1 resulting in the following +build failure: + +In file included from /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/flexbuffers.h:24, + from /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/idl.h:26, + from /tmp/instance-0/output-1/build/snort3-3.1.6.0/src/network_inspectors/perf_monitor/fbs_formatter.cc:29: +/tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(int64_t*, const char*, char**, int)': +/tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/util.h:258:12: error: 'strtoll_l' was not declared in this scope; did you mean 'strcoll_l'? + 258 | *val = __strtoll_impl(str, endptr, base); + | ^~~~~~~~~~~~~~ + +Fix this failure by checking if __GNUC__ is defined before setting +FLATBUFFERS_LOCALE_INDEPENDENT to 1. + +Fixes: + - http://autobuild.buildroot.org/results/68045b83e94f8caa337b1af7ed5f493ac1a55c47 + +Signed-off-by: Fabrice Fontaine <[email protected]> +[Upstream status: https://github.com/google/flatbuffers/pull/6773] +--- + include/flatbuffers/base.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h +index de7898dc..101c7598 100644 +--- a/include/flatbuffers/base.h ++++ b/include/flatbuffers/base.h +@@ -266,7 +266,7 @@ namespace flatbuffers { + #ifndef FLATBUFFERS_LOCALE_INDEPENDENT + // Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}. + #if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \ +- (defined(_XOPEN_VERSION) && (_XOPEN_VERSION>=700)) && (!defined(__ANDROID_API__) || (defined(__ANDROID_API__) && (__ANDROID_API__>=21)))) ++ (defined(__GLIBC__) && defined(_XOPEN_VERSION) && (_XOPEN_VERSION>=700)) && (!defined(__ANDROID_API__) || (defined(__ANDROID_API__) && (__ANDROID_API__>=21)))) + #define FLATBUFFERS_LOCALE_INDEPENDENT 1 + #else + #define FLATBUFFERS_LOCALE_INDEPENDENT 0 +-- +2.30.2 +
Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
Quoted 14 lines · On Tue, 10 Aug 2021 14:01:34 +0200 Fabrice Fontaine…
Fix locale indepdendent which is enabled on musl since version 1.11.0 and
https://github.com/google/flatbuffers/commit/5f32f948102e65eaeea461b44f3b43f96c7a7a5a
resulting in the following build failure on snort3 since bump to version
3.1.6 in commite66f2fd310374779d415fa683813cc5f5ccf6be9:In file included from
/tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/flexbuffers.h:24,from /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/idl.h:26, from /tmp/instance-0/output-1/build/snort3-3.1.6.0/src/network_inspectors/perf_monitor/fbs_formatter.cc:29: /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/util.h: In function 'void flatbuffers::strtoval_impl(int64_t*, const char*, char**, int)': /tmp/instance-0/output-1/host/x86_64-buildroot-linux-musl/sysroot/usr/include/flatbuffers/util.h:258:12: error: 'strtoll_l' was not declared in this scope; did you mean 'strcoll_l'? 258 | *val = __strtoll_impl(str, endptr, base); | ^~~~~~~~~~~~~~
Quoted 8 lines
Fixes:
- http://autobuild.buildroot.org/results/68045b83e94f8caa337b1af7ed5f493ac1a55c47Signed-off-by Fabrice Fontaine <[email protected]>--- ...flatbuffers-base.h-fix-build-on-musl.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 package/flatbuffers/0001-include-flatbuffers-base.h-fix-build-on-musl.patch
I have seen the feedback from upstream that this workaround potentially breaks bionic and BSD systems, but as we don't care about these in Buildroot, I applied your patch to master as a work-around. Hopefully upstream will implement a better/long-term solution.
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
A message that is not in the archive (sent off-list or not yet received): 20210812234247.3618da82__12747.8516822279$1628804602$gmane$org@windsurf
Am Thu, 12 Aug 2021 23:42:47 +0200 schrieb Thomas Petazzoni:
Quoted 4 lines
I have seen the feedback from upstream that this workaround potentially breaks bionic and BSD systems, but as we don't care about these in Buildroot, I applied your patch to master as a work-around. Hopefully upstream will implement a better/long-term solution.
Hi Thomas,
unfortunately upstream rejected the patch without an alternative solution. Now I stumbled across the bug while building kodi with a non- local uClibc toolchain and being unable to fix the flatbuffers headers.
This is the defconfig:
BR2_x86_64=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_PACKAGE_KODI=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON3_PY_ONLY=y
Would it be acceptable to include this fix in the kodi package
https://github.com/bkuhls/buildroot/commit/fa6d0d742d970836ef81b8ecbf5c1885d4be94dc
although the problem really exists in the flatbuffer package which does not store the result of its configure checks for strtoll_l and strtoull_l?
Regards, Bernd
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 27 lines · Bernd Kuhls
Am Thu, 12 Aug 2021 23:42:47 +0200 schrieb Thomas Petazzoni:
Quoted 4 lines
I have seen the feedback from upstream that this workaround potentially breaks bionic and BSD systems, but as we don't care about these in Buildroot, I applied your patch to master as a work-around. Hopefully upstream will implement a better/long-term solution.
Hi Thomas,
unfortunately upstream rejected the patch without an alternative solution. Now I stumbled across the bug while building kodi with a non- local uClibc toolchain and being unable to fix the flatbuffers headers.
This is the defconfig:
BR2_x86_64=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_PACKAGE_KODI=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON3_PY_ONLY=y
Quoted 6 lines
Would it be acceptable to include this fix in the kodi package
https://github.com/bkuhls/buildroot/commit/fa6d0d742d970836ef81b8ecbf5c1885d4be94dcalthough the problem really exists in the flatbuffer package which does not store the result of its configure checks for
strtoll_landstrtoull_l?
I don't understand... We have the patch in Buildroot, so the corrected header
should be installed to staging, right?
Or does your build somehow use the bundled flatbuffers instead of the
staging-installed one?
Regards,
Arnout
Quoted 7 lines
Regards, Bernd
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Arnout,
Am Mon, 1 Aug 2022 19:46:18 +0200 schrieb Arnout Vandecappelle:
Quoted 3 lines
I don't understand... We have the patch in Buildroot, so the corrected header
should be installed to staging, right?
Yes, but uClibc defines __GLIBC__ so the patch does not fix the problem.
Quoted 2 lines
Or does your build somehow use the bundled flatbuffers instead of the
staging-installed one?
No, kodi uses flatbuffers from staging.
Regards, Bernd
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines · Bernd Kuhls
Hi Arnout,
Am Mon, 1 Aug 2022 19:46:18 +0200 schrieb Arnout Vandecappelle:
Quoted 3 lines
I don't understand... We have the patch in Buildroot, so the corrected header
should be installed to staging, right?Yes, but uClibc defines
__GLIBC__so the patch does not fix the problem.
But then, shouldn't the patch in flatbuffers be extended with even more
ifdefferey to exclude uClibc?
Regards,
Arnout
Quoted 4 lines
Quoted 3 lines
Or does your build somehow use the bundled flatbuffers instead of the
staging-installed one?
Quoted 8 lines
No, kodi uses flatbuffers from staging.
Regards, Bernd
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Am Mon, 1 Aug 2022 20:13:52 +0200 schrieb Arnout Vandecappelle:
Quoted 3 lines
But then, shouldn't the patch in flatbuffers be extended with even more
ifdefferey to exclude uClibc?
Hi Arnout,
I tried that and failed due to my limited coding skills.
Regards, Bernd
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot