mljs / xgboost

A port of XGBoost to javascript with emscripten
Other
41 stars 8 forks source link

wasm-ld: error: 'atomics' feature is disallowed by build/learner.o #13

Open zemlyansky opened 4 years ago

zemlyansky commented 4 years ago

When cloning the repo and running npm run build emscripten throws such errors:

wasm-ld: error: 'atomics' feature is disallowed by build/learner.o, so --shared-memory must not be used
wasm-ld: error: 'atomics' feature must be used in order to use shared memory
wasm-ld: error: 'bulk-memory' feature must be used in order to use shared memory
Makefile:164: recipe for target 'lib/libxgboost.so' failed
make[1]: *** [lib/libxgboost.so] Error 1
make[1]: *** Waiting for unfinished jobs....
wasm-ld: error: 'atomics' feature is disallowed by build/cli_main.o, so --shared-memory must not be used
wasm-ld: error: 'atomics' feature must be used in order to use shared memory
wasm-ld: error: 'bulk-memory' feature must be used in order to use shared memory

Emcc version: 1.39.10

Probably related to this discussion: https://groups.google.com/forum/#!topic/emscripten-discuss/tdjKEcKXXC8

I tried removing -pthread from the native xgboost Makefile: export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)

After that the wasm output was produced without errors, but there were lots of warnings like these:

wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=22 expected=23
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=23 expected=24
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=25 expected=26
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=122 expected=123
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=122 expected=123
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=122 expected=123
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=126 expected=127
wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB: existing=128 expected=129

Not sure if this a right way to deal with the error