-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Solve compile errors on Raspbian buster #2641
Comments
I can confirm that it is compiling well on Raspbian Stretch (GCC 6.3) and failing on Raspbian Buster (GCC 8.3). The solution is pretty straightforward.
Don't know whether there are any drawbacks.
Correction:
Update 2: GCC on Raspbian Buster:
|
can |
some related gcc issues : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 |
Just tested. Compiled fine on GCC 6.3 with and without Best runs:
Hardware (of Raspberry Pi 1):
GCC on Raspbian Stretch:
|
Everything here with my custom Makefile on the Honey fork compiles fine on both 32 bit and 64 bit Buster, different flags of course , with GCC 8.3. Atomic flag required. |
An update on compilation on a Raspberry Pi running 64-bit Gentoo on a raspi 4, a profile-build NNUE gets about 850,000 nps when running on all four cores. Only 36% the speed of classical but fast enough to have an Elo about 70 higher at STC. Straightforward compilation |
Just wanted to say that: I will check the newest master on RPi 1 this weekend, but if someone can check it earlier - you may give it a try.. |
I'm trying to understand the issue. For me the issue would be resolved if we can compile with the unmodified Makefile. 'out-of-the-box' Is this now (after NNUE merge, and the required compiler versions >6) the case, or not yet? |
OK, I have tested now :-)
I have now tried to build again on Raspbian Buster (gcc 8.3) on RPi 1 (armv6) and it fails as in the first message PLUS few new warnings from NNUE code emerged:
Adding
|
the new warning is most likely innocent, we're requesting over-alignment. They should go away with gcc 9 so is the need to add -latomic specific to armv7 or is it conditional on the compiler version that happens to be available on that system that requires that. If we need -latomic for all armv7 builds we could easily add it. I see that also in the android issue #2860 -latomic is sometimes needed. If for both linux and android we need -latomic on armv7 it is easy enough to add to the Makefile. If however the flag interferes with building on certain OS/compiler versins it is more difficult. |
so, from reading a bit up, I think it would be fine to add -latomic to the linker flags for armv7, the library seems to be needed whenever certain atomic operations are not supported by the hardware, and is named the same way for both gcc and clang. |
@vondele, Thank you for taking care of this! I am not a C++ dev, so can't help you with that and leave it up to you :-) We may add it and test it in the wild to see if there are any new complaints emerge. :-) I want to recall that:
Offtopic:
It also creates an empty |
interestingly, the error on diff --git a/src/Makefile b/src/Makefile
index 38f607cb2..ba3564789 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -735,6 +735,6 @@ icc-profile-use:
all
.depend:
- -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null
+ -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@
-include .depend
|
Here it is:
|
ah, clear, somehow it passes the DEPENDFLAGS flags to dependency generation and they make no sense on arm (since -msse is x86). I'll remove that as part of the patch. |
Pass -latomic to the linker as this appears needed for gcc on armv7 Don't pass the target specific `-msse` to the dependency generation, as this leads to an error with `make help` based on discussion in official-stockfish#2641 and official-stockfish#2860 No functional change.
Maybe you can have a look if that would fix this issue: #3006 |
Definitely, this helped to build the binary on my setup. This also resolves the P.S. I was eager to bench the NNUE on RPi 1 with PGO:
profile-build vs build:
NNUE/classical ratio: 38.56 |
actually that speed ratio has a typo, it is a more reasonable 3.856 Any chance you do a match between NNUE and Classical on the hardware to see what the Elo difference would be? Maybe you need a light-weight game manager (see e.g. https://github.com/lucasart/c-chess-cli) This might be the one of the few pieces of hardware where classical still outperforms NNUE, probably a bit depending on TC. |
Oh, sure there is a typo, but another one.. I mean 38.56% (profile-build) :-)
I communicate with stockfish on Pi via SSH, it is something like "Remote UCI Engine" in my local network, so I can even run it using
I will try to run Update: |
I have updated master with what I believe is the best patch so far. There might/will still be issues, let's try to improve as a follow up. Thanks for the feedback and testing. |
The easiest way to use the NDK in conjunction with this Makefile (tested on linux-x86_64): 1. Download the latest NDK (r21d) from Google from https://developer.android.com/ndk/downloads 2. Place and unzip the NDK in $HOME/ndk folder 3. Export the path variable e.g., `export PATH=$PATH:$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin` 4. cd to your Stockfish/src dir 5. Issue `make -j ARCH=armv8 COMP=ndk build` (use `ARCH=armv7` or `ARCH=armv7-neon` for older CPUs) 6. Optionally `make -j ARCH=armv8 COMP=ndk strip` 7. That's all. Enjoy! Improves support from Raspberry Pi (incomplete?) and compiling on arm in general closes official-stockfish/Stockfish#3015 fixes official-stockfish/Stockfish#2860 fixes official-stockfish/Stockfish#2641 Support is still fragile as we're missing CI on these targets. Nevertheless tested with: ```bash # build crosses from ubuntu 20.04 on x86 to various arch/OS combos # tested with suitable packages installed # (build-essentials, mingw-w64, g++-arm-linux-gnueabihf, NDK (r21d) from google) # cross to Android export PATH=$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make clean && make -j build ARCH=armv7 COMP=ndk && make -j build ARCH=armv7 COMP=ndk strip make clean && make -j build ARCH=armv7-neon COMP=ndk && make -j build ARCH=armv7-neon COMP=ndk strip make clean && make -j build ARCH=armv8 COMP=ndk && make -j build ARCH=armv8 COMP=ndk strip # cross to Raspberry Pi make clean && make -j build ARCH=armv7 COMP=gcc COMPILER=arm-linux-gnueabihf-g++ make clean && make -j build ARCH=armv7-neon COMP=gcc COMPILER=arm-linux-gnueabihf-g++ # cross to Windows make clean && make -j build ARCH=x86-64-modern COMP=mingw ``` No functional change
The easiest way to use the NDK in conjunction with this Makefile (tested on linux-x86_64): 1. Download the latest NDK (r21d) from Google from https://developer.android.com/ndk/downloads 2. Place and unzip the NDK in $HOME/ndk folder 3. Export the path variable e.g., `export PATH=$PATH:$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin` 4. cd to your Stockfish/src dir 5. Issue `make -j ARCH=armv8 COMP=ndk build` (use `ARCH=armv7` or `ARCH=armv7-neon` for older CPUs) 6. Optionally `make -j ARCH=armv8 COMP=ndk strip` 7. That's all. Enjoy! Improves support from Raspberry Pi (incomplete?) and compiling on arm in general closes official-stockfish/Stockfish#3015 fixes official-stockfish/Stockfish#2860 fixes official-stockfish/Stockfish#2641 Support is still fragile as we're missing CI on these targets. Nevertheless tested with: ```bash # build crosses from ubuntu 20.04 on x86 to various arch/OS combos # tested with suitable packages installed # (build-essentials, mingw-w64, g++-arm-linux-gnueabihf, NDK (r21d) from google) # cross to Android export PATH=$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make clean && make -j build ARCH=armv7 COMP=ndk && make -j build ARCH=armv7 COMP=ndk strip make clean && make -j build ARCH=armv7-neon COMP=ndk && make -j build ARCH=armv7-neon COMP=ndk strip make clean && make -j build ARCH=armv8 COMP=ndk && make -j build ARCH=armv8 COMP=ndk strip # cross to Raspberry Pi make clean && make -j build ARCH=armv7 COMP=gcc COMPILER=arm-linux-gnueabihf-g++ make clean && make -j build ARCH=armv7-neon COMP=gcc COMPILER=arm-linux-gnueabihf-g++ # cross to Windows make clean && make -j build ARCH=x86-64-modern COMP=mingw ``` No functional change
The easiest way to use the NDK in conjunction with this Makefile (tested on linux-x86_64): 1. Download the latest NDK (r21d) from Google from https://developer.android.com/ndk/downloads 2. Place and unzip the NDK in $HOME/ndk folder 3. Export the path variable e.g., `export PATH=$PATH:$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin` 4. cd to your Stockfish/src dir 5. Issue `make -j ARCH=armv8 COMP=ndk build` (use `ARCH=armv7` or `ARCH=armv7-neon` for older CPUs) 6. Optionally `make -j ARCH=armv8 COMP=ndk strip` 7. That's all. Enjoy! Improves support from Raspberry Pi (incomplete?) and compiling on arm in general closes official-stockfish#3015 fixes official-stockfish#2860 fixes official-stockfish#2641 Support is still fragile as we're missing CI on these targets. Nevertheless tested with: ```bash # build crosses from ubuntu 20.04 on x86 to various arch/OS combos # tested with suitable packages installed # (build-essentials, mingw-w64, g++-arm-linux-gnueabihf, NDK (r21d) from google) # cross to Android export PATH=$HOME/ndk/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH make clean && make -j build ARCH=armv7 COMP=ndk && make -j build ARCH=armv7 COMP=ndk strip make clean && make -j build ARCH=armv7-neon COMP=ndk && make -j build ARCH=armv7-neon COMP=ndk strip make clean && make -j build ARCH=armv8 COMP=ndk && make -j build ARCH=armv8 COMP=ndk strip # cross to Raspberry Pi make clean && make -j build ARCH=armv7 COMP=gcc COMPILER=arm-linux-gnueabihf-g++ make clean && make -j build ARCH=armv7-neon COMP=gcc COMPILER=arm-linux-gnueabihf-g++ # cross to Windows make clean && make -j build ARCH=x86-64-modern COMP=mingw ``` No functional change
Lo
If anyone encounters the same compile errors while attempting on building sf on raspbian buster:
I solved it by those commands:
And it finally compiles...
The text was updated successfully, but these errors were encountered: