Сборка веб-сборки с базелем и emscripten - PullRequest
0 голосов
/ 12 июня 2019

Я пытался создать простой c ++ в веб-сборке с Bazel, следуя документу от bazel , но мне не удалось заставить его работать.

Все работает хорошо, bazel удается загрузить пакеты emscripten, запустить сборку и вдруг говорит, что не может найти источники ...

Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Analyzing: target //main:helloworld (1 packages loaded, 0 targets configured)
Analyzing: target //main:helloworld (5 packages loaded, 16 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
INFO: SHA256 (https://github.com/kripken/emscripten/archive/1.37.22.tar.gz) = 433dedb63ba423cf04bbc9802b49fa842bd479bad31a339db9506614e92334c7
Analyzing: target //main:helloworld (11 packages loaded, 59 targets configured)
DEBUG: Rule 'emscripten_toolchain' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "433dedb63ba423cf04bbc9802b49fa842bd479bad31a339db9506614e92334c7"
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
INFO: SHA256 (https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/linux_64bit/emscripten-llvm-e1.37.22.tar.gz) = fd457ebfbe5a727058880ff55cdabf7f1b7809aea07957d2cc854e7de3001ef3
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
Analyzing: target //main:helloworld (12 packages loaded, 59 targets configured)
DEBUG: Rule 'emscripten_clang' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "fd457ebfbe5a727058880ff55cdabf7f1b7809aea07957d2cc854e7de3001ef3"
INFO: Analyzed target //main:helloworld (13 packages loaded, 7624 targets configured).
INFO: Found 1 target...
[0 / 3] [Prepa] Creating source manifest for //main:helloworld ... (2 actions, 0 running)
[0 / 3] [Prepa] Creating source manifest for //main:helloworld ... (2 actions, 0 running)
[3 / 5] checking cached actions
ERROR: /usr/src/app/main/BUILD:1:1: undeclared inclusion(s) in rule '//main:helloworld':
this rule is missing dependency declarations for the following files included by 'main/hello-world.cc':
  '/usr/src/app/main/hello-world.cc'
DEBUG:root:PYTHON not defined in /root/.emscripten, using "/usr/bin/python"
DEBUG:root:EMCC_WASM_BACKEND tells us to use wasm backend
WARNING:root:invocation: external/emscripten_toolchain/emcc.py -MD -MF bazel-out/asmjs-fastbuild/bin/main/_objs/helloworld/hello-world.d -frandom-seed=bazel-out/asmjs-fastbuild/bin/main/_objs/helloworld/hello-world.o -iquote . -iquote bazel-out/asmjs-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/asmjs-fastbuild/bin/external/bazel_tools -isystem external/emscripten_toolchain/system/include/libcxx -isystem external/emscripten_toolchain/system/include/libc -c main/hello-world.cc -o bazel-out/asmjs-fastbuild/bin/main/_objs/helloworld/hello-world.o  (in /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/sandbox/processwrapper-sandbox/1/execroot/__main__)
DEBUG:root:compiling to bitcode
DEBUG:root:emcc step "parse arguments and setup" took 0.00 seconds
DEBUG:root:compiling source file: /usr/src/app/main/hello-world.cc
DEBUG:root:running: /root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_clang/clang++ -target wasm32-unknown-unknown -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=37 -D__EMSCRIPTEN_tiny__=22 -D_LIBCPP_ABI_VERSION=2 -D__EMSCRIPTEN__ -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -nostdinc -Xclang -nobuiltininc -Xclang -nostdsysteminc -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/include/libcxx -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/lib/libcxxabi/include -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/include/compat -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/include -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/include/SSE -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/include/libc -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/lib/libc/musl/arch/emscripten -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/local/include -MD -MF bazel-out/asmjs-fastbuild/bin/main/_objs/helloworld/hello-world.d -frandom-seed=bazel-out/asmjs-fastbuild/bin/main/_objs/helloworld/hello-world.o -iquote . -iquote bazel-out/asmjs-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/asmjs-fastbuild/bin/external/bazel_tools -isystem external/emscripten_toolchain/system/include/libcxx -isystem external/emscripten_toolchain/system/include/libc -c -std=c++03 /usr/src/app/main/hello-world.cc -Xclang -isystem/root/.cache/bazel/_bazel_root/a14564dce24fc232216f1aef117728d1/external/emscripten_toolchain/system/include/SDL -emit-llvm -c -o bazel-out/asmjs-fastbuild/bin/main/_objs/helloworld/hello-world.o
DEBUG:root:emcc step "bitcodeize inputs" took 0.01 seconds
DEBUG:root:stopping at bitcode
Target //main:helloworld failed to build
INFO: Elapsed time: 60.763s, Critical Path: 0.67s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Я завернул все в репозиторий github , и вы можете воспроизвести это (если у вас установлен докер), выполнив

git clone https://github.com/jdrouet/bazel-emscripten-test.git
cd bazel-emscripten-test
docker build .

Если у вас есть идеи о том, почему это не работает, заранее спасибо!

...