[SOLVED][WebGL] llvm-config error: libgtest.a missing from fastcomp's libraries


#1

Hi,

I would like to run the example from_mxnet_to_webgl.py, I have installed emscripten from the sdk (which comes with fastcomp), when running the example I get the error:

Loading pretrained resnet model from MXNet...
- Model loaded!
Compiling the neural network...
[11:23:05] /home/SERILOCAL/n.perto/Documents/tvm/src/runtime/opengl/opengl_device_api.cc:227: OpenGL initialized, version = 4.3 (Core Profile) Mesa 17.2.8
Traceback (most recent call last):
  File "from_mxnet_to_webgl.py", line 515, in <module>
    deploy_web()
  File "from_mxnet_to_webgl.py", line 462, in deploy_web
    params=params)
  File "from_mxnet_to_webgl.py", line 243, in compile_net
    params=params)
  File "/home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/compiler/build_module.py", line 321, in build
    graph = graph.apply("GraphCompile")
  File "/home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/graph.py", line 250, in apply
    check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
  File "/home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/_base.py", line 91, in check_call
    raise NNVMError(py_str(_LIB.NNGetLastError()))
nnvm._base.NNVMError: TVMError: Check failed: allow_null: No available targets are compatible with this triple. target_triple=asmjs-unknown-emscripten
Stack trace:
  File "/home/SERILOCAL/n.perto/Documents/tvm/src/codegen/llvm/llvm_common.cc", line 162
  [bt] (0) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(+0x8eff6d) [0x7f7200ff7f6d]
  [bt] (1) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(+0x8e6ad5) [0x7f7200feead5]
  [bt] (2) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(+0x8e529b) [0x7f7200fed29b]
  [bt] (3) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(+0x274f6e) [0x7f720097cf6e]
  [bt] (4) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(+0x195158) [0x7f720089d158]
  [bt] (5) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(TVMFuncCall+0x61) [0x7f720101f001]
    raise get_last_ffi_error()
  File "/home/SERILOCAL/n.perto/Documents/tvm/python/tvm/_ffi/_ctypes/function.py", line 206, in __call__
    return _Build(lowered_func, target)
  File "/home/SERILOCAL/n.perto/Documents/tvm/python/tvm/codegen.py", line 36, in build_module
    mhost = codegen.build_module(fhost_all, str(target_host))
  File "/home/SERILOCAL/n.perto/Documents/tvm/python/tvm/build_module.py", line 623, in build
    return tvm.build(funcs, target=target, target_host=target_host)
  File "/home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/compiler/build_module.py", line 140, in _build
    rv = local_pyfunc(*pyargs)
  File "/home/SERILOCAL/n.perto/Documents/tvm/python/tvm/_ffi/_ctypes/function.py", line 71, in cfun
Stack trace:
  [bt] (0) /home/SERILOCAL/n.perto/Documents/tvm/build/libtvm.so(+0x913b7b) [0x7f720101bb7b]
  [bt] (1) /home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/../../lib/libnnvm_compiler.so(nnvm::compiler::GraphCompile(nnvm::Graph const&)+0x28bd) [0x7f71fa47e08d]
  [bt] (2) /home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/../../lib/libnnvm_compiler.so(std::_Function_handler<nnvm::Graph (nnvm::Graph), nnvm::Graph (*)(nnvm::Graph const&)>::_M_invoke(std::_Any_data const&, nnvm::Graph&&)+0x20) [0x7f71fa4788b0]
  [bt] (3) /home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/../../lib/libnnvm_compiler.so(nnvm::ApplyPasses(nnvm::Graph, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)+0x32b) [0x7f71fa4ab95b]
  [bt] (4) /home/SERILOCAL/n.perto/Documents/tvm/nnvm/python/nnvm/../../lib/libnnvm_compiler.so(NNGraphApplyPasses+0x348) [0x7f71fa4a1ef8]
  [bt] (5) /home/SERILOCAL/n.perto/.anaconda3/envs/tf/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f72030abec0]
  [bt] (6) /home/SERILOCAL/n.perto/.anaconda3/envs/tf/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f72030ab87d]
  [bt] (7) /home/SERILOCAL/n.perto/.anaconda3/envs/tf/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce) [0x7f7205c12ede]
  [bt] (8) /home/SERILOCAL/n.perto/.anaconda3/envs/tf/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(+0x13915) [0x7f7205c13915]

I am not sure how fastcomp tight integration (as said on their website) work, maybe I should do some more configuration, it could also be that the example is outdated.
I installed emscripten with emsdk and sourced the environment script.
In any case, I have not managed to figure out how to do the compilation and your help is welcome.

Thank you.


#2

Please excuse me for not having seen the Readme explaining how to enable the target.

I still have a problem though, I did all the steps of the Readme and I have llvm-conf error, libgtest.a and libgtest_main.a are missing from fastcomp lib directory.
The error comes when trying to recompile TVM or even just running a make clean.
What do I have to do in order to get those libraries?


#3

Ok, found it, I needed to install emscripten sdk with --build-tests.
Following those instructions for installing WebGL runtime, that means running:

...
./emsdk install latest --build-tests
...
./emsdk install clang-incoming-64bit --build-tests
...