Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] boost/all: Compile locale, regex using ICU #1270

Closed
jgsogo opened this issue Apr 3, 2020 · 2 comments · Fixed by #1274
Closed

[package] boost/all: Compile locale, regex using ICU #1270

jgsogo opened this issue Apr 3, 2020 · 2 comments · Fixed by #1274
Labels
enhancement New feature or request

Comments

@jgsogo
Copy link
Contributor

jgsogo commented Apr 3, 2020

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: boost/all

Hi, I'm trying to compile Boost (locale, regex) using ICU instead of ICONV (right now testing locally in Macos). I've found several links on internet where it looks like it is enough to add a -sICU_PATH to the b2 command line, but I cannot make it work. Ideas? Anyone can help me?

So far this is the patch I'm working with (I will improve it to let the user switch between iconv and icu):

diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py
index 70052f9f..7b374ffe 100644
--- a/recipes/boost/all/conanfile.py
+++ b/recipes/boost/all/conanfile.py
@@ -55,7 +55,8 @@ class BoostConan(ConanFile):
         "segmented_stacks": [True, False],
         "debug_level": [i for i in range(1, 14)],
         "pch": [True, False],
-        "extra_b2_flags": "ANY"  # custom b2 flags
+        "extra_b2_flags": "ANY",  # custom b2 flags
+        "disable_icu": [True, False],
     }
     options.update({"without_%s" % libname: [True, False] for libname in lib_list})
 
@@ -81,6 +82,7 @@ class BoostConan(ConanFile):
         "debug_level": 2,
         'pch': True,
         'extra_b2_flags': 'None',
+        "disable_icu": True,
     }
 
     for libname in lib_list:
@@ -133,6 +135,8 @@ class BoostConan(ConanFile):
                 self.requires("xz_utils/5.2.4")
             if self.options.zstd:
                 self.requires("zstd/1.4.3")
+        if not self.options.disable_icu:
+            self.requires("icu/66.1")
 
     def package_id(self):
         if self.options.header_only:
@@ -539,6 +543,15 @@ class BoostConan(ConanFile):
         flags.append("-sNO_LZMA=%s" % ("0" if self.options.lzma else "1"))
         flags.append("-sNO_ZSTD=%s" % ("0" if self.options.zstd else "1"))
 
+        if not self.options.disable_icu:
+            #flags.append("--include={}".format(";".join(self.deps_cpp_info["icu"].include_paths)))
+            #flags.append("--library-path={}".format(";".join(self.deps_cpp_info["icu"].lib_paths)))
+            flags.append("-sICU_PATH={}".format(self.deps_cpp_info["icu"].rootpath))
+            flags.append("boost.locale.iconv=off boost.locale.icu=on")
+        else:
+            flags.append("--disable-icu")
+
+
         def add_defines(option, library):
             if option:
                 for define in self.deps_cpp_info[library].defines:

But running this recipe, this is the output:

...
----Running------
> /Users/jgsogo/.conan/data/b2/4.2.0/_/_/package/743cf0321be3152777da4d05247a66d1552e70a2/bin/b2 target-os=darwin architecture=x86 address-model=64 binary-format=mach-o abi=sysv --layout=system --user-config=/Users/jgsogo/.conan/data/boost/1.72.0/_/_/source/boost_1_72_0/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 -sICU_PATH=/Users/jgsogo/.conan/data/icu/66.1/_/_/package/a226f4b57ae170bd80999f022ae3ae3723a7f69e boost.locale.iconv=off boost.locale.icu=on threading=multi link=static variant=release --without-python toolset=clang-darwin linkflags="-stdlib=libc++" pch=on cxxflags="-fPIC -stdlib=libc++" install --prefix=/Users/jgsogo/.conan/data/boost/1.72.0/_/_/package/c21e2a58327d8ab4686835e06fc22b4ba7812ce2 -j16 --abbreviate-paths -d2 --debug-configuration --build-dir="/Users/jgsogo/.conan/data/boost/1.72.0/_/_/build/c21e2a58327d8ab4686835e06fc22b4ba7812ce2"
-----------------
...

Performing configuration checks

    - default address-model    : 64-bit
    - default architecture     : x86
    - C++11 mutex              : no
    - lockfree boost::atomic_flag : yes
    - Boost.Config Feature Check: cxx11_auto_declarations : no
    - Boost.Config Feature Check: cxx11_constexpr : no
    - Boost.Config Feature Check: cxx11_defaulted_functions : no
    - Boost.Config Feature Check: cxx11_final : no
    - Boost.Config Feature Check: cxx11_hdr_mutex : no
    - Boost.Config Feature Check: cxx11_hdr_tuple : no
    - Boost.Config Feature Check: cxx11_lambdas : no
    - Boost.Config Feature Check: cxx11_noexcept : no
    - Boost.Config Feature Check: cxx11_nullptr : no
    - Boost.Config Feature Check: cxx11_rvalue_references : no
    - Boost.Config Feature Check: cxx11_template_aliases : no
    - Boost.Config Feature Check: cxx11_thread_local : no
    - Boost.Config Feature Check: cxx11_variadic_templates : no
    - has_icu builds           : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam.
