Closed mickkn closed 2 years ago
Managed to build the 0.27 release but this error:
~/lc0-0.27.0/build/release $ ./lc0
Illegal instruction
I also tried to run lc0 on a Raspberry Pi Zero. Compilation works fine with version 0.28.2 and ggc-8. However, I got the same error as mickkn when executing lc0:
Illegal instruction
@mickkn Did you find a solution?
BTW: The steps described here did not work for me. I got the error:
/usr/bin/ld: liblc0_lib.a: error adding symbols: archive has no index; run ranlib to add one
Solution was to use gcc-8.
Nah, didn’t solve it. I’m using Minic and Stockfish in my project https://github.com/mickkn/mChessBoard the executables are in the sorce folder
Apparently the neon instructions are illegal on armv6. Compilation works with the following command:
./build.sh -Dneon=false
Found ninja-1.10.2.git.kitware.jobserver-1 at /home/pi/mChessBoard/src/venv/bin/ninja
[20/157] Compiling C++ object lc0.p/src_mcts_search.cc.o
../../src/mcts/search.cc:1500:40: warning: reading variable 'current_bestedge' requires holding mutex 'search_->nodesmutex' [-Wthread-safety-analysis]
const int64_t best_noden = search->current_bestedge.GetN();
^
../../src/mcts/search.cc:1644:44: warning: passing variable 'current_bestedge' by reference requires holding mutex 'search_->nodesmutex' [-Wthread-safety-reference]
if (curiters[idx] != search->current_bestedge &&
^
2 warnings generated.
[41/157] Compiling C++ object lc0.p/src_neural_onnx_converter.cc.o
../../src/neural/onnx/converter.cc:214:9: warning: braces around scalar initializer [-Wbraced-scalar-init]
{1});
^~~
1 warning generated.
[47/157] Compiling C++ object lc0.p/src_trainingdata_trainingdata.cc.o
../../src/trainingdata/trainingdata.cc:256:17: warning: taking address of packed member 'best_q' of class or structure 'lczero::V6TrainingData' may result in an unaligned pointer value [-Waddress-of-packed-member]
DriftCorrect(&result.best_q, &result.best_d);
^~~~~
../../src/trainingdata/trainingdata.cc:256:33: warning: taking address of packed member 'best_d' of class or structure 'lczero::V6TrainingData' may result in an unaligned pointer value [-Waddress-of-packed-member]
DriftCorrect(&result.best_q, &result.best_d);
^~~~~
../../src/trainingdata/trainingdata.cc:257:17: warning: taking address of packed member 'root_q' of class or structure 'lczero::V6TrainingData' may result in an unaligned pointer value [-Waddress-of-packed-member]
DriftCorrect(&result.root_q, &result.root_d);
^~~~~
../../src/trainingdata/trainingdata.cc:257:33: warning: taking address of packed member 'root_d' of class or structure 'lczero::V6TrainingData' may result in an unaligned pointer value [-Waddress-of-packed-member]
DriftCorrect(&result.root_q, &result.root_d);
^~~~~
../../src/trainingdata/trainingdata.cc:258:17: warning: taking address of packed member 'played_q' of class or structure 'lczero::V6TrainingData' may result in an unaligned pointer value [-Waddress-of-packed-member]
DriftCorrect(&result.played_q, &result.played_d);
^~~~~~~
../../src/trainingdata/trainingdata.cc:258:35: warning: taking address of packed member 'played_d' of class or structure 'lczero::V6TrainingData' may result in an unaligned pointer value [-Waddress-of-packed-member]
DriftCorrect(&result.played_q, &result.played_d);
^~~~~~~
6 warnings generated.
[79/157] Linking target lc0
FAILED: lc0
clang++-6.0 -o lc0 lc0.p/src_main.cc.o lc0.p/src_utils_protomessage.cc.o lc0.p/src_benchmark_backendbench.cc.o lc0.p/src_benchmark_benchmark.cc.o lc0.p/src_chess_bitboard.cc.o lc0.p/src_chess_board.cc.o lc0.p/src_chess_position.cc.o lc0.p/src_chess_uciloop.cc.o lc0.p/src_engine.cc.o lc0.p/src_lc0ctl_describenet.cc.o lc0.p/src_lc0ctl_leela2onnx.cc.o lc0.p/src_lc0ctl_onnx2leela.cc.o lc0.p/src_mcts_node.cc.o lc0.p/src_mcts_params.cc.o lc0.p/src_mcts_search.cc.o lc0.p/src_mcts_stoppers_alphazero.cc.o lc0.p/src_mcts_stoppers_common.cc.o lc0.p/src_mcts_stoppers_factory.cc.o lc0.p/src_mcts_stoppers_legacy.cc.o lc0.p/src_mcts_stoppers_smooth.cc.o lc0.p/src_mcts_stoppers_stoppers.cc.o lc0.p/src_mcts_stoppers_timemgr.cc.o lc0.p/src_neural_cache.cc.o lc0.p/src_neural_decoder.cc.o lc0.p/src_neural_encoder.cc.o lc0.p/src_neural_factory.cc.o lc0.p/src_neural_loader.cc.o lc0.p/src_neural_network_check.cc.o lc0.p/src_neural_network_demux.cc.o lc0.p/src_neural_network_legacy.cc.o lc0.p/src_neural_network_mux.cc.o lc0.p/src_neural_network_random.cc.o lc0.p/src_neural_network_record.cc.o lc0.p/src_neural_network_rr.cc.o lc0.p/src_neural_network_trivial.cc.o lc0.p/src_neural_onnx_adapters.cc.o lc0.p/src_neural_onnx_builder.cc.o lc0.p/src_neural_onnx_converter.cc.o lc0.p/src_selfplay_game.cc.o lc0.p/src_selfplay_loop.cc.o lc0.p/src_selfplay_tournament.cc.o lc0.p/src_syzygy_syzygy.cc.o lc0.p/src_trainingdata_reader.cc.o lc0.p/src_trainingdata_trainingdata.cc.o lc0.p/src_trainingdata_writer.cc.o lc0.p/src_utils_commandline.cc.o lc0.p/src_utils_configfile.cc.o lc0.p/src_utils_esc_codes.cc.o lc0.p/src_utils_files.cc.o lc0.p/src_utils_histogram.cc.o lc0.p/src_utils_logging.cc.o lc0.p/src_utils_numa.cc.o lc0.p/src_utils_optionsdict.cc.o lc0.p/src_utils_optionsparser.cc.o lc0.p/src_utils_random.cc.o lc0.p/src_utils_string.cc.o lc0.p/src_utils_weights_adapter.cc.o lc0.p/src_version.cc.o lc0.p/src_utils_filesystem.posix.cc.o lc0.p/src_neural_blas_convolution1.cc.o lc0.p/src_neural_blas_fully_connected_layer.cc.o lc0.p/src_neural_blas_se_unit.cc.o lc0.p/src_neural_blas_network_blas.cc.o lc0.p/src_neural_blas_winograd_convolution3.cc.o lc0.p/src_neural_shared_activation.cc.o lc0.p/src_neural_shared_winograd_filter.cc.o -flto -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -pthread -Wl,--start-group /usr/lib/libopenblas.so /usr/lib/arm-linux-gnueabihf/libz.so /usr/bin/../lib/gcc/arm-linux-gnueabihf/8/libatomic.so -Wl,--end-group
clang: error: unable to execute command: Segmentation fault
clang: error: linker command failed due to signal (use -v to see invocation)
[80/157] Compiling C++ object liblc0_lib.a.p/src_lc0ctl_describenet.cc.o
ninja: build stopped: subcommand failed.
(venv) pi@mchessboard:~/lc0 $
I also got segmentation faults with clang. Using gcc-8 helps.
Yes, thanks - works now :) someone should add it to the readme
Shouldn't be possible to build on a Raspberry Pi Zero?
Using: CC=gcc-8 CXX=g++-8 ./build.sh -Ddefault_library=static -Db_lto=false -Dgtest=false
[57/57] Linking target lc0 FAILED: lc0 g++-8 -o lc0 lc0.p/src_main.cc.o lc0.p/src_utils_protomessage.cc.o lc0.p/src_engine.cc.o lc0.p/src_version.cc.o lc0.p/src_benchmark_backendbench.cc.o lc0.p/src_benchmark_benchmark.cc.o lc0.p/src_chess_bitboard.cc.o lc0.p/src_chess_board.cc.o lc0.p/src_chess_position.cc.o lc0.p/src_chess_uciloop.cc.o lc0.p/src_mcts_node.cc.o lc0.p/src_mcts_params.cc.o lc0.p/src_mcts_search.cc.o lc0.p/src_mcts_stoppers_common.cc.o lc0.p/src_mcts_stoppers_factory.cc.o lc0.p/src_mcts_stoppers_legacy.cc.o lc0.p/src_mcts_stoppers_alphazero.cc.o lc0.p/src_mcts_stoppers_smooth.cc.o lc0.p/src_mcts_stoppers_stoppers.cc.o lc0.p/src_mcts_stoppers_timemgr.cc.o lc0.p/src_neural_cache.cc.o lc0.p/src_neural_encoder.cc.o lc0.p/src_neural_factory.cc.o lc0.p/src_neural_loader.cc.o lc0.p/src_neural_network_check.cc.o lc0.p/src_neural_network_demux.cc.o lc0.p/src_neural_network_legacy.cc.o lc0.p/src_neural_network_mux.cc.o lc0.p/src_neural_network_random.cc.o lc0.p/src_neural_network_record.cc.o lc0.p/src_neural_network_rr.cc.o lc0.p/src_neural_writer.cc.o lc0.p/src_selfplay_game.cc.o lc0.p/src_selfplay_loop.cc.o lc0.p/src_selfplay_tournament.cc.o lc0.p/src_syzygy_syzygy.cc.o lc0.p/src_utils_commandline.cc.o lc0.p/src_utils_configfile.cc.o lc0.p/src_utils_esc_codes.cc.o lc0.p/src_utils_histogram.cc.o lc0.p/src_utils_logging.cc.o lc0.p/src_utils_numa.cc.o lc0.p/src_utils_optionsdict.cc.o lc0.p/src_utils_optionsparser.cc.o lc0.p/src_utils_random.cc.o lc0.p/src_utils_string.cc.o lc0.p/src_utils_weights_adapter.cc.o lc0.p/src_utils_filesystem.posix.cc.o lc0.p/src_neural_blas_convolution1.cc.o lc0.p/src_neural_blas_fully_connected_layer.cc.o lc0.p/src_neural_blas_se_unit.cc.o lc0.p/src_neural_blas_network_blas.cc.o lc0.p/src_neural_blas_winograd_convolution3.cc.o lc0.p/src_neural_shared_activation.cc.o lc0.p/src_neural_shared_winograd_filter.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -mfpu=neon -pthread -Wl,--start-group /usr/lib/libopenblas.so /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/gcc/arm-linux-gnueabihf/8/libatomic.so -Wl,--end-group /usr/bin/ld: lc0.p/src_neural_blas_convolution1.cc.o: in function::Forward1D(unsigned int, unsigned int, unsigned int, float const , float const, float const, bool, float)':
fully_connected_layer.cc:(.text+0x2e04): undefined reference to `cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const, int, float const, int, float, float, int)'
/usr/bin/ld: fully_connected_layer.cc:(.text+0x2f0c): undefined reference to ::Forward0D(unsigned int, float const, float const)':
fully_connected_layer.cc:(.text+0x2f38): undefined reference to ::Sgemm(unsigned int, float const, unsigned int, unsigned int)':
winograd_convolution3.cc:(.text+0x29bc): undefined reference to `cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const, int, float const, int, float, float, int)'
/usr/bin/ld: lc0.p/src_neural_blas_winograd_convolution3.cc.o: in function
lczero::Convolution1<false>::Forward(unsigned int, unsigned int, unsigned int, float const*, float const*, float*)': convolution1.cc:(.text+0x2994): undefined reference to
cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const, int, float const, int, float, float, int)' /usr/bin/ld: lc0.p/src_neural_blas_fully_connected_layer.cc.o: in function `lczero::FullyConnectedLayercblas_sgemv(CBLAS_ORDER, CBLAS_TRANSPOSE, int, int, float, float const*, int, float const*, int, float, float*, int)' /usr/bin/ld: lc0.p/src_neural_blas_fully_connected_layer.cc.o: in function
lczero::FullyConnectedLayercblas_sdot(int, float const*, int, float const*, int)' /usr/bin/ld: lc0.p/src_neural_blas_winograd_convolution3.cc.o: in function
lczero::WinogradConvolution3lczero::WinogradConvolution3<false>::Forward(unsigned int, unsigned int, unsigned int, float const*, float const*, float*)': winograd_convolution3.cc:(.text._ZN6lczero20WinogradConvolution3ILb0EE7ForwardEjjjPKfS3_Pf[_ZN6lczero20WinogradConvolution3ILb0EE7ForwardEjjjPKfS3_Pf]+0xb8): undefined reference to
cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const, int, float const, int, float, float*, int)' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.