2017-08-04 58 views
0

我按照github的这些说明来克隆和构建boost库。我刚刚建立提升 - 而输出是坐在我的桌面上

https://github.com/boostorg/boost/wiki/Getting-Started

./b2命令最后告诉我

的Boost C++库已成功建立!

The following directory should be added to compiler include paths: 

    /home/user/Desktop/boost 

The following directory should be added to linker library paths: 

    /home/user/Desktop/boost/stage/lib 

我应该如何处理这些文件夹?我想在“为了让gcc看到它而应该去的正常位置”提升。

这可能是/usr/include?将我的文件夹boost移到这个位置安全吗? boost/stage/lib文件夹怎么样?这个去哪了?

gcc -v /dev/null -o /dev/null 

Using built-in specs. 
COLLECT_GCC=gcc 
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper 
Target: x86_64-redhat-linux 
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 
Thread model: posix 
gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/:/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/6.3.1/:/usr/lib/gcc/x86_64-redhat-linux/ 
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/6.3.1/:/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../:/lib/:/usr/lib/ 
COLLECT_GCC_OPTIONS='-v' '-o' '/dev/null' '-mtune=generic' '-march=x86-64' 
/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/6.3.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/cce2dq2i.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /dev/null /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1 -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../.. /dev/null -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtend.o /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crtn.o 
/dev/null: file not recognized: File truncated 
collect2: error: ld returned 1 exit status 

回答

0

我想提出推动在“正规的地方,应该以去GCC看看吧”。

对于gcc运行cpp -v /dev/null -o /dev/null。在它的输出中包含搜索目录和带有库搜索目录列表的LIBRARY_PATH。这些是定期的地方。将标题和库复制到常规位置通常需要root权限。

或者,在编译时使用-I/home/user/Desktop/boost额外的命令行选项,当链接使用当前位置时使用-L/home/user/Desktop/boost/stage/lib -Wl,-rpath=/home/user/Desktop/boost/stage/lib


构建boost(和其他第三方库)的另一种方法是将其安装在单独的目录中,例如, /usr/local带有版本化的目录,例如/usr/local/boost-1.60.0

打造提升到/usr/local/boost-1.60.0执行以下命令在bash

$ cd boost-1.60.0 # The directory with boost sources. 
$ JOBS=8 
$ PREFIX=/usr/local/boost-1.60.0 
$ mkdir -p ${PREFIX} 
$ ./bootstrap.sh --prefix=${PREFIX} --libdir=${PREFIX}/lib64 
$ B2FLAGS="-j${JOBS} --layout=system --disable-icu variant=release link=shared threading=multi runtime-link=shared linkflags=-Wl,-rpath,${PREFIX}/lib64 boost.locale.icu=off boost.locale.iconv=on" 
$ ./b2 ${B2FLAGS} 
$ ./b2 ${B2FLAGS} install 

linkflags=-Wl,-rpath,${PREFIX}/lib64位可以确保当您运行依赖于其他升压共享库的应用升压共享库,发现他们在${PREFIX}/lib64目录。编译(CPPFLAGS

  • 标志:-I/usr/local/boost-1.60.0/include

    然后builing当提升你的应用程序,你刚刚建成使用下面的选项。

  • 用于链接的标志(LDFLAGS):-L/usr/local/boost-1.60.0/lib64 -Wl,-rpath=/usr/local/boost-1.60.0/lib64
+0

输出没有告诉我任何关于在哪放置'lib'目录? – user3728501

+0

@ user3728501显示输出(在您的问题中)。 –

+0

我现在已经完成了这个 – user3728501

相关问题