All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
@ 2021-08-10 12:01 Fabrice Fontaine
  2021-08-12 21:42 ` Thomas Petazzoni
       [not found] ` <20210812234247.3618da82__12747.8516822279$1628804602$gmane$org@windsurf>
  0 siblings, 2 replies; 7+ messages in thread
From: Fabrice Fontaine @ 2021-08-10 12:01 UTC (permalink / raw)
  To: buildroot; +Cc: 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 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

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...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

diff --git a/package/flatbuffers/0001-include-flatbuffers-base.h-fix-build-on-musl.patch b/package/flatbuffers/0001-include-flatbuffers-base.h-fix-build-on-musl.patch
new file mode 100644
index 0000000000..b4bc0e12de
--- /dev/null
+++ b/package/flatbuffers/0001-include-flatbuffers-base.h-fix-build-on-musl.patch
@@ -0,0 +1,51 @@
+From 0315cef04a5a8a953072691faa48af9acb6009bd Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+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 <fontaine.fabrice@gmail.com>
+[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
+
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
  2021-08-10 12:01 [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl Fabrice Fontaine
@ 2021-08-12 21:42 ` Thomas Petazzoni
       [not found] ` <20210812234247.3618da82__12747.8516822279$1628804602$gmane$org@windsurf>
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2021-08-12 21:42 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

On Tue, 10 Aug 2021 14:01:34 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> 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
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...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
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
       [not found] ` <20210812234247.3618da82__12747.8516822279$1628804602$gmane$org@windsurf>
@ 2022-07-30 16:23   ` Bernd Kuhls
  2022-08-01 17:46     ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Kuhls @ 2022-07-30 16:23 UTC (permalink / raw)
  To: buildroot

Am Thu, 12 Aug 2021 23:42:47 +0200 schrieb Thomas Petazzoni:

> 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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
  2022-07-30 16:23   ` Bernd Kuhls
@ 2022-08-01 17:46     ` Arnout Vandecappelle
  2022-08-01 17:56       ` Bernd Kuhls
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2022-08-01 17:46 UTC (permalink / raw)
  To: Bernd Kuhls, buildroot



On 30/07/2022 18:23, Bernd Kuhls wrote:
> Am Thu, 12 Aug 2021 23:42:47 +0200 schrieb Thomas Petazzoni:
> 
>> 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?

  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

> 
> Regards, Bernd
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
  2022-08-01 17:46     ` Arnout Vandecappelle
@ 2022-08-01 17:56       ` Bernd Kuhls
  2022-08-01 18:13         ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Kuhls @ 2022-08-01 17:56 UTC (permalink / raw)
  To: buildroot; +Cc: buildroot

Hi Arnout,

Am Mon, 1 Aug 2022 19:46:18 +0200 schrieb Arnout Vandecappelle:

>   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.

>   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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
  2022-08-01 17:56       ` Bernd Kuhls
@ 2022-08-01 18:13         ` Arnout Vandecappelle
  2022-08-01 20:32           ` Bernd Kuhls
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2022-08-01 18:13 UTC (permalink / raw)
  To: Bernd Kuhls, buildroot; +Cc: buildroot



On 01/08/2022 19:56, Bernd Kuhls wrote:
> Hi Arnout,
> 
> Am Mon, 1 Aug 2022 19:46:18 +0200 schrieb Arnout Vandecappelle:
> 
>>    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

> 
>>    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
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl
  2022-08-01 18:13         ` Arnout Vandecappelle
@ 2022-08-01 20:32           ` Bernd Kuhls
  0 siblings, 0 replies; 7+ messages in thread
From: Bernd Kuhls @ 2022-08-01 20:32 UTC (permalink / raw)
  To: buildroot; +Cc: buildroot

Am Mon, 1 Aug 2022 20:13:52 +0200 schrieb Arnout Vandecappelle:

>   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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-01 20:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 12:01 [Buildroot] [PATCH 1/1] package/flatbuffers: fix locale independent on musl Fabrice Fontaine
2021-08-12 21:42 ` Thomas Petazzoni
     [not found] ` <20210812234247.3618da82__12747.8516822279$1628804602$gmane$org@windsurf>
2022-07-30 16:23   ` Bernd Kuhls
2022-08-01 17:46     ` Arnout Vandecappelle
2022-08-01 17:56       ` Bernd Kuhls
2022-08-01 18:13         ` Arnout Vandecappelle
2022-08-01 20:32           ` Bernd Kuhls

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.