Skip to contentSkip to conversation

boost: locale needs thread with icu

PATCH New Fabrice Fontaine 2 participants 3 messages Aug 14, 2018 – Aug 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 boost: locale needs thread with icu

output/host/usr/bin/nios2-linux-readelf -d output/staging/usr/lib/libboost_locale.so

Dynamic section at offset 0x125ec0 contains 36 entries:
Tag Type Name/Value

 0x00000001 (NEEDED)                     Shared library: [libboost_chrono.so.1.67.0]
 0x00000001 (NEEDED)                     Shared library: [libboost_thread.so.1.67.0]
 0x00000001 (NEEDED)                     Shared library: [libboost_system.so.1.67.0]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libicudata.so.60]
 0x00000001 (NEEDED)                     Shared library: [libicui18n.so.60]
 0x00000001 (NEEDED)                     Shared library: [libicuuc.so.60]

Fixes:
- http://autobuild.buildroot.net/results/57838f7cd84f37b66ab7007deaea847af8f54b72

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Split patch in two and move select of chrono from locale to thread

 package/boost/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/boost/Config.in +1 -0
index 42428fab10..69fd6158ca 100644
@@ -190,6 +190,7 @@ config BR2_PACKAGE_BOOST_LOCALE
 	# details.
 	depends on !(BR2_STATIC_LIBS && BR2_PACKAGE_ICU)
 	select BR2_PACKAGE_BOOST_SYSTEM
+	select BR2_PACKAGE_BOOST_THREAD if BR2_PACKAGE_ICU
 	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
 	help
 	  Provide localization and Unicode handling tools for C++.
Signature · 1 line
2.14.1
#1 lore raw

PATCH v2 2/2 boost: thread needs chrono

chrono is selected by thread (see libs/thread/build/Jamfile.v2):

rule usage-requirements ( properties * )
{
[...]
result += <library>/boost/chrono//boost_chrono ;
}

So add this select for BR2_PACKAGE_BOOST_THREAD and remove it from BR2_PACKAGE_BOOST_COROUTINE, BR2_PACKAGE_BOOST_LOG, BR2_PACKAGE_TYPE_ERASURE and BR2_PACKAGE_BOOST_WAVE

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Split patch in two and move select of chrono from locale to thread

 package/boost/Config.in | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
package/boost/Config.in +1 -4
index 69fd6158ca..b3f5f6aea6 100644
@@ -101,7 +101,6 @@ config BR2_PACKAGE_BOOST_COROUTINE
 	bool "boost-coroutine"
 	depends on BR2_PACKAGE_BOOST_CONTEXT_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # boost-context
-	select BR2_PACKAGE_BOOST_CHRONO
 	select BR2_PACKAGE_BOOST_CONTEXT
 	select BR2_PACKAGE_BOOST_SYSTEM
 	select BR2_PACKAGE_BOOST_THREAD
@@ -206,7 +205,6 @@ config BR2_PACKAGE_BOOST_LOG
 	# log module
 	depends on !(BR2_powerpc && BR2_TOOLCHAIN_USES_UCLIBC)
 	select BR2_PACKAGE_BOOST_ATOMIC
-	select BR2_PACKAGE_BOOST_CHRONO
 	select BR2_PACKAGE_BOOST_DATE_TIME
 	select BR2_PACKAGE_BOOST_FILESYSTEM
 	select BR2_PACKAGE_BOOST_REGEX
@@ -315,6 +313,7 @@ config BR2_PACKAGE_BOOST_TEST
 config BR2_PACKAGE_BOOST_THREAD
 	bool "boost-thread"
 	select BR2_PACKAGE_BOOST_ATOMIC if BR2_TOOLCHAIN_HAS_GCC_BUG_64735
+	select BR2_PACKAGE_BOOST_CHRONO
 	select BR2_PACKAGE_BOOST_SYSTEM
 	help
 	  Portable C++ multi-threading. C++11, C++14.
@@ -328,7 +327,6 @@ config BR2_PACKAGE_BOOST_TIMER
 
 config BR2_PACKAGE_BOOST_TYPE_ERASURE
 	bool "boost-type_erasure"
-	select BR2_PACKAGE_BOOST_CHRONO
 	select BR2_PACKAGE_BOOST_SYSTEM
 	select BR2_PACKAGE_BOOST_THREAD
 	help
