
Candid Shot wrote:
(I am listing a problem in compling boost/regex, and a solution, and want to know if this is the right approach. We are trying to use boost as a static library, with regex and icu support. Thanks. =cs)
Here used is the vanilla static compile of ICU (i.e. no changes to icu4c-4_6-src.tgz), installed in subdirectory icu2 as:
./bootstrap.sh --with-icu=/home/cxs/icu2 --prefix=osboost --without-libraries=python link=static variant=release
====================================================================
$ ./bjam --list-libraries -d+2
.... .... gcc.compile.c++ bin.v2/libs/regex/build/gcc-4.1.2/debug/has_icu_test.o
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -I"." -I"/home/cxs/icu2/include" -c -o "bin.v2/libs/regex/build/gcc-4.1.2/debug/has_icu_test.o" "libs/regex/build/has_icu_test.cpp"
libs/regex/build/has_icu_test.cpp:26:2: warning: no newline at end of file libs/regex/build/has_icu_test.cpp: In function 'int main()': libs/regex/build/has_icu_test.cpp:24: warning: unused variable 'c'
gcc.link bin.v2/libs/regex/build/gcc-4.1.2/debug/has_icu
"g++" -L"/home/cxs/icu2/lib" -Wl,-R -Wl,"/home/cxs/icu2/bin" -Wl,-R -Wl,"/home/cxs/icu2/lib" -Wl,-rpath-link -Wl,"/home/cxs/icu2/lib" -o "bin.v2/libs/regex/build/gcc-4.1.2/debug/has_icu" -Wl,--start-group "bin.v2/libs/regex/build/gcc-4.1.2/debug/has_icu_test.o" -Wl,-Bstatic -Wl,-Bdynamic -licuuc -licui18n -licudata -Wl,--end-group -g
/home/cxs/icu2/lib/libicuuc.a(putil.ao): In function `uprv_dl_sym_46': putil.c:(.text+0x241): undefined reference to `dlsym' /home/cxs/icu2/lib/libicuuc.a(putil.ao): In function `uprv_dl_open_46': putil.c:(.text+0x2a6): undefined reference to `dlopen' /home/cxs/icu2/lib/libicuuc.a(putil.ao): In function `uprv_dl_close_46': putil.c:(.text+0x269): undefined reference to `dlclose' collect2: ld returned 1 exit status ...failed updating 1 target... Performing configuration checks
- has_icu builds : no .... ....
(So icu is not detected due to a missing -ldl flag in the last call to g++ above.) ====================================================================
This issue is taken care of by adding to libs/regex/build/Jamfile.v2 these lines
to the else clause of
if $(ICU_LINK) {...} else {
lib dl : : <search>$(ICU_PATH)/lib <link>shared <runtime-link>shared ; lib dl : : <toolset>msvc <variant>debug <name>dl <search>$(ICU_PATH)/lib <link>shared <runtime-link>shared ; lib dl : : <name>this_is_an_invalid_library_name ; ... }
and add to ICU_OPTS = <library>dl/<link>shared/<runtime-link>shared
The question is: is this the correct approach? Thanks,
I think the ideal approach is to build shared ICU libraries. Alternatively, can you check whether ICU build you have appears to include .pc files and whether those .pc files mention dependency in 'dl'? - Volodya