emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3.01k stars 687 forks source link

the error occured when emsdk used to build canvaskit? #555

Closed yzg-github closed 4 years ago

yzg-github commented 4 years ago

hi@Alon Zakai when i build skia canvaskit with emsdk in ./emsdk install latest ./emsdk activate latest or ./emsdk install 1.38.31 ./emsdk activate 1.38.31 the error occured Traceback (most recent call last): File "/opt/pro/emsdk/emscripten/1.38.31/emcc", line 6, in from tools import python_selector ImportError: No module named tools Traceback (most recent call last): File "/opt/pro/skia/gn/is_clang.py", line 14, in if (b'clang' in subprocess.check_output('%s --version' % cc, shell=True) and File "/usr/lib/python2.7/subprocess.py", line 573, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '/opt/pro/emsdk/emscripten/1.38.31/emcc --version' returned non-zero exit status 1 what should i do to solve this error? How did the error happened?

sbc100 commented 4 years ago

1.38.31 is a very old version of emscripten. Can you run ./emsdk update or fetch new change from git and try again?

yzg-github commented 4 years ago

hi@sbc100 First of all thank you for your advice. now i use 1.39.18 to complie canvaskit in skia ,a new error occure: emscripten requires at least python 3.5 (or python 2.7.12 or above). but the Interesting is my versoin of python is Python 3.6.5.(python -V) could you tell me the cause of the error?

sbc100 commented 4 years ago

Can you include the full command line and output?

Can you you run python3 --version and python --version?

yzg-github commented 4 years ago

hi@sbc100 @hikerpig this is my log to complie skia with emsdk 1.39.20. the version of python is 2.7.16 .i complied on macos catalina 10.15.5 the cmd i used was : ./modules/canvaskit/compile.sh -s ERROR_ON_UNDEFINED_SYMBOLS=0 -Wfastcomp -Werror . ./modules/canvaskit/compile.sh is the file in skia/modules/canvaskit , git commit id of skia is c97ebe06dc1d79fa7dfbf49259d918326b1a460f. complied log: Generating final wasm

sbc100 commented 4 years ago

So the problem is that you have -s STRICT=1 enabled, which is a good thing, bit it means that a lot of the JS libraries don't get included by default in this case.

The missing symbol here is emscripten_webgl_get_current_context which is part of src/library_html5_webgl.js which I believe you can include by adding -lGL to the command line.

yzg-github commented 4 years ago

hi@sbc100 Thank you very much! I have solved this problem according to your suggestion in MacOS.the command line -lGL worked.