note: to suppress this message, pass "--without-graph_parallel" to bjam.
    - zlib                     : yes
    - bzip2                    : yes
    - icu                      : no
    - icu (lib64)              : no
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
    - native-atomic-int32-supported : yes
    - native-syslog-supported  : yes
    - pthread-supports-robust-mutexes : no
    - compiler-supports-ssse3  : yes
    - compiler-supports-avx2   : yes
    - gcc visibility           : yes
    - long double support      : yes
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
    - libbacktrace builds      : no
    - addr2line builds         : yes
    - WinDbg builds            : no
    - WinDbgCached builds      : no
    - BOOST_COMP_GNUC >= 4.3.0 : no

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : building
    - context                  : building
    - contract                 : building
    - coroutine                : building
    - date_time                : building
    - exception                : building
    - fiber                    : building
    - filesystem               : building
    - graph                    : building
    - graph_parallel           : building
    - headers                  : building
    - iostreams                : building
    - locale                   : building
    - log                      : building
    - math                     : building
    - mpi                      : building
    - program_options          : building
    - python                   : not building
    - random                   : building
    - regex                    : building
    - serialization            : building
    - stacktrace               : building
    - system                   : building
    - test                     : building
    - thread                   : building
    - timer                    : building
    - type_erasure             : building
    - wave                     : building

Relevant bits:

    - has_icu builds           : no
...
    - icu                      : no
    - icu (lib64)              : no

Maybe if I use the user-config.jam?

🆘

@jgsogo jgsogo added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Apr 3, 2020
@jgsogo jgsogo changed the title [package] boost/all: Compile local, regex using ICU [package] 🆘 boost/all: Compile local, regex using ICU Apr 3, 2020
@jgsogo
Copy link
Contributor Author

jgsogo commented Apr 4, 2020

Having a look to the ouptu in the boost/bin.v2/config.log file I see several errors:

clang-darwin.compile.c++ /Users/jgsogo/.conan/data/boost/1.72.0/_/_/build/dad103199ece4786376ea9625f8faec2692ec048/boost/bin.v2/libs/regex/build/clng-drwn-11.0/dbg/thrd-mlt/vsblt-hdn/has_icu_test.o

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk" "-arch" "x86_64" -x c++ -fvisibility-inlines-hidden -fPIC -m64 -O0 -fno-inline -Wall -g -fvisibility=hidden -fPIC -stdlib=libc++ -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -I"." -I"/Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include" -c -o "/Users/jgsogo/.conan/data/boost/1.72.0/_/_/build/dad103199ece4786376ea9625f8faec2692ec048/boost/bin.v2/libs/regex/build/clng-drwn-11.0/dbg/thrd-mlt/vsblt-hdn/has_icu_test.o" "libs/regex/build/has_icu_test.cpp"

In file included from libs/regex/build/has_icu_test.cpp:15:
In file included from /Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include/unicode/coll.h:59:
/Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include/unicode/uobject.h:131:54: error: expected ';' at end of declaration list
    static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT;
                                                     ^
                                                     ;
/Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include/unicode/uobject.h:138:56: error: expected ';' at end of declaration list
    static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT;
                                                       ^
                                                       ;
/Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include/unicode/uobject.h:148:51: error: expected ';' at end of declaration list
    static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT;
                                                  ^
                                                  ;
/Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include/unicode/uobject.h:155:53: error: expected ';' at end of declaration list
    static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT;
                                                    ^
                                                    ;
/Users/jgsogo/.conan/data/icu/64.2/_/_/package/9c5c4efabad871d448746b3df3e4e9954a3982d6/include/unicode/uobject.h:163:67: error: expected ';' at end of declaration list
    static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; }
                                                                  ^
                                                                  ;

The has_icu_test.cpp fails and this is probably the reason why ICU is not detected.

Looking for this error on Internet there are many people talking about a _HAS_EXCEPTIONS definition... 🕵

@jgsogo
Copy link
Contributor Author

jgsogo commented Apr 4, 2020

Ok, ICU requires C++11...

@jgsogo jgsogo mentioned this issue Apr 4, 2020
4 tasks
@jgsogo jgsogo changed the title [package] 🆘 boost/all: Compile local, regex using ICU [package] boost/all: Compile local, regex using ICU Apr 4, 2020
@jgsogo jgsogo changed the title [package] boost/all: Compile local, regex using ICU [package] boost/all: Compile locale, regex using ICU Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant