Re: [Boost-users] [regex] How to compile with desired version when multiple versions of boost library are installed

Hello, I have boost_1_32 version installed at /usr/include/boost Also, I have installed boost_1_34 at another path:/home/myname/work/boost/boost_1_34_0/ Now when I try to run with 1_34 version, it still points to 1_32 version at /usr/include (this is observed when I debug using gdb it refers to /usr/include/boost/regex/v4/match_results.hpp:118) I tried following things: 1] export LD_LIBRARY_PATH=/home/myname/work/boost/boost_1_34_0/boost:$LD_LIBRARY_PATH export PATH=/home/myname/work/boost/boost_1_34_0/boost:$PATH 2] I am using following command for compilation g++ -c -g -I/home/myname/work/boost/boost_1_34_0/boost ${TEST_FILES_PATH}/${TEST}.c g++ ${TEST}.o -L/home/myname/work/boost/lib -lboost_regex 3] I am including boost header in ${TEST}.c as below #include "boost/regex.hpp" Any help is most welcome. Thanks and Regards, Chandan ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/

On 7/16/07, Chandan Nilange
2] I am using following command for compilation g++ -c -g -I/home/myname/work/boost/boost_1_34_0/boost ${TEST_FILES_PATH}/${TEST}.c g++ ${TEST}.o -L/home/myname/work/boost/lib -lboost_regex
I don't think -I is right. You need a version of -I that puts the path before the normal system includes.

Chandan Nilange wrote:
Hello,
I have boost_1_32 version installed at /usr/include/boost Also, I have installed boost_1_34 at another path:/home/myname/work/boost/boost_1_34_0/
Now when I try to run with 1_34 version, it still points to 1_32 version at /usr/include (this is observed when I debug using gdb it refers to /usr/include/boost/regex/v4/match_results.hpp:118)
I tried following things:
1] export LD_LIBRARY_PATH=/home/myname/work/boost/boost_1_34_0/boost:$LD_LIBRARY_PATH export PATH=/home/myname/work/boost/boost_1_34_0/boost:$PATH
Looks right.
2] I am using following command for compilation g++ -c -g -I/home/myname/work/boost/boost_1_34_0/boost ${TEST_FILES_PATH}/${TEST}.c g++ ${TEST}.o -L/home/myname/work/boost/lib -lboost_regex
Looks right: you could double check by checking the value of BOOST_VERSION in your code, and verifying that libboost_regex.so is present in /home/myname/work/boost/lib.
3] I am including boost header in ${TEST}.c as below #include "boost/regex.hpp"
Also looks right. Basically you have three things to double check: 1) Compile time, that the right headers are included. 2) Link time, that you're linking against the right library. 3) Run time, that LD_LIBRARY_PATH is set right. Personnally if I were a better man, I'd put a bet on #2, but that's just a guess :-) HTH, John.

Hello John,
I find following *.a *.so but no libboost_regex.so
at path :/home/ChandanNilange/work/boost/lib
libboost_regex-gcc34-1_34.a
libboost_regex-gcc34-1_34.so
libboost_regex-gcc34-1_34.so.1.34.0
libboost_regex-gcc34.a
libboost_regex-gcc34-d-1_34.a
libboost_regex-gcc34-d-1_34.so
libboost_regex-gcc34-d-1_34.so.1.34.0
libboost_regex-gcc34-d.a
libboost_regex-gcc34-d.so
libboost_regex-gcc34-mt-1_34.a
libboost_regex-gcc34-mt-1_34.so
libboost_regex-gcc34-mt-1_34.so.1.34.0
libboost_regex-gcc34-mt.a
libboost_regex-gcc34-mt-d-1_34.a
libboost_regex-gcc34-mt-d-1_34.so
libboost_regex-gcc34-mt-d-1_34.so.1.34.0
libboost_regex-gcc34-mt-d.a
libboost_regex-gcc34-mt-d.so
libboost_regex-gcc34-mt.so
libboost_regex-gcc34.so
Also, I tried with all above *.a by stripping "lib" &
.* from their name. However I can get messages like
/usr/include/boost/regex/v4/basic_regex.hpp:338:
undefined reference to `boost::reg_expression ::reg_expression(std::allocator<char> const&)' Do you think I have made some mistake during build.
Following were the steps followed
=> gunzip boost_1_34_0.tar.gz
=> tar -xvf boost_1_34_0.tar
=> cd boost_1_34_0
=> ./configure
--prefix=/home/ChandanNilange/work/boost/
--with-libraries=regex
=> make install
Regards,
Chandan
--- John Maddock Chandan Nilange wrote: Hello, I have boost_1_32 version installed at
/usr/include/boost
Also, I have installed boost_1_34 at another
path:/home/myname/work/boost/boost_1_34_0/ Now when I try to run with 1_34 version, it still
points to 1_32 version at /usr/include (this is
observed when I debug using gdb it refers to
/usr/include/boost/regex/v4/match_results.hpp:118) I tried following things: 1]
export LD_LIBRARY_PATH=/home/myname/work/boost/boost_1_34_0/boost:$LD_LIBRARY_PATH export PATH=/home/myname/work/boost/boost_1_34_0/boost:$PATH Looks right. 2]
I am using following command for compilation
g++ -c -g
-I/home/myname/work/boost/boost_1_34_0/boost
${TEST_FILES_PATH}/${TEST}.c
g++ ${TEST}.o -L/home/myname/work/boost/lib
-lboost_regex Looks right: you could double check by checking the
value of BOOST_VERSION
in your code, and verifying that libboost_regex.so
is present in
/home/myname/work/boost/lib. 3] I am including boost header in ${TEST}.c as
below
#include "boost/regex.hpp" Also looks right. Basically you have three things to double check: 1) Compile time, that the right headers are
included.
2) Link time, that you're linking against the right
library.
3) Run time, that LD_LIBRARY_PATH is set right. Personnally if I were a better man, I'd put a bet on
#2, but that's just a
guess :-) HTH, John. _______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

Hello, The build steps (./configure, make ...) are pretty much what I did a few days ago, and it works fine for me on RedHat/CentOS 4. You have Boost 1.32 installed (the system default), and 1.34 installed in your personal area, right? So probably you are also running something a bit like Redhat Linux 4 ... I needed to do 3 things to complie and link against the new libraries: 1/ Make sure my compiler checks the new include path for headers before the system defaults - look in /home/ChandanNilange/work/boost/include/boost-1_34 - are there headers there? That path needs to be before /usr/include. For gcc/g++ that requires a -I option to the compiler. 2/ Make sure that my linker knows where the new libraries are - look in /home/ChandanNilange/work/boost/lib, and if that is full of libraries, then use -L to state the path 3/ Change the names of the libraries that you are trying to link to; for example I used to link to boost_regex, now I link to boost_regex-gcc34-mt-1_34 (I use the -mt version because my app is multi-threaded and also links to pthread). Then to run the application the library loader also needs to know where your new libraries are. I added the install directory of the new Boost libs to /etc/ld.so.conf, but I think that you can also use the environment variable LD_LIBRARY_PATH. (Search for the Program Library HOWTO if you need more information about that). Chandan Nilange wrote:
Hello John,
I find following *.a *.so but no libboost_regex.so at path :/home/ChandanNilange/work/boost/lib
libboost_regex-gcc34-1_34.a libboost_regex-gcc34-1_34.so libboost_regex-gcc34-1_34.so.1.34.0 libboost_regex-gcc34.a libboost_regex-gcc34-d-1_34.a libboost_regex-gcc34-d-1_34.so libboost_regex-gcc34-d-1_34.so.1.34.0 libboost_regex-gcc34-d.a libboost_regex-gcc34-d.so libboost_regex-gcc34-mt-1_34.a libboost_regex-gcc34-mt-1_34.so libboost_regex-gcc34-mt-1_34.so.1.34.0 libboost_regex-gcc34-mt.a libboost_regex-gcc34-mt-d-1_34.a libboost_regex-gcc34-mt-d-1_34.so libboost_regex-gcc34-mt-d-1_34.so.1.34.0 libboost_regex-gcc34-mt-d.a libboost_regex-gcc34-mt-d.so libboost_regex-gcc34-mt.so libboost_regex-gcc34.so
Also, I tried with all above *.a by stripping "lib" & .* from their name. However I can get messages like
/usr/include/boost/regex/v4/basic_regex.hpp:338: undefined reference to `boost::reg_expression
::reg_expression(std::allocator<char> const&)'
Do you think I have made some mistake during build. Following were the steps followed => gunzip boost_1_34_0.tar.gz => tar -xvf boost_1_34_0.tar => cd boost_1_34_0 => ./configure --prefix=/home/ChandanNilange/work/boost/ --with-libraries=regex => make install
Regards, Chandan
--- John Maddock
wrote: Chandan Nilange wrote:
Hello,
I have boost_1_32 version installed at /usr/include/boost Also, I have installed boost_1_34 at another path:/home/myname/work/boost/boost_1_34_0/
Now when I try to run with 1_34 version, it still points to 1_32 version at /usr/include (this is observed when I debug using gdb it refers to /usr/include/boost/regex/v4/match_results.hpp:118)
I tried following things:
1] export
LD_LIBRARY_PATH=/home/myname/work/boost/boost_1_34_0/boost:$LD_LIBRARY_PATH
export
PATH=/home/myname/work/boost/boost_1_34_0/boost:$PATH Looks right.
2] I am using following command for compilation g++ -c -g -I/home/myname/work/boost/boost_1_34_0/boost ${TEST_FILES_PATH}/${TEST}.c g++ ${TEST}.o -L/home/myname/work/boost/lib -lboost_regex Looks right: you could double check by checking the value of BOOST_VERSION in your code, and verifying that libboost_regex.so is present in /home/myname/work/boost/lib.
3] I am including boost header in ${TEST}.c as below #include "boost/regex.hpp" Also looks right.
Basically you have three things to double check:
1) Compile time, that the right headers are included. 2) Link time, that you're linking against the right library. 3) Run time, that LD_LIBRARY_PATH is set right.
Personnally if I were a better man, I'd put a bet on #2, but that's just a guess :-)
HTH, John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
____________________________________________________________________________________ Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

