Alexey Fedorov
asked on
Linux Boost installing
Hi, guys!
I'm new in Linux/C++/GCC developing, so, there is a silly question: what's the right typical directory to install BOOST in?
According to http://www.boost.org/doc/libs/1_46_1/more/getting_started/unix-variants.html
it is "/usr/local/boost_1_46_1".
With best regards,
Aleksey
I'm new in Linux/C++/GCC developing, so, there is a silly question: what's the right typical directory to install BOOST in?
According to http://www.boost.org/doc/libs/1_46_1/more/getting_started/unix-variants.html
it is "/usr/local/boost_1_46_1".
With best regards,
Aleksey
Installling and building Boost from scratch can be a painful experience if you are not familiar with the process. Nearly all popular flavours of Linux distros that support package installations will include Boost as a package. Unless you need the current most up to date version (1.46) you are better off installing the latest package that is available for your distro.
ASKER
I'm on Centos 5.6 (upgraded from 5.5).
"yum search boost" shows:
My project's QuickFast library requires: BOOST V 1.36.0 or later.
So, I could install boost141 packagesm but I don't see any "debug" packages for 141.
"yum search boost" shows:
boost.i386 : The Boost C++ Libraries
boost-debuginfo.i386 : Debug information for package boost
boost-devel.i386 : The Boost C++ headers and development libraries
boost-doc.i386 : The Boost C++ html docs
boost141.i386 : The free peer-reviewed portable C++ source libraries
boost141-date-time.i386 : Runtime component of boost date-time library
boost141-devel.i386 : The Boost C++ headers and shared development libraries
boost141-doc.i386 : HTML documentation for the Boost C++ libraries
boost141-filesystem.i386 : Runtime component of boost filesystem library
boost141-graph.i386 : Runtime component of boost graph library
boost141-graph-mpich2.i386 : Runtime component of parallel boost graph library
boost141-graph-openmpi.i386 : Runtime component of parallel boost graph library
boost141-iostreams.i386 : Runtime component of boost iostreams library
boost141-math.i386 : Stub that used to contain boost math library
boost141-mpich2.i386 : Runtime component of Boost.MPI library
boost141-mpich2-devel.i386 : Shared library symlinks for Boost.MPI
boost141-mpich2-python.i386 : Python runtime component of Boost.MPI library
boost141-openmpi.i386 : Runtime component of Boost.MPI library
boost141-openmpi-devel.i386 : Shared library symlinks for Boost.MPI
boost141-openmpi-python.i386 : Python runtime component of Boost.MPI library
boost141-program-options.i386 : Runtime component of boost program_options library
boost141-python.i386 : Runtime component of boost python library
boost141-regex.i386 : Runtime component of boost regular expression library
boost141-serialization.i386 : Runtime component of boost serialization library
boost141-signals.i386 : Runtime component of boost signals and slots library
boost141-static.i386 : The Boost C++ static development libraries
boost141-system.i386 : Runtime component of boost system support library
boost141-test.i386 : Runtime component of boost test library
boost141-thread.i386 : Runtime component of boost thread library
boost141-wave.i386 : Runtime component of boost C99/C++ preprocessing library
mod_python.i386 : An embedded Python interpreter for the Apache Web server.
perl-Boost-Graph.i386 : Interface to the Boost-Graph C++ libraries
python26-mod_python.i386 : An embedded Python interpreter for the Apache HTTP Server
My project's QuickFast library requires: BOOST V 1.36.0 or later.
So, I could install boost141 packagesm but I don't see any "debug" packages for 141.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, evilrix!
For today, I decided to attempt building the boost latest version.
For today, I decided to attempt building the boost latest version.
Understood. Let me know if you run into any issues and I'll try and assist.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Great, if that now all works for you go ahead and select your last post as the solution.
ASKER
OK.
I tested only template/inline features. I'm testing library-based features (like regex) tomorrow.
I tested only template/inline features. I'm testing library-based features (like regex) tomorrow.
ASKER
I run into problems using "boost" shared libs.
1. I tried to set LD_LIBRARY_PATH under CentOS. I added custom_libs.conf into /etc/ld.so.conf.d containing /usr/local/lib - path to boost libraries. But my program was unable to find libs. Only
export /usr/local/lib helped.
2. I unable to link "boost" statically.
My HelloWorld app. links regex to test shared boost libs.
Both: libboost_regex.a and libbost_regex.so are at /usr/local/lib, but the compiller is unable to link:
3. "Debug" build with shared "boost" doesn't work, only "Release" works.
"Debug" executable fails with "segmentation fault" or
1. I tried to set LD_LIBRARY_PATH under CentOS. I added custom_libs.conf into /etc/ld.so.conf.d containing /usr/local/lib - path to boost libraries. But my program was unable to find libs. Only
export /usr/local/lib helped.
2. I unable to link "boost" statically.
g++ -c -o "Release/hello.o" -I/usr/local/boost_1_46_1 hello.cpp
g++ -c -o "Release/test.o" -I/usr/local/boost_1_46_1 test.cpp
g++ -static -L/usr/local/lib -lboost_regex -o "Release/Hello" Release/hello.o Release/test.o
My HelloWorld app. links regex to test shared boost libs.
Both: libboost_regex.a and libbost_regex.so are at /usr/local/lib, but the compiller is unable to link:
undefined reference to `boost::basic_regex<wchar_t...,
3. "Debug" build with shared "boost" doesn't work, only "Release" works.
g++ -c "-D_GLIBCXX_DEBUG" -g -ggdb3 -o "Debug/hello.o" -I/usr/local/boost_1_46_1 hello.cpp
g++ -c "-D_GLIBCXX_DEBUG" -g -ggdb3 -o "Debug/test.o" -I/usr/local/boost_1_46_1 test.cpp
g++ -g -L/usr/local/lib -lboost_regex -o "Debug/Hello" Debug/hello.o Debug/test.o
"Debug" executable fails with "segmentation fault" or
Hello: /usr/local/boost_1_46_1/boost/regex/v4/match_results.hpp:517: void boost::match_results<BidiIterator, Allocator>::set_first(BidiIterator) [with BidiIterator = const wchar_t*, Allocator = std::allocator<boost::sub_match<const wchar_t*> >]: Assertion `m_subs.size() > 2' failed.
Aborted
ASKER
Here is my test for boost shared and "include only" parts.
Debug build:
boost::regex_search(L"1238 891", matches, regEx); - fails with error shown in previous post.
boost::regex_match - fails with segmentation fault.
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
#include <boost/lambda/lambda.hpp>
#include <boost/regex.hpp>
#include <memory>
#include <list>
#include <iterator>
#include <iostream>
#include <algorithm>
#include "test.h"
typedef std::istream_iterator<int> in;
void TestBoost ()
{
boost::wregex regEx(L"^1238*");
boost::wcmatch matches;
boost::regex_search(L"1238891", matches, regEx);
wprintf(L"Matches: ");
for (int i = 0; i < matches.size(); ++i)
{
wprintf(L"[%ls:%d],", matches[ i ].str().c_str(), matches[ i ].str().length() );
}
wprintf(L"\r\n");
using namespace boost::lambda;
std::for_each(in(std::cin), in(), std::wcout << (_1 * 3) << L" ");
}
Debug build:
boost::regex_search(L"1238
boost::regex_match - fails with segmentation fault.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> "Debug" executable fails with "segmentation fault" or
Assertions only fire in debug builds, not release. The fact you have an assertion indicates a problem with your code, it does not necessarily mean there is a problem with boost. Also the fact it might segv in debug and not release is probably because the debug memory footprint is different from the release footprint and so you see different behaviour (by chance, not design).
Assertions only fire in debug builds, not release. The fact you have an assertion indicates a problem with your code, it does not necessarily mean there is a problem with boost. Also the fact it might segv in debug and not release is probably because the debug memory footprint is different from the release footprint and so you see different behaviour (by chance, not design).
ASKER
Hi, evilrix! Excuse me for the daly: I had to switch hardly to a regular work related to Windows :-) Soon I'm returning back. I haven't got a shance to try yours suggestions yet, but I do it soon. The main problem it seems: I haven't built debug boost libs, so the debug program code is linked to release boost leading to "segmentation fault". I faced the same problem trying to make a debug build with CRT code (glibc, atdc, etc...) in order to step into libs (into "printf", for example). Static build was perfect: it worked and I was able to step into CRT-libs, but dynamic build crushed with "segmentation fault" inside of CRT function "atexit". It was because during execution release glibc was loded instead of debug.
P.S.
Formerly, I increased the Q. points up to 500 :-)
P.S.
Formerly, I increased the Q. points up to 500 :-)
ASKER
The solution is a quick recipe: it doesn't build debug libraries.