rosenthj / Winter

UCI Chess Engine
GNU General Public License v3.0
88 stars 13 forks source link

Compile Winter 0.6 on macOS #6

Closed twoplan closed 5 years ago

twoplan commented 5 years ago

Used the provided Makefile to compile version 0.60 on macOS 13.6 and got this error:

... ... g++ -c -DNDEBUG -Ofast -flto -g3 -Wall -Wno-sign-compare -m64 -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/board.cc -o src/board.o

src/board.cc:138:20: error: constexpr variable 'all_castling_squares' must be initialized by a constant expression ...all_castling_squares = castling_relevant_bbs[0] | castling_relevant_bbs[1] ^ ~~~~~~~~~~~ src/board.cc:138:43: note: non-constexpr function 'operator[]' cannot be used in a constant expression constexpr BitBoard all_castling_squares = castling_relevant_bbs[0] | cas... ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/array:193:21: note: declared here const_reference operator[](sizetype n) const {return elems[__n];} ^ 1 error generated. make: *** [src/board.o] Error 1

BTW: Winter 0.55 compiles fine (only 3 warnings about unused variable & function). My compiler:

g++ --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.10.44.4) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

rosenthj commented 5 years ago

Thank you for this report! I will decide how I fix this when I get home. In the meantime you likely can just change compiler flag -std=c++11 to -std=c++17 I am not getting this error with my GCC (7.4.0) or Clang (6.0.0) versions, but a quick look at cppreference shows that the at array operator wasn't updated to constexpr until later versions.

twoplan commented 5 years ago

Thanks, with -std=c++17 Winter 0.6 compiles (and runs) well now!

Zamana commented 4 years ago

Hi!

Sorry for posting in a closed topic, I'm just trying to avoid to create another thread...

Would you intend to provide MacOS binaries, ready to use, as you do for Windows?

Thanks. Regards.

rosenthj commented 4 years ago

I don't have access to a OSX machine at the moment. That being said, if I recall correctly OSX has clang installed by default which should make it trivial to build Winter. If a simple cloning of the Winter repo and calling make does not work for you, please feel free to get back to me and Ill see what I can do.