Skip to contentSkip to conversation

toolchain/toolchain-external/toolchain-external-synopsys-arc: drop locale

PATCH In review Fabrice Fontaine 2 participants 5 messages Feb 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain/toolchain-external/toolchain-external-synopsys-arc: drop locale

locale is not enabled resulting in the following libcpprestsdk build failure:

In file included from /home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/include/cpprest/json.h:18,

                 from /home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/src/pch/stdafx.h:88,
                 from /home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/src/http/client/http_client_msg.cpp:13:
/home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/include/cpprest/asyncrt_utils.h:317:13: error: 'locale_t' does not name a type
  317 |     typedef locale_t xplat_locale;
      |             ^~~~~~~~

Fixes:
- http://autobuild.buildroot.org/results/e6778e60cc1ea455f5b4511d5824f04d8040f67b

---
 .../toolchain-external/toolchain-external-synopsys-arc/Config.in | 1 -
 1 file changed, 1 deletion(-)
toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in +0 -1
index c3483f331c..37c7b82644 100644
@@ -4,7 +4,6 @@ config BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC
 	depends on BR2_HOSTARCH = "x86_64"
 	select BR2_TOOLCHAIN_EXTERNAL_UCLIBC
 	select BR2_INSTALL_LIBSTDCPP
-	select BR2_ENABLE_LOCALE
 	select BR2_USE_WCHAR
 	select BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_TOOLCHAIN_HAS_THREADS_NPTL
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 10 lines · On Tue, 21 Feb 2023 12:29:11 +0100 Fabrice Fontaine…

locale is not enabled resulting in the following libcpprestsdk build failure:

In file included from /home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/include/cpprest/json.h:18,

                 from /home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/src/pch/stdafx.h:88,
                 from /home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/src/http/client/http_client_msg.cpp:13:
/home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/include/cpprest/asyncrt_utils.h:317:13: error: 'locale_t' does not name a type
  317 |     typedef locale_t xplat_locale;
      |             ^~~~~~~~
Quoted 4 lines

Fixes:
- http://autobuild.buildroot.org/results/e6778e60cc1ea455f5b4511d5824f04d8040f67b

The thing is that the toolchain claims to have locale support:

$ grep LOCALE output/host/opt/ext-toolchain/arc-snps-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h 
#define __UCLIBC_HAS_LOCALE__ 1
#define __UCLIBC_BUILD_MINIMAL_LOCALE__ 1
#undef __UCLIBC_BUILD_ALL_LOCALE__
#define __UCLIBC_BUILD_MINIMAL_LOCALES__ "en_US"
#undef __UCLIBC_HAS_XLOCALE__

Are you sure your commit doesn't break the build? Indeed normally for external toolchains, we verify that the Buildroot configuration matches the toolchain, and abort the build if not. So if the toolchain supports locale (which it does here according to __UCLIBC_HAS_LOCALE__) but your Buildroot configuration doesn't say so, the build should normally abort with:

XYZ available in C library, please enable ABC

See in toolchains/helpers.mk:

check_uclibc_feature = \
        IS_IN_LIBC=`grep -q "\#define $(1) 1" $(3) && echo y` ; \
        if [ -z "$(2)" ] ; then \
                if [ "$${IS_IN_LIBC}" != "y" ] ; then \
                        echo "$(4) not available in C library, toolchain unsuitable for Buildroot" ; \
                        exit 1 ; \
                fi ; \
        else \
                if [ "$($(2))" != "y" -a "$${IS_IN_LIBC}" = "y" ] ; then \
                        echo "$(4) available in C library, please enable $(2)" ; \
                        exit 1 ; \
                fi ; \
                if [ "$($(2))" = "y" -a "$${IS_IN_LIBC}" != "y" ] ; then \
                        echo "$(4) not available in C library, please disable $(2)" ; \
                        exit 1 ; \
                fi ; \
        fi
check_uclibc = \
	[...]
        $(call check_uclibc_feature,__UCLIBC_HAS_LOCALE__,BR2_ENABLE_LOCALE,$${UCLIBC_CONFIG_FILE},Locale support) ;\

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 26 lines · Thomas Petazzoni
Quoted 4 lines · On Tue, 21 Feb 2023 12:29:11 +0100 Fabrice Fontaine…

locale is not enabled resulting in the following libcpprestsdk build failure:

In file included from

/home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/include/cpprest/json.h:18,

Quoted 1 line

from

/home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/src/pch/stdafx.h:88,

Quoted 1 line

from

/home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/src/http/client/http_client_msg.cpp:13:

Quoted 1 line

/home/thomas/autobuild/instance-0/output-1/build/libcpprestsdk-2.10.18/Release/include/cpprest/asyncrt_utils.h:317:13:
error: 'locale_t' does not name a type

Quoted 5 lines
  317 |     typedef locale_t xplat_locale;
      |             ^~~~~~~~

Fixes:
-

http://autobuild.buildroot.org/results/e6778e60cc1ea455f5b4511d5824f04d8040f67b

Quoted 2 lines

The thing is that the toolchain claims to have locale support:

Quoted 9 lines
$ grep LOCALE
output/host/opt/ext-toolchain/arc-snps-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h

#define __UCLIBC_HAS_LOCALE__ 1
#define __UCLIBC_BUILD_MINIMAL_LOCALE__ 1
#undef __UCLIBC_BUILD_ALL_LOCALE__
#define __UCLIBC_BUILD_MINIMAL_LOCALES__ "en_US"
#undef __UCLIBC_HAS_XLOCALE__

I think the issue is that __UCLIBC_HAS_XLOCALE__ is disabled. To my understanding, locale_t is defined in xlocale.h:
https://github.com/wbx-github/uclibc-ng/blob/ab1dd83bec59c9e65c31efd6e887182948f627be/include/xlocale.h#L46

I'm far from being an expert in locale/uclibc-ng so I'm a bit lost between all those variables ...
In uclibc.mk, we're enabling UCLIBC_HAS_XLOCALE in UCLIBC_LOCALE_CONFIG hook.

Quoted 36 lines

Are you sure your commit doesn't break the build? Indeed normally for external toolchains, we verify that the Buildroot configuration matches the toolchain, and abort the build if not. So if the toolchain supports locale (which it does here according to __UCLIBC_HAS_LOCALE__) but your Buildroot configuration doesn't say so, the build should normally abort with:

XYZ available in C library, please enable ABC

See in toolchains/helpers.mk:

check_uclibc_feature = \
        IS_IN_LIBC=`grep -q "\#define $(1) 1" $(3) && echo y` ; \
        if [ -z "$(2)" ] ; then \
                if [ "$${IS_IN_LIBC}" != "y" ] ; then \
                        echo "$(4) not available in C library, toolchain
unsuitable for Buildroot" ; \
                        exit 1 ; \
                fi ; \
        else \
                if [ "$($(2))" != "y" -a "$${IS_IN_LIBC}" = "y" ] ; then \
                        echo "$(4) available in C library, please enable
$(2)" ; \
                        exit 1 ; \
                fi ; \
                if [ "$($(2))" = "y" -a "$${IS_IN_LIBC}" != "y" ] ; then \
                        echo "$(4) not available in C library, please
disable $(2)" ; \
                        exit 1 ; \
                fi ; \
        fi
check_uclibc = \
        [...]
        $(call
Quoted 8 lines

check_uclibc_feature,__UCLIBC_HAS_LOCALE__,BR2_ENABLE_LOCALE,$${UCLIBC_CONFIG_FILE},Locale support) ;\

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 3 lines · On Tue, 21 Feb 2023 15:09:47 +0100 Fabrice Fontaine…

I think the issue is that __UCLIBC_HAS_XLOCALE__ is disabled. To my understanding, locale_t is defined in xlocale.h:
https://github.com/wbx-github/uclibc-ng/blob/ab1dd83bec59c9e65c31efd6e887182948f627be/include/xlocale.h#L46

Possible indeed. There are newer versions of the ARC toolchain available at
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases,
but I checked the latest and it still has xlocale disabled.

One option is to ask the ARC/Synopsys people to enable XLOCALE in their uClibc configuration.

Another option is to drop the ARC/Synopsys toolchain entirely.

A third option is to change the check done by Buildroot to verify __UCLIBC_HAS_XLOCALE__ instead of __UCLIBC_HAS_LOCALE__. This way it will be valid to say that the ARC toolchain does not have locale support.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
Quoted 8 lines · Thomas Petazzoni
Quoted 3 lines · On Tue, 21 Feb 2023 15:09:47 +0100 Fabrice Fontaine…

I think the issue is that __UCLIBC_HAS_XLOCALE__ is disabled. To my understanding, locale_t is defined in xlocale.h:

https://github.com/wbx-github/uclibc-ng/blob/ab1dd83bec59c9e65c31efd6e887182948f627be/include/xlocale.h#L46

Quoted 9 lines

Possible indeed. There are newer versions of the ARC toolchain available at
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
,
but I checked the latest and it still has xlocale disabled.

One option is to ask the ARC/Synopsys people to enable XLOCALE in their uClibc configuration.

I added a comment to an issue opened in 2020:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/241

Quoted 8 lines

Another option is to drop the ARC/Synopsys toolchain entirely.

A third option is to change the check done by Buildroot to verify __UCLIBC_HAS_XLOCALE__ instead of __UCLIBC_HAS_LOCALE__. This way it will be valid to say that the ARC toolchain does not have locale support.

I'll send a patch.

Quoted 7 lines

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot