Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost.Regex with icu/unicode support

How to build Boost.Regex with icu/ unicode support? My compiler is GCC, and IDE is Eclipse C++. How to configure binary files with Eclipse? I tried to do this "bjam --sHAVE_ICU=1 toolset=gcc". But it did not work. When i check if icu support is enable with "bjam -has_icu", i still get "has icu builds : no".

like image 638
Davaahuu Jamsran Avatar asked Apr 18 '13 07:04

Davaahuu Jamsran


People also ask

What is ICU regex?

Overview. ICU's Regular Expressions package provides applications with the ability to apply regular expression matching to Unicode string data. The regular expression patterns and behavior are based on Perl's regular expressions.

What is boost regex?

Boost. Regex allows you to use regular expressions in C++. As the library is part of the standard library since C++11, you don't depend on Boost. Regex if your development environment supports C++11.


2 Answers

I build Boost against ICU using -sICU_PATH=<icuRoot> and -sICU_LINK="-L<icuLibDir>".

I've seen Boost fail to properly detect ICU as well, and have needed to patch the file has_icu_test.cpp (simply return 0 from it's main() function). This will work if you know everything else is set up properly.

like image 53
NuSkooler Avatar answered Sep 29 '22 23:09

NuSkooler


Solved the problem by adding directly include path of include ICU directory to cflags when executing b2. For instance:

./b2 --with-regex
cflags="-O0 -I\"$ICU_PATH/include\"

You also may need to add path of ICU lib and moreover full paths to libs to linker. Something like this:

export ICU_LINK="-L\"$ICU_PATH/lib\" -l\"$ICU_PATH/lib/libicudata.a\" -l\"$ICU_PATH/lib/libicui18n.a\" -l\"$ICU_PATH/lib/libicuuc.a\""
./b2 --with-regex
cflags="-O0 -I\"$ICU_PATH/include\"
-sICU_LINK=$ICU_LINK \
like image 34
HelllRow Stas Avatar answered Sep 29 '22 22:09

HelllRow Stas