Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS build error #82

Open
samuraitruong opened this issue Sep 8, 2023 · 4 comments
Open

MacOS build error #82

samuraitruong opened this issue Sep 8, 2023 · 4 comments

Comments

@samuraitruong
Copy link

The build script seem does not work on MACOS. same script works fine on ubuntu

/Library/Developer/CommandLineTools/usr/bin/make ARCH=wasm COMP=em++ all
em++ -D__EMSCRIPTEN_PTHREADS__ -DCHESSCOM -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT  -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -DNNUE_EMBEDDING_OFF -mmacosx-version-min=10.14 -arch wasm -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -DGIT_SHA=5bb15a12 -DGIT_DATE=20230908 -flto=full   -c -o benchmark.o benchmark.cpp
em++ -D__EMSCRIPTEN_PTHREADS__ -DCHESSCOM -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT  -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -DNNUE_EMBEDDING_OFF -mmacosx-version-min=10.14 -arch wasm -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -DGIT_SHA=5bb15a12 -DGIT_DATE=20230908 -flto=full   -c -o bitbase.o bitbase.cpp
em++ -D__EMSCRIPTEN_PTHREADS__ -DCHESSCOM -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT  -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -DNNUE_EMBEDDING_OFF -mmacosx-version-min=10.14 -arch wasm -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -DGIT_SHA=5bb15a12 -DGIT_DATE=20230908 -flto=full   -c -o bitboard.o bitboard.cpp
em++ -D__EMSCRIPTEN_PTHREADS__ -DCHESSCOM -Wall -Wcast-qual -fno-exceptions -std=c++17 -DUSE_POPCNT  -DUSE_WASM_SIMD -DUSE_WASM_SIMD_POST_MVP -msimd128 -DNNUE_EMBEDDING_OFF -mmacosx-version-min=10.14 -arch wasm -DUSE_PTHREADS -DNDEBUG -O3 -mdynamic-no-pic -fexperimental-new-pass-manager -DIS_64BIT -DNO_PREFETCH -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -DGIT_SHA=5bb15a12 -DGIT_DATE=20230908 -flto=full   -c -o endgame.o endgame.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]: *** [benchmark.o] Error 1
make[1]: *** Waiting for unfinished jobs....
em++: error: wasm: No such file or directory ("wasm" was expected to be an input file, based on the commandline arguments provided)
make[1]: *** [bitbase.o] Error 1
em++: error: wasm: No such file or directory ("wasm" was expected to be an input file, based on the commandline arguments provided)
make[1]: *** [bitboard.o] Error 1
em++: error: wasm: No such file or directory ("wasm" was expected to be an input file, based on the commandline arguments provided)
make[1]: *** [endgame.o] Error 1
make: *** [build] Error 2
@samuraitruong
Copy link
Author

samuraitruong commented Sep 11, 2023

You can go on my forked, I added docker file to run the build inside docker as the solution for now

  docker run \
  --rm \
  -v $(pwd):/src \
  -u $(id -u):$(id -g) \
  emscripten/emsdk:2.0.26 \
  ./build.js

@zserge
Copy link

zserge commented Oct 1, 2023

I think the fix would be to change the Makefile to use proper options syntax:

--- a/src/Makefile
+++ b/src/Makefile
@@ -475,8 +475,8 @@ ifeq ($(KERNEL),Darwin)
        CXXFLAGS += -mmacosx-version-min=10.14
        LDFLAGS += -mmacosx-version-min=10.14
        ifneq ($(arch),any)
-               CXXFLAGS += -arch $(arch)
-               LDFLAGS += -arch $(arch)
+               CXXFLAGS += -arch=$(arch)
+               LDFLAGS += -arch=$(arch)
        endif
        XCRUN = xcrun
 endif

@zserge
Copy link

zserge commented Oct 1, 2023

However the fix above would bring you to the next error, which is CXXFLAGS += -mdynamic-no-pic being an unknown option for WASM architecture. Removing that solves the issue. Not sure how to make a patch to fix the latter properly.

@ps2-controller
Copy link

ps2-controller commented May 3, 2024

Running into the same issue on mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@samuraitruong @zserge @ps2-controller and others