boost库编译

查看boost版本

dpkg -s libboost-dev | grep 'Version'
or
cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"

编译 1.64 版

// 这里的东西可能需要,目前还没需要,这里为什么会有 libboost-all-dev 不确定
sudo apt-get update
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev

Download source file from: http://www.boost.org/users/history/version_1_64_0.html
tar -xzvf boost_1_64_0.tar.gz
cd boost_1_64_0
./bootstrap.sh --prefix=/usr/local
./b2
./b2 install

编译 1.41 版

支持 thread 库编译

在下面文件中查找 TIME_UTC 修改为 TIME_UTC_ 防止冲突

boost_1_41_0/boost/thread/xtime.hpp
boost_1_41_0/libs/thread/src/pthread/timeconv.inl
找到下面文件 修改对应行 #ifdef __GLIBCXX__ // gcc 3.4 and greater:
boost_1_41_0/boost/config/stdlib/libstdcpp3.hpp

#ifdef __GLIBCXX__ // gcc 3.4 and greater:
# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
|| defined(_GLIBCXX__PTHREADS) \
|| defined(_GLIBCXX_HAS_GTHREADS)

修改一个 GCC 错误提示

找到 unspecified_bool_type() 添加上面两行
/Users/zhengjun/project/boost_1_41_0/boost/exception_ptr.hpp

~exception_ptr() throw() { }

operator unspecified_bool_type() const
{
return _empty() ? 0 : &exception_ptr::bad_alloc_;
}

编译

./bootstrap.sh
./bjam install