lichess-org / lichess-org/stockfish.js
Error on build with latest version of emscripten
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 258
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
Following instructions from the readme and emscripten, I get this error
```
stockfish.js git/ddugovic
❯ ./build.sh
Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'any'
bits: '32'
kernel: 'Darwin'
os: ''
prefetch: 'no'
popcnt: 'no'
sse: 'no'
pext: 'no'
Flags:
CXX: em++
CXXFLAGS: -Wall -Wcast-qual -std=c++11 -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DNDEBUG -O3 -mdynamic-no-pic -DNO_PREFETCH -flto
LDFLAGS: -s TOTAL_MEMORY=33554432 --memory-init-file 0 -s NO_EXIT_RUNTIME=1 -s EXPORTED_FUNCTIONS=[_main, _uci_command] -s EXTRA_EXPORTED_RUNTIME_METHODS=[ccall] --pre-js pre.js -s WASM=0 -s LEGACY_VM_SUPPORT=1 -O3 -Wall -Wcast-qual -std=c++11 -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DNDEBUG -O3 -mdynamic-no-pic -DNO_PREFETCH -flto
Testing config sanity. If this fails, try 'make help' ...
/Library/Developer/CommandLineTools/usr/bin/make ARCH=js COMP=emscripten all
em++ -Wall -Wcast-qual -std=c++11 -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DNDEBUG -O3 -mdynamic-no-pic -DNO_PREFETCH -flto -c -o bitbase.o bitbase.cpp
em++ -Wall -Wcast-qual -std=c++11 -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DNDEBUG -O3 -mdynamic-no-pic -DNO_PREFETCH -flto -c -o bitboard.o bitboard.cpp
clang-13: error: unsupported option '-mdynamic-no-pic' for target 'wasm32-unknown-emscripten'
clang-13: error: unsupported option '-mdynamic-no-pic' for target 'wasm32-unknown-emscripten'
em++: error: '/Users/robertwebb/emsdk/upstream/bin/clang++ -DEMSCRIPTEN -fignore-exceptions -flto=full -Xclang -iwithsysroot/include/SDL -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=14 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -flegacy-pass-manager -Werror=implicit-function-declaration --sysroot=/Users/robertwebb/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -Wall -Wcast-qual -std=c++11 -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DNDEBUG -O3 -mdynamic-no-pic -DNO_PREFETCH -flto -c bitboard.cpp -o bitboard.o' failed (1)
make[1]: *** [bitboard.o] Error 1
make[1]: *** Waiting for unfinished jobs....
clang-13: error: unsupported option '-mdynamic-no-pic' for target 'wasm32-unknown-emscripten'
clang-13: error: unsupported option '-mdynamic-no-pic' for target 'wasm32-unknown-emscripten'
em++: error: '/Users/robertwebb/emsdk/upstream/bin/clang++ -DEMSCRIPTEN -fignore-exceptions -flto=full -Xclang -iwithsysroot/include/SDL -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=14 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -flegacy-pass-manager -Werror=implicit-function-declaration --sysroot=/Users/robertwebb/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -Wall -Wcast-qual -std=c++11 -DANTI -DATOMIC -DCRAZYHOUSE -DHORDE -DKOTH -DRACE -DTHREECHECK -DNDEBUG -O3 -mdynamic-no-pic -DNO_PREFETCH -flto -c bitbase.cpp -o bitbase.o' failed (1)
make[1]: *** [bitbase.o] Error 1
make: *** [build] Error 2
```
This is probably due to latest emscripten being incompatible with this build, going to try to find either a different stockfish js or the correct version of emscripten to use.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README instructions and build.sh, then trace where -mdynamic-no-pic is added to the emscripten compiler flags. Re-run ./build.sh with the reported toolchain to confirm the failure and verify that the JavaScript/WebAssembly build completes without the unsupported-option error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100