2017-07-22 15 views
2

Boostライブラリをローカルに構築しようとしていて、自分のプロジェクトでlocal_repositoryとして使用したいと考えています。私はこれを参考にしています(https://github.com/nelhage/rules_boost)。BazelビルドでローカルにBoostコンポーネントをビルドできません

boost/   // root of the boost project 
    | 
    bazel/ 
    | | 
    | boost.bzl // contains "boost_library" function from https://github.com/nelhage/rules_boost/blob/master/boost/boost.bzl 
    | | 
    | BUILD  // empty 
    boost/  // the original boost headers folder from original boost dist 
    | 
    lib/   // the original boost sources folder from original boost dist 
    | 
    BUILD 
    | 
    WORKSPACE 

BUILDファイルはこの1つのようになります:私はこのようなディレクトリツリーを持っている 適切boost.bzl

WORKSPACEをロードすると

https://github.com/nelhage/rules_boost/blob/master/BUILD.boost だけです:

ワークスペース(名前= "ブースト")

問題:

は、今私は(bazel build //:<component>)の個々のコンポーネントを構築しようとしています。 コンポーネント(Boost.ContainerBoost.Test)のいくつかは、同様の理由で(ヘッダーファイルが見つからない)ビルドに失敗しています。

bazel build //:container            1 ↵ 
INFO: Found 1 target... 
ERROR: /home/spyder/codebase/boost/BUILD:103:1: C++ compilation of rule '//:container' failed: Process exited with status 1 [sandboxed]. 
libs/container/src/global_resource.cpp:12:51: fatal error: boost/container/pmr/memory_resource.hpp: No such file or directory 
compilation terminated. 
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions. 
Target //:container failed to build 
Use --verbose_failures to see the command lines of failed build steps. 
INFO: Elapsed time: 0.519s, Critical Path: 0.18s 


bazel build //:test              1 ↵ 
INFO: Found 1 target... 
ERROR: /home/spyder/codebase/boost/BUILD:581:1: C++ compilation of rule '//:test' failed: Process exited with status 1 [sandboxed]. 
libs/test/src/junit_log_formatter.cpp:11:51: fatal error: boost/test/impl/junit_log_formatter.ipp: No such file or directory 
compilation terminated. 
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions. 
Target //:test failed to build 
Use --verbose_failures to see the command lines of failed build steps. 
INFO: Elapsed time: 1.027s, Critical Path: 0.82s 

私はそれを修正する上で私を導くことができますか?

EDIT:

Iもbazel query --output=build //:containerによって膨張cc_libraryルールを照会しようとした、非常に驚​​くほどこの

cc_library(
    name = "container", 
    visibility = ["//visibility:public"], 
    generator_name = "container", 
    generator_function = "boost_library", 
    generator_location = "/home/spyder/codebase/boost/BUILD:103", 
    licenses = ["notice"], 
    deps = ["//:config", "//:core", "//:intrusive", "//:move"], 
    defines = [], 
    includes = ["boost/container/"], 
    copts = ["-Wno-unused-value"], 
    srcs = ["//:libs/container/src/alloc_lib.c", "//:libs/container/src/dlmalloc.cpp", "//:libs/container/src/dlmalloc_2_8_6.c", "//:libs/container/src/dlmalloc_ext_2_8_6.c", "//:libs/container/src/global_resource.cpp", "//:libs/container/src/monotonic_buffer_resource.cpp", "//:libs/container/src/pool_resource.cpp", "//:libs/container/src/synchronized_pool_resource.cpp", "//:libs/container/src/unsynchronized_pool_resource.cpp"], 
    hdrs = [ ....... , "//:boost/container/pmr/map.hpp", "//:boost/container/pmr/memory_resource.hpp", "//:boost/container/pmr/monotonic_buffer_resource.hpp", "//:boost/container/pmr/polymorphic_allocator.hpp", ........ ], 
) 

、不満されたソースファイル(libs/container/src/global_resource.cpp)とヘッダを持って(boost/container/pmr/memory_resource.hpp)について苦情を申し立てている人は、両方ともsrcshdrsのリストに正しく含まれています。

答えて

0

私はあなたのルールで少しプレイしました。私が見る最大の問題は、不完全な依存関係です。例えば、私は試みました:アルゴリズムのコンポーネントであり、それは依存する必要があります:タプル。私はすべての依存関係が正しく設定されていることを確認する必要があると思います。

私はコンテナでもっと演奏しました。私が遭遇した問題には、dirsが含まれています。 -sフラグを付けてビルドを実行すると、bazelはすべてのコマンドラインを出力するので、それらを調べ、-isystemフラグにboost/container/...を含むディレクトリが含まれていることを確認できます。何がbazelフラグ--sandbox_debugでもあり、サンドボックスディレクトリが削除されないようにして、どのファイルがどこにあるのかを知ることができ、bazelを使わずにコンパイラの呼び出しを再現することもできます。

最後に、bazelは.ippヘッダ拡張子をまだ理解していません(tbh私はこれまで聞いたことがありませんが、私はブーストについては何も知らない)。私はこれを紹介する飛行機に変更があります。

+0

はい、すべての依存関係が正しく設定されています。 Boost.Containerの個々の依存関係を構築すると、彼らは絶対にうまく構築されます。エラーは 'Boost.Container'のソースとヘッダーからのみ発生します。さらに、 'bazel query --output = build //:container'を使って' //:container'に問い合わせて、そのヘッダが実際に 'hdrs'リストにあることを知りました。私はそれを問題にしています。 –

+0

さらに詳しい情報を追加しました。 –

+0

さらなる発見で答えを編集しました。 – mhlopko

関連する問題