Sunday, August 01, 2021

games/stockfish: fix build on riscv64

Hi,

stockfish used to fail in my current bulk, with horrible error messages.

--8<--
c++ -Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -m32 -DUSE_PTHREADS -DNDEBUG -O2 -pipe -DNO_PREFETCH -c -o benchmark.o benchmark.cpp
In file included from benchmark.cpp:19:
In file included from /usr/include/c++/v1/fstream:182:
/usr/include/c++/v1/__config:1155:6: error: "No thread API"
# error "No thread API"
[loads of errors written in cuneiform]
-->8--

The problem is obvious if you don't try too hard to interpret the error
message. I tracked it down to the use of -m32 in CFLAGS.

Here's a fix that should also help for the next 64 bits architectures.
With this stockfish builds properly on riscv64, I checked that it still
does the right thing on sparc64.

ok?


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/stockfish/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- Makefile 27 Feb 2021 03:29:37 -0000 1.12
+++ Makefile 1 Aug 2021 02:30:24 -0000
@@ -26,6 +26,7 @@ COMPILER = base-clang ports-gcc
USE_GMAKE = Yes
MAKE_FLAGS = CC="${CC}" CXX="${CXX}"

+.include <bsd.port.arch.mk>
# Some archs have platform-specific enhancements.
.if ${MACHINE_ARCH:Mamd64}
MAKE_ENV = ARCH=x86-64
@@ -37,9 +38,7 @@ MAKE_ENV = ARCH=armv7
MAKE_ENV = ARCH=ppc-32
.elif ${MACHINE_ARCH:Mpowerpc64}
MAKE_ENV = ARCH=ppc-64
-.elif ${MACHINE_ARCH:Maarch64} || ${MACHINE_ARCH:Malpha} || \
- ${MACHINE_ARCH:Msparc64} || ${MACHINE_ARCH:Mmips64} || \
- ${MACHINE_ARCH:Mmips64el}
+.elif ${PROPERTIES:Mlp64}
MAKE_ENV = ARCH=general-64
.else
MAKE_ENV = ARCH=general-32


--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE

No comments:

Post a Comment