Chandan Nilange wrote:
Hello John,
I find following *.a *.so but no libboost_regex.so at path :/home/ChandanNilange/work/boost/lib
libboost_regex-gcc34-1_34.a libboost_regex-gcc34-1_34.so libboost_regex-gcc34-1_34.so.1.34.0 libboost_regex-gcc34.a libboost_regex-gcc34-d-1_34.a libboost_regex-gcc34-d-1_34.so libboost_regex-gcc34-d-1_34.so.1.34.0 libboost_regex-gcc34-d.a libboost_regex-gcc34-d.so libboost_regex-gcc34-mt-1_34.a libboost_regex-gcc34-mt-1_34.so libboost_regex-gcc34-mt-1_34.so.1.34.0 libboost_regex-gcc34-mt.a libboost_regex-gcc34-mt-d-1_34.a libboost_regex-gcc34-mt-d-1_34.so libboost_regex-gcc34-mt-d-1_34.so.1.34.0 libboost_regex-gcc34-mt-d.a libboost_regex-gcc34-mt-d.so libboost_regex-gcc34-mt.so libboost_regex-gcc34.so
Also, I tried with all above *.a by stripping "lib" & .* from their name. However I can get messages like
/usr/include/boost/regex/v4/basic_regex.hpp:338: undefined reference to `boost::reg_expression
reg_expression(std::allocator<char> const&)'
Do you think I have made some mistake during build. Following were the steps followed
Ah, if I remember correctly you only get a "libboost_regex.*" if you invoke bjam with --layout-system: this is primarily intended for system integrators. I've no idea why you got linker errors from the above binaries, you should be able to use -lboost_regex-gcc34 as a linker option and have it just work. John.

Hello John & Steven,
Thanks for ur help.
I was able to resolve the issue.
As per the link
http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
"All the directories named by -I are searched, in
left-to-right order, before the default directories.
The only exception is when dir is already searched by
default. In this case, the option is ignored and the
search order for system directories remains
unchanged."
Since we have "boost" directory at default
path:/usr/include/boost, it used to look
/usr/include/boost before
-I

on Mon Jul 16 2007, Chandan Nilange
Hello,
I have boost_1_32 version installed at /usr/include/boost Also, I have installed boost_1_34 at another path:/home/myname/work/boost/boost_1_34_0/
Now when I try to run with 1_34 version, it still points to 1_32 version at /usr/include (this is observed when I debug using gdb it refers to /usr/include/boost/regex/v4/match_results.hpp:118)
I tried following things:
1] export LD_LIBRARY_PATH=/home/myname/work/boost/boost_1_34_0/boost:$LD_LIBRARY_PATH
That is almost certainly not what you want. You don't see any library binaries in /home/myname/work/boost/boost_1_34_0/boost do you? You need to find the Boost 1.34 .so files and put their directory in your LD_LIBRARY_PATH. HTH, -- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
participants (5)
-
Chandan Nilange
-
David Abrahams
-
John Maddock
-
Olaf van der Spek
-
Steven Mackenzie