@@ -339,7 +337,6 @@ config BR2_PACKAGE_BOOST_WAVE
 	# limitation of assembler for coldfire
 	# error: Tried to convert PC relative branch to absolute jump
 	depends on !BR2_m68k_cf
-	select BR2_PACKAGE_BOOST_CHRONO
 	select BR2_PACKAGE_BOOST_DATE_TIME
 	select BR2_PACKAGE_BOOST_FILESYSTEM
 	select BR2_PACKAGE_BOOST_SYSTEM
Signature · 1 line
2.14.1
#2 lore raw

PATCH v2 1/2 boost: locale needs thread with icu

In reply to Fabrice Fontaine

Hello,

Quoted 12 lines · Fabrice Fontaine

output/host/usr/bin/nios2-linux-readelf -d output/staging/usr/lib/libboost_locale.so

Dynamic section at offset 0x125ec0 contains 36 entries:
Tag Type Name/Value

 0x00000001 (NEEDED)                     Shared library: [libboost_chrono.so.1.67.0]
 0x00000001 (NEEDED)                     Shared library: [libboost_thread.so.1.67.0]
 0x00000001 (NEEDED)                     Shared library: [libboost_system.so.1.67.0]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libicudata.so.60]
 0x00000001 (NEEDED)                     Shared library: [libicui18n.so.60]
 0x00000001 (NEEDED)                     Shared library: [libicuuc.so.60]
Quoted 4 lines

Fixes:
- http://autobuild.buildroot.net/results/57838f7cd84f37b66ab7007deaea847af8f54b72

I have applied both patches to master, but I think we still do have a bunch of issues to resolve.

Issue 1
=======

First of all, ICU support is not always detected by Boost. For example, the following glibc-based defconfig builds boost_locale with ICU support:

BR2_arm=y
BR2_cortex_a8=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_BOOST=y
BR2_PACKAGE_BOOST_LOCALE=y
BR2_PACKAGE_ICU=y
# BR2_TARGET_ROOTFS_TAR is not set

We have:

- icu : yes

And libboost_locale.so is indeed linked with libicu.

However, the following uclibc-based defconfig builds boost_locale without ICU, even though ICU is enabled and built before boost:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2018.05.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_1=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_BOOST=y
BR2_PACKAGE_BOOST_LOCALE=y
BR2_PACKAGE_ICU=y
# BR2_TARGET_ROOTFS_TAR is not set

We have:

- icu : no
- icu (lib64) : no

If I understand correctly, it tries to detect if ICU is available by building the program libs/locale/build/has_icu_test.cpp. With the glibc toolchain:

$ ./host/bin/arm-linux-gnueabihf-g++ -o foo build/boost-1.67.0/libs/locale/build/has_icu_test.cpp -licui18n -licuuc -licudata
$

I.e, it builds fine. With the uClibc toolchain:

$ ./host/bin/arm-linux-g++ -o foo build/boost-1.67.0/libs/locale/build/has_icu_test.cpp -licui18n -licuuc -licudata
... lots and lots of errors about char16_t ...

Issue 2
=======

This is a rather minor issue, but if ICU is available, Boost doesn't need iconv support to build boost_locale. So probably, we need to change:

select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE

into:

	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE && !BR2_PACKAGE_ICU

(and boost.mk to be adjusted accordingly)

Issue 3
=======

In your PATCH 2/2, you remove a lot of select on the chrono module. Indeed, for example, boost_locale is linked against boost_chrono, but the Jamfile of boost_locale doesn't describe this dependency, and it's just because boost_locale -> boost_thread -> boost_chrono that boost_locale gets linked against boost_chrono.

So I grepped the Boost source code to see which Boost modules directly use chrono:

find . -name 'Jamfile*' | xargs grep "library.*chrono"

So indeed the log, type erasure, and wave modules don't use chrono directly. However, the coroutine module does use chrono directly:

./libs/coroutine/performance/asymmetric/segmented/Jamfile.v2: <library>/boost/chrono//boost_chrono
./libs/coroutine/performance/asymmetric/Jamfile.v2: <library>/boost/chrono//boost_chrono
./libs/coroutine/performance/symmetric/segmented/Jamfile.v2: <library>/boost/chrono//boost_chrono
./libs/coroutine/performance/symmetric/Jamfile.v2: <library>/boost/chrono//boost_chrono

So perhaps BR2_PACKAGE_BOOST_COROUTINE should continue to select BR2_PACKAGE_BOOST_CHRONO ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com