2017-08-04 4 views
0

私はgithubからこれらの指示に従ってクローンを作成し、ブーストライブラリを構築しました。私はブーストを構築しました。出力は私のデスクトップにあります。

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

./b2コマンドの終わりに私

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を使用して現在の場所から使用します。ブースト(およびその他のサードパーティのライブラリ)を構築するための


もう一つの方法は、それが別のディレクトリにインストールされていることであり、例えばバージョン付きのディレクトリを持つ/usr/local/usr/local/boost-1.60.0bashで次のコマンドを実行します/usr/local/boost-1.60.0にブーストを構築するには

$ 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ディレクトリにそれらを見つけることを確認します。その後、

そして、あなたはちょうど建てブーストを使用してアプリケーションbuilingときは、次のフラグを使用します。コンパイルするための

  • フラグ(CPPFLAGS):-I/usr/local/boost-1.60.0/includeを。
  • リンクのフラグ(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

関連する問題