BOOST_BUILD_PATH指定错误
BOOST_BUILD_PATH为Boost.Build根目录的绝对路径,bjam运行是会查找该绝对路径下的一些文件。在下载得到源代码解压之后,源码目录 ROOT/boost_1_55_0/,构建Boost.Build,进入ROOT/boost_1_55_0/tools/build/v2,然后
$ROOT/boost_1_55_0/tools/build/v2$ ./bootstrap.sh
Bootstrapping the build engine with toolset gcc... engine/bin.linuxx86_64/b2
Bootstrapping is done. To build and install, run:
./b2 install --prefix=<DIR>
$ROOT/boost_1_55_0/tools/build/v2$ ./b2 install --prefix=./install
...found 578 targets...
...updating 2 targets...
common.copy install/bin/b2
common.copy install/bin/bjam
...updated 2 targets...
然后将BOOST_BUILD_PATH指定为:
BOOST_BUILD_PATH=$ROOT/boost_1_55_0/tools/build/v2/install/share/boost-build/kernel
开始没有指对这个目录,导致bjam运行时会提示某些文件查找不到,更细节需要了解bjam启动过程时加载各个文件的规则。
总是报”undefined reference to `google::LogMessage::stream()”?
知道原因是lib中没有查找到,但是在构建中确实已经使用连接了静态的libglog.a,后来发现libglog的头文件的版本和使用libglog.a的版本不一致导致的,拿到源码时,源码中已经预先编译好了编译源码需要static库。而自己有下载了一份glog源码,编译并安装了头文件。后来替换了libglog.a就解决了这个问题。
出现了下面的链接报错
/usr/bin/ld: libs/X86_64/libglog.a(libglog_la-logging.o): relocation R_X86_64_32S against `_ZTVN6google4base6LoggerE' can not be used when making a shared object; recompile with -fPIC
libs/X86_64/libglog.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
只能安装错误提供的方法重现编译libglog.a了,然后,替换了libglog.
CXXFLAGS="-O3 -fPIC" ./configure --prefix=glog-0.3.3/install
设置的一些环境变量
declare -x BOOST_BUILD_PATH="$ROOT/boost_1_55_0/tools/build/v2/"
declare -x CPLUS_INCLUDE_PATH="$ROOT/glog-0.3.3/install/include:$ROOT/protobuf-2.4.1/install/include"
declare -x GMOCK_DIR="$ROOT/gmock-1.6.0"