Closed warrenseine closed 10 years ago
We should document this better, sorry for the confusion. What is happening is that fastcomp also has a new target, but that is not in the stock 3.3 builds. You can however both disable fastcomp and use the old target, with
EMCC_FAST_COMPILER=0 EMCC_LLVM_TARGET=le32-unknown-nacl emcc [..]
On second thought, we should just use the old triple when fastcomp is disabled. So you should not need to change the triple as well when disabling it. I'll make that change now.
Thanks for filing this, somehow I missed this particular case.
Pushed.
Using emscripten-1.38.27
and still getting this error when compiling a simple "hello-world.cc" file as in this example:
https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html
I am using Bazel and created an emcc.sh
file that do the follows:
"#!/bin/bash
set -euo pipefail
export LLVM_ROOT='external/emscripten_clang' export EMSCRIPTEN_NATIVE_OPTIMIZER='external/emscripten_clang/optimizer' export BINARYEN_ROOT='external/emscripten_clang/' export NODE_JS='' export EMSCRIPTEN_ROOT='external/emscripten_toolchain' export SPIDERMONKEY_ENGINE='' export EM_EXCLUSIVE_CACHE_ACCESS=1 export EMCC_SKIP_SANITY_CHECK=1 export EMCC_WASM_BACKEND=0 export EM_BUILD_VERBOSE=3
python external/emscripten_toolchain/emcc.py "$@"
find . -name "*.d" -exec sed -i '2d' {} \;"
Can you print the full command line and the full output?
The first thing I would do is remove EMCC_SKIP_SANITY_CHECK
. By settings this you are skipping over the check the emscripten does on the version of llvm you have in external/emscripten_clang
. Most likely you have the wrong version there.
You can also remove EMCC_WASM_BACKEND and EMSCRIPTEN_ROOT (the former is a internal-only setting, the latter is completely ignored).
Of course, and thanks for your reply! Command line is bazel's build command: "bazel build --sandbox_debug --verbose_failures --spawn_strategy=standalone --crosstool_top=//toolchain:emscripten --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=asmjs //:helloworld.js"
And this is the output: "ERROR: /home/tsvi/IOTA_DEV/entangled/BUILD:6:1: C++ compilation of rule '//:helloworld.js' failed (Exit 1): emcc.sh failed: error executing command (cd /home/tsvi/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/execroot/org_iota_entangled && \ exec env - \ PATH=/home/tsvi/.local/share/umake/bin:/home/tsvi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/tsvi/go:/home/tsvi/go/bin:/home/tsvi/.go/bin \ PWD=/proc/self/cwd \ toolchain/emcc.sh -MD -MF bazel-out/asmjs-fastbuild/bin/_objs/helloworld.js/hello-world.d '-frandom-seed=bazel-out/asmjs-fastbuild/bin/_objs/helloworld.js/hello-world.o' -iquote . -iquote bazel-out/asmjs-fastbuild/genfiles -iquote bazel-out/asmjs-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/asmjs-fastbuild/genfiles/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 '-std=c++1z' -c hello-world.cc -o bazel-out/asmjs-fastbuild/bin/_objs/helloworld.js/hello-world.o) Execution platform: @bazel_tools//platforms:host_platform error: unknown target triple 'asmjs-unknown-emscripten', please use -triple or -arch shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting Target //:helloworld.js failed to build"
Removing both EMSCRIPTEN_ROOT
and EMCC_WASM_BACKEND
indeed does not change the output,
The key error here is fastcomp in use, but LLVM has not been built with the JavaScript backend as a target, llc reports: llc reports: (no targets could be identified: [Errno 2] No such file or directory)
This means its having trouble running llc from external/emscripten_clang/llc
.. does this file exist? We should probably make the error nicer when it can't find llc at all.
Seems like this binary file exists under:
/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/external/emscripten_clang
Ok, when removing EMCC_SKIP_SANITY_CHECK
i get:
"WARNING:root:LLVM version appears incorrect (seeing "6.0", expected "4.0") INFO:root:Blocking on process 15373: ['/usr/bin/nodejs', '/home/tsvi/.cache/bazel/_bazel_tsvi/9194043dbd55a599c9568f5a8b5663c8/external/emscripten_toolchain/src/hello_world.js'] until it finishes. INFO:root:Process 15373 finished after 0.0422451496124 seconds. Exit code: 0 CRITICAL:root:fastcomp in use, but LLVM has not been built with the JavaScript backend as a target, llc reports: (no targets could be identified: [Errno 2] No such file or directory) CRITICAL:root:you can fall back to the older (pre-fastcomp) compiler core, although that is not recommended, see http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html INFO:root:(Emscripten: Running sanity checks) CRITICAL:root:Cannot find /usr/bin/llvm-link, check the paths in ~/.emscripten " how do i fix that?"
I see several problems here.
Firstly: LLVM version appears incorrect (seeing "6.0", expected "4.0")
. The seems very suspicious. Emscripen has been expecting version 6.0 of llvm for a long time. This makes me think you might be using a very old version of emscripten. Looks like 1.37.29 was the last version to use llvm 4.0.
Secondly llc cannot be found: (no targets could be identified: [Errno 2] No such file or directory)
. It tried to discover if was built with JS support by running llc --version
but the binary was found.
Check your emscripten version, check your llvm version and check your LLVM_ROOT.
Also, BINARYEN_ROOT and LLVM_ROOT don't normally do any thing in the environment. Those are names of the config settings.
In the default-generated .emscripten file they can be overridden using BINARYEN and LLVM in the environment.. but I don't know that your config file look like. You might be better off setting all those value directly in the config rather than trying to use env vars.
So it's checking llvm-link
in usr/bin
though i do this:
export LLVM_ROOT='external/emscripten_clang'
emscripten versions are 1.37.22
for both clang and toolchain,
global llvm is 6.0
After using emscripten 1.38.31
I get only this:
shared:CRITICAL: fastcomp in use, but LLVM has not been built with the JavaScript backend as a target, llc reports: (no targets could be identified: [Errno 2] No such file or directory)
I recommend setting LLVM_ROOT
in the emscripten config file. Setting that in the environment does not work (unless you have code in your config file that reads it out of the environment).
Thanks, that seem to help, Now i get this when Linking:
emcc:WARNING: ignoring unsupported linker flag:
-S system_libs:WARNING: retrieving port: binaryen from https://github.com/WebAssembly/binaryen/archive/version_82.zip system_libs:WARNING: unpacking port: binaryen cache:INFO: generating port: binaryen_tag_version_82.txt... (this will be cached in "/home/tsvi/.emscripten_cache/asmjs/binaryen_tag_version_82.txt" for subsequent builds) root:INFO: building port: binaryen shared:ERROR: 'cmake -DCMAKE_BUILD_TYPE=Release .' failed: [Errno 2] No such file or directory system_libs:ERROR: a problem occurred when using an emscripten-ports library. try to run
emcc --clear-portsand then run this command again Target //:helloworld.js failed to build
Looks like you are missing a cmake
installation.
If you are using emsdk then it shouldn't be building binaryen from source. If you are not using emsdk then you can build binaryen yourself and set BINARYEN_ROOT
in your config.. or you can let it be auto-compiled. Either way you need cmake installed if you want to build it.
Thanks again, cmake installed,
now i get this error from running the emcc.py
script:
emcc:WARNING: ignoring unsupported linker flag: -S
Traceback (most recent call last):
File "external/emscripten_toolchain/emcc.py", line 3308, in
Also, running emcc -version
yields:
"cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/home/tsvi/.emscripten_cache/is_vanilla.txt" for subsequent builds) cache:INFO: - ok shared:ERROR: 'external/emscripten_clang/clang++ --version' failed: [Errno 2] No such file or directory"
Well, in any case, configuration problem is solved by fixing paths of BINARYEN_ROOT
and LLVM_ROOT
, but still remain to be solved,
if i am trying to compile an hello-world example that includes
Well, in any case, configuration problem is solved by fixing paths of
BINARYEN_ROOT
andLLVM_ROOT
, but still remain to be solved, if i am trying to compile an hello-world example that includes , i get: "external/emscripten_toolchain/system/include/libcxx/__locale:418:32: error: use of undeclared identifier '_CTYPE_R' "
I am following the tutorial too, this is due to the flag_groups are not properly set. I tried this flag_groups from tensorflow tfjs and it worked for me.
toolchain_include_directories_feature = feature(
name = "toolchain_include_directories",
enabled = True,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = [
flag_group(
flags = [
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/include/libcxx",
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/lib/libcxxabi/include",
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/include/compat",
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/include",
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/include/libc",
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten",
"-isystem",
"external/emsdk/emsdk/upstream/emscripten/system/local/include",
],
),
],
),
],
)
This error just appeared on code that used to work, I guess this is related to fastcomp being enabled by default.
I'm using:
incoming
(e2d05d569d7848d15ddd956e5c456d81f7bf9292)EMCC_FAST_COMPILER=0
Should I use custom LLVM builds even if I don't need fastcomp?