hi-ogawa / Stockfish

stockfish-nnue.wasm
https://stockfish-nnue-wasm.vercel.app
GNU General Public License v3.0
99 stars 11 forks source link

Makefile/emscripten woes (em++: error: wasm: No such file or directory) #4

Closed s1gtrap closed 3 years ago

s1gtrap commented 3 years ago

I'm trying to get this compiling on macOS Big Sur (11.2.3 (20D91)), but keep getting errors and I'm kind of at a loss at this point.

I tried following src/emscripten/README.md, cloned the latest emsdk (ac98ca), and already the confusion set in, as <path-to-emsdk-repo>/emsdk.sh is not a thing. Okay, I figured you meant <path-to-emsdk-repo>/emsdk_env.sh, so I tried that.

Next up was some syntax error, figured it was some Python stuff so upgraded from 2.7.16 to 3.9.2 and got that playing nice.

Then, in trying to run make -C src emscripten_build ARCH=wasm wasm_simd_post_mvp=yes, I get

em++: error: wasm: No such file or directory ("wasm" was expected to be an input file, based on the commandline arguments provided)

for which I'm at a complete loss. I've run make net etc. and I'm not even sure why it would look for a file named wasm. I also tried with a newer GNU make (4.3 instead of 3.81), no dice.

I also tried make -C src build ARCH=wasm32-unknown-unknown (from niklasf/stockfish.wasm iirc) for which I got the mysterious albeit kinda interesting

make: *** [Makefile:831: config-sanity] Error 1

until I realised that Makefile:831 simply validates ARCH, so yea.. no dice either.

hi-ogawa commented 3 years ago

First of all, thanks for trying it out! I haven't tested on other environment than my machine (archlinux), so I appreciate reporting build error like this. So, let me see...

<path-to-emsdk-repo>/emsdk.sh is not a thing.

Oh, good catch, you're right, I meant <path-to-emsdk-repo>/emsdk_env.sh there. I'll update README.md.

I get em++: error: wasm: No such file or directory ...

Off the top of my head, I have no clue. Could you attach the whole log of make -C src emscripten_build ARCH=wasm wasm_simd_post_mvp=yes?

I also tried make -C src build ARCH=wasm32-unknown-unknown ...

That is not supposed to work on my port.


A few things I want to ask:

Edit:

one more question


By the way, the versions of tools on machine are like this:

$ em++ --version
emcc (Emscripten gcc/clang-like replacement) 2.0.11 (6e28e4fa4fa1bc50d58b9ddbbb9603a3cf21ea9e)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
s1gtrap commented 3 years ago

First of all, thanks for trying it out! I haven't tested on other environment than my machine (archlinux), so I appreciate reporting build error like this.

Huh, neat! I happen to be dual booting Arch, so that's good to know!

Off the top of my head, I have no clue. Could you attach the whole log of make -C src emscripten_build ARCH=wasm wasm_simd_post_mvp=yes?

Sure thing.

$ make -C src emscripten_build ARCH=wasm wasm_simd_post_mvp=yes
make: Entering directory '/Users/s1gtrap/Stockfish-wasm/src'
make: [Makefile:892: .depend] Error 1 (ignored)
Default net: nn-62ef826d1a6d.nnue
Downloading https://tests.stockfishchess.org/api/nn/nn-62ef826d1a6d.nnue

Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'wasm'
bits: '64'
kernel: 'Darwin'
os: ''
prefetch: 'no'
popcnt: 'no'
pext: 'no'
sse: 'no'
mmx: 'no'
sse2: 'no'
ssse3: 'no'
sse41: 'no'
avx2: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'no'

Flags:
CXX: em++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT --pre-js emscripten/preamble.js -s MODULARIZE=1 -s EXPORT_NAME=Stockfish -s ENVIRONMENT=web,worker,node -s STRICT=1 -s ASYNCIFY=1 -s 'ASYNCIFY_IMPORTS=[emscripten_utils_getline_impl]' -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=134217728 -s MAXIMUM_MEMORY=2147483648 -s FILESYSTEM=0 --closure 1 -s ASSERTIONS=0 -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -arch wasm -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -flto
LDFLAGS:  -arch wasm -mmacosx-version-min=10.14 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT --pre-js emscripten/preamble.js -s MODULARIZE=1 -s EXPORT_NAME=Stockfish -s ENVIRONMENT=web,worker,node -s STRICT=1 -s ASYNCIFY=1 -s 'ASYNCIFY_IMPORTS=[emscripten_utils_getline_impl]' -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=134217728 -s MAXIMUM_MEMORY=2147483648 -s FILESYSTEM=0 --closure 1 -s ASSERTIONS=0 -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -arch wasm -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -flto

Testing config sanity. If this fails, try 'make help' ...

make ARCH=wasm COMP=em++ all
make[1]: Entering directory '/Users/s1gtrap/Stockfish-wasm/src'
em++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT --pre-js emscripten/preamble.js -s MODULARIZE=1 -s EXPORT_NAME="Stockfish" -s ENVIRONMENT=web,worker,node -s STRICT=1 -s ASYNCIFY=1 -s 'ASYNCIFY_IMPORTS=["emscripten_utils_getline_impl"]' -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1 -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=$((1 << 27)) -s MAXIMUM_MEMORY=$((1 << 31)) -s FILESYSTEM=0 --closure 1 -s ASSERTIONS=0 -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -arch wasm -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -flto   -c -o benchmark.o benchmark.cpp
em++: error: wasm: No such file or directory ("wasm" was expected to be an input file, based on the commandline arguments provided)
make[1]: *** [<builtin>: benchmark.o] Error 1
make[1]: Leaving directory '/Users/s1gtrap/Stockfish-wasm/src'
make: *** [Makefile:725: build] Error 2
make: Leaving directory '/Users/s1gtrap/Stockfish-wasm/src'

That is with

$ em++ --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.15 (7685e4ec373dca607781d3995c3fc2ba229ce9d8)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make --version
GNU Make 4.3
Built for x86_64-apple-darwin20.1.0
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

That is not supposed to work on my port.

Figured as much 😉

  • What happens if you just run make -C src build (or actually same as make -C src build ARCH=x86-64-modern)? it should build normal Stockfish executable same as official repo.

I actually thought that worked fine, but apparently not, as

$ make -C src build
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Default net: nn-62ef826d1a6d.nnue
Already available.

Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'x86_64'
bits: '64'
kernel: 'Darwin'
os: ''
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'yes'
mmx: 'no'
sse2: 'yes'
ssse3: 'yes'
sse41: 'yes'
avx2: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'no'

Flags:
CXX: g++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -DUSE_SSSE3 -DUSE_SSE2
LDFLAGS:  -m64 -arch x86_64 -mmacosx-version-min=10.14 -lpthread

Testing config sanity. If this fails, try 'make help' ...

make: *** [config-sanity] Error 1

Yep. Fresh checkout on master, producing a perfectly runnable stockfish

$ make -C src build
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Default net: nn-62ef826d1a6d.nnue
Downloading https://tests.stockfishchess.org/api/nn/nn-62ef826d1a6d.nnue

Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'x86_64'
bits: '64'
kernel: 'Darwin'
os: ''
prefetch: 'yes'
popcnt: 'yes'
pext: 'no'
sse: 'yes'
mmx: 'no'
sse2: 'yes'
ssse3: 'yes'
sse41: 'yes'
avx2: 'no'
avx512: 'no'
vnni256: 'no'
vnni512: 'no'
neon: 'no'

Flags:
CXX: g++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto
LDFLAGS:  -m64 -arch x86_64 -mmacosx-version-min=10.14 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto

Testing config sanity. If this fails, try 'make help' ...

/Library/Developer/CommandLineTools/usr/bin/make ARCH=x86-64-modern COMP=gcc all
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o benchmark.o benchmark.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o bitbase.o bitbase.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o bitboard.o bitboard.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o endgame.o endgame.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o evaluate.o evaluate.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o main.o main.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o material.o material.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o misc.o misc.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o movegen.o movegen.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o movepick.o movepick.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o pawns.o pawns.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o position.o position.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o psqt.o psqt.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o search.o search.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o thread.o thread.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o timeman.o timeman.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o tt.o tt.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o uci.o uci.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o ucioption.o ucioption.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o tune.o tune.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o tbprobe.o syzygy/tbprobe.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o evaluate_nnue.o nnue/evaluate_nnue.cpp
g++ -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o half_kp.o nnue/features/half_kp.cpp
g++ -o stockfish benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o tbprobe.o evaluate_nnue.o half_kp.o  -m64 -arch x86_64 -mmacosx-version-min=10.14 -lpthread -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -arch x86_64 -mmacosx-version-min=10.14 -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto
  • Have you tried building other emscripten project (or some toy example)?

I wouldn't know where to find these but I'll have a look around.

hi-ogawa commented 3 years ago

Thanks for reporting back the detail. I think I identified where the issue is:

https://github.com/hi-ogawa/Stockfish/blob/a0ad14f1ca34e24ef459482b1da90c85472f664e/src/Makefile#L390-L394

When host kernel is automatically picked up as Darwin, there are some special compiler options added (in this case -arch wasm), which emscripten doesn't understand. So manually setting KERNEL=Linux could be a workaround (possible with OS=GNU/Linux).

Btw, you can check successful build log from Github Actions CI as in https://github.com/hi-ogawa/Stockfish/runs/2183230332?check_suite_focus=true#step:5:1.

Actually, this doesn't explaine why simple make -C src build fails. I have no idea about it, so it would be great if you can debug yourself by removing/adding some lines from Makefile. FYI, there are only a few lines different from upstream https://github.com/official-stockfish/Stockfish/compare/master...hi-ogawa:emscripten#diff-3e2513390df543315686d7c85bd901ca9256268970032298815d2f893a9f0685.

hi-ogawa commented 3 years ago

I'll close this due to inactivity, but feel free to open if you have further questions.