boost regex, stlport and icu on linux

Hello, I'm building boost 1.34.1 on linux (with redhat 9 gcc 3.2.2-5) with STLport 5.0 and ICU. This is the bjam invocation: bjam -q -j4 --toolset=gcc \ --build-dir=~/boost/build \ --stagedir=~/boost/stage --prefix=~/build-gecko \ -sNO_BZIP2=1 \ -sSTLPORT_VERSION=5 -sSTLPORT_5_PATH=~/build-gecko/lib \ -sSTLPORT_INCLUDE_DIRECTORY=../include/stlport \ -sSTLPORT_LIB_DIRECTORY=. \ -sHAVE_ICU=1 -sICU_PATH=~/build-gecko \ --without-python \ runtime-link=shared variant=release \ instruction-set=i686 threading=multi stage install This simple example: #include <iterator> #include <boost/regex.hpp> #include <iostream> int main(int argc, const char** argv) { std::string xml_str = "<?xml version=\"1.0\"?><test/>\n"; boost::regex e1("<\\?xml version=\"[^\"]+\"\\?>", boost::regex::extended); std::string sanitized_xml = boost::regex_replace( xml_str, e1, "", boost::regex_constants::match_default | boost::regex_constants::format_literal); return 0; } compiles ok with c++ -c -o ./test.o -mcpu=pentiumpro -march=pentiumpro -pipe -O2 \ -g3 -pthread -fforce-addr -fstrict-aliasing -Wall -W -Wcast-align \ -Wconversion -Wpointer-arith -Wsign-compare -Wwrite-strings \ -ftemplate-depth-48 -fno-dollars-in-identifiers -fno-operator-names \ -ffor-scope -Wctor-dtor-privacy -Wnon-virtual-dtor \ -Woverloaded-virtual -Wsign-promo -Wsynth -D__linux__ \ -D__OSVERSION__=2 -D__LITTLE_ENDIAN__ -D_REENTRANT -D_GNU_SOURCE \ -DHAVE_CONFIG_H=1 -DDEBUG -DFATAL_ASSERTS -DXP_UNIX \ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA \ -I${HOME}/build-gecko/include/stlport \ -I${HOME}/build-gecko/include \ -I${HOME}/build-gecko/include/boost-1_34_1 \ ./test.cc # Yes, I know the command line is longer than the example but fails when linking with c++ -pthread -Wl,-rpath-link,${HOME}/build-gecko/lib \ -o ./test ./test.o \ ~/build-gecko/lib/libboost_regex-gcc32-mt-1_34_1.so \ ~/build-gecko/lib/libicuuc.so \ ~/build-gecko/lib/libicui18n.so \ ~/build-gecko/lib/libicudata.so \ ~/build-gecko/lib/libstlport.so The full linker error is: test.o(.gnu.linkonce.t._ZN5boost12regex_searchIPKcN8stlp_std9allocatorINS_9sub_matchIS2_EEEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SC_RNS_13match_resultsISC_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESC_+0x9d): In function `bool boost::regex_search<char const*, stlp_std::allocator<boost::sub_match<char const*> >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*, char const*, boost::match_results<char const*, stlp_std::allocator<boost::sub_match<char const*> > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, char const*)': /home/nas/michele/build-gecko/include/stlport/stl/_alloc.c:273: undefined reference to `boost::re_detail::perl_matcher<char const*, stlp_std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> >
::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)' test.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIPKcN8stlp_std9allocatorINS_9sub_matchIS3_EEEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE11match_matchEv+0xd4): In function `boost::re_detail::perl_matcher<char const*, stlp_std::allocator<boost::sub_match<char const*> >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_match()': /home/nas/michele/build-gecko/include/boost-1_34_1/boost/regex/v4/regex_iterator.hpp:48: undefined reference to `boost::match_results<char const*, stlp_std::allocator<boost::sub_match<char const*> > ::maybe_assign(boost::match_results<char const*, stlp_std::allocator<boost::sub_match<char const*> > > const&)' test.o(.gnu.linkonce.t._ZN5boost9re_detail11raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE+0x9a): In function `void boost::re_detail::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > (boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)': /home/nas/michele/build-gecko/include/boost-1_34_1/boost/regex/v4/perl_matcher_common.hpp:861: undefined reference to `boost::re_detail::raise_runtime_error(stlp_std::runtime_error const&)'
collect2: ld returned 1 exit status
I googled a bit and found this: http://lists.boost.org/boost-users/2006/02/17394.php but there was no follow up. Is there some mistake in my example? Does somebody have any suggestions or workarounds? I know that gcc 3.2.2 is quite old but I have used it for many years and always convinced it to do its work (and no, I cannot easily switch to a newer compiler). Any help will be really appreciated; cheers, Michele

Michele Bini wrote:
Hello,
I'm building boost 1.34.1 on linux (with redhat 9 gcc 3.2.2-5) with STLport 5.0 and ICU. This is the bjam invocation:
I googled a bit and found this:
http://lists.boost.org/boost-users/2006/02/17394.php
but there was no follow up. Is there some mistake in my example? Does somebody have any suggestions or workarounds? I know that gcc 3.2.2 is quite old but I have used it for many years and always convinced it to do its work (and no, I cannot easily switch to a newer compiler).
Hmmm, no I don't know what the issue is: but for some reason we have more issues with STLport than anything else :-( My suggestion would be to build the regex library using the supplied libs/regex/build/gcc.mak: suitably modified to add all the compiler options you are going to be using when building your application, hopefully that way the library and your application will actually be compatible with each other! ;-) HTH, John.
participants (2)
-
John Maddock
-
Michele Bini