Re: [Boost-users] problem in multithreaded regex_replace on linux

Dear John Apparantly, I am doing something wrong that is very elementary. I do not have any -mt version of the regex library. I even dispensed with STLport and tried to build boost first for default system libraries only. After giving the command "bjam -sTOOLS=gcc" in the directories boost_1_33_1/libs/regex/build and boost_1_33_1/libs/thread/build, I have the following libraries: $ find | grep "\.a$" ./libs/thread/build/bin-stage/libboost_thread-gcc-mt-d-1_33_1.a ./stage/lib/libboost_regex-gcc-d-1_33_1.a ./stage/lib/libboost_regex-gcc-1_33_1.a ./bin/boost/libs/regex/build/libboost_regex.a ./bin/boost/libs/regex/build/libboost_regex.a/gcc/debug/libboost_regex-gcc-d-1_33_1.a ./bin/boost/libs/regex/build/libboost_regex.a/gcc/release/libboost_regex-gcc-1_33_1.a ./bin/boost/libs/thread/build/libboost_thread.a ./bin/boost/libs/thread/build/libboost_thread.a/gcc/debug/threading-multi/libboost_thread-gcc-mt-d-1_33_1.a I have not been able to find how to build -mt versions of the regex library. Apparantly, the threads library is built so by default. Also, while trying to compile static_mutex_test.cpp, a lot of undefined references crop up even when I link with both boost::regex and boost::thread. The command was $ g++ -I ~/Software/boost_1_33_1 -L ~/Software/boost_1_33_1/libs/thread/build/bin-stage/ -L ~/Software/boost_1_33_1/stage/lib/ -lboost_thread-gcc-mt-d-1_33_1 -lboost_regex-gcc-1_33_1 -pthread static_mutex_test.cpp /tmp/ccvkfjk2.o(.text+0x16): In function `failed_test(char const*, int, char const*)': : undefined reference to `boost::scoped_static_mutex_lock::scoped_static_mutex_lock[in-charge](boost::static_mutex&, bool)' /tmp/ccvkfjk2.o(.text+0xa8): In function `failed_test(char const*, int, char const*)': : undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock [in-charge]()' ----------- snip -------------- /tmp/ccvkfjk2.o(.text+0x5da): In function `t3()': : undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock [in-charge]()' /tmp/ccvkfjk2.o(.text+0x5f4): In function `t3()': : undefined reference to `boost::scoped_static_mutex_lock::~scoped_static_mutex_lock [in-charge]()' collect2: ld returned 1 exit status Since the scoped_static_mutex_lock is defined only in the regex sources, I think the errors are due to the -mt versions not being built. I have verified that -mt versions are being built and used on windows. I tried using the same technique (building using makefiles) but no luck $ make -f gcc.mak $ find | grep "\.a$" ./gcc/libboost_regex-gcc-1_33_1.a ./gcc/libboost_regex-gcc-d-1_33_1.a So now my main problem becomes "How do I build -mt versions of regex on linux". I hope the answer does not make me look too dumb. Thanks in advance Yours Sincerely Ashish Varman

Ashish Varman wrote:
Dear John
Apparantly, I am doing something wrong that is very elementary. I do not have any -mt version of the regex library. I even dispensed with STLport and tried to build boost first for default system libraries only. After giving the command "bjam -sTOOLS=gcc" in the directories boost_1_33_1/libs/regex/build and boost_1_33_1/libs/thread/build, I have the following libraries:
If you build all of boost from the root directory you should get threaded lib's as well as the thread-unsafe versions, but from libs/regex/build then: export BUILD="<threading>multi" bjam stage should do the trick. You can always double check the status of the lib by building and then running the regex_config_info.cpp test program: it will output the values of all the config macros that are set and BOOST_HAS_THREADS should be one of them. HTH, John.
participants (2)
-
Ashish Varman
-
John Maddock