English 中文(简体)
Error when im trying to convert cpp with std includes using Emscripten
原标题:
  • 时间:2012-05-09 13:35:45
  •  标签:
  • emscripten

When i try to use emcc to convert the following code :

#include <iostream>
int main()
{
  std::cout << "hello, world!" << std::endl;
  return 0;
}

I get this error :

Traceback (most recent call last):
  File "./emcc", line 797, in <module>
    extra_files_to_link.append(shared.Cache.get(name, create))
  File "/home/user/emscripten/tools/shared.py", line 879, in get
    shutil.copyfile(creator(), cachename)
  File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src,  rb ) as fsrc:
IOError: [Errno 2] No such file or directory:  /tmp/emscripten_temp_MVh5qU/libcxx/libcxx.bc 

I can convert any source that dont use std. I can generate the bytecode of the example above using clang and execute with lli.

I tried in two different machines(Linux 64) and had the same error.

Can someone help me to avoid this error?

问题回答

It s been a while since the question was asked, but just to make remarks.

It does work on my osx 10.6.8, llvm 3.1 build from brew.

Only, the output of the 6 line code is about 113k lines and takes 4.8 MB space :)
The output for the tests/hello_world.cpp in emscripten source code is 2200 lines.





相关问题
Emcc compiling c++ files not compiling correctly

I used to have this: void extra(int x){ printf("Here s your number: %d ", x); } EXTERN EMSCRIPTEN_KEEPALIVE void myFunction(int x){ extra(x); } With a number input field and a ...

Unable to compile/build rust to wasm, when dependency uses C

One of my rust dependency is zip, which uses a C library to compile. When I try to compile using wasm-pack, it throws an error saying that clang cannot find the header files. I am able to compile ...

Enabling C++ linkage for Emscripten compilation

EDIT: the linkage is for the #include directives for the .h files. I figured out that the error occurs when the same #include statements is declared twice in different .cpp files. I m trying to use ...

热门标签