Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building tutorial with emscripten doesn't work #8602

Closed
jdrouet opened this issue Jun 11, 2019 · 3 comments
Closed

Building tutorial with emscripten doesn't work #8602

jdrouet opened this issue Jun 11, 2019 · 3 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules

Comments

@jdrouet
Copy link

jdrouet commented Jun 11, 2019

Description of the problem / feature request:

The example with emscripten doesn't work.
I've tried to implement the tutorial about how to use bazel with emscripten and build it in a Docker container, but it looks like it doesn't work.
I created a repo here and it's building on circleci here.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

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

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

release 0.26.1

Have you found anything relevant by searching the web?

https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html

Any other information, logs, or outputs that you want to share?

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
@jdrouet jdrouet changed the title undeclared inclusion(s) in rule '//main:helloworld' Building tutorial with emscripten doesn't work Jun 11, 2019
@jin jin added team-Rules-CPP Issues for C++ rules untriaged labels Jun 14, 2019
@scentini scentini added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Jun 17, 2019
@scentini scentini self-assigned this Jun 17, 2019
@jeromewu
Copy link

jeromewu commented Jul 4, 2019

@scentini I got the same issue here, is there any way/direction I can help to resolve this issue?

Right now I am trying to figure out why hello-world.cc is under undeclared inclusion(s) with absolute path, but not too much findings so far.

@teoxoy
Copy link

teoxoy commented Oct 15, 2019

I would recommend you guys check out tensorflow's implementation of the wasm toolchain:
tensorflow/tfjs@5e99fbd

Using the tutorial and the commit as guidelines I manged to get everything working.

I might also link my own implementation as soon as I'm done with the bazel setup for the whole repo.

@StevenSYT
Copy link

I would recommend you guys check out tensorflow's implementation of the wasm toolchain:
tensorflow/tfjs@5e99fbd

Using the tutorial and the commit as guidelines I manged to get everything working.

I might also link my own implementation as soon as I'm done with the bazel setup for the whole repo.

Thanks for the sharing, tfjs's toolchain is really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

No branches or pull requests

7 participants