On 2020-01-09 14:18, Ximin Luo wrote: > Fabian Wolff: > > Thank you for your MR, Ximin! > > > > Do you need anything else? I see you haven't added -pthread anywhere yet; is > > this not necessary with CMake (maybe CMake adds it automatically?), and have > > you tried building on/for riscv64 again to verify that it works now? > > > > I only tried cross-compiling and in fact I get this error about pthreads: > > /usr/lib/gcc-cross/riscv64-linux-gnu/9/../../../../riscv64-linux-gnu/bin/ld: > cannot find -lpthreads > > z3's source code doesn't mention this flag so probably cmake is adding it > itself. > > $ rg -i pthreads /usr/share/cmake* > /usr/share/cmake-3.15/Modules/FindThreads.cmake > [..] > > So setting CMAKE_USE_PTHREADS might work.
Yep, I confirm that works. In short with the following patch, z3 builds natively on riscv64: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e2c8ac..e4f6b81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,6 +314,7 @@ endif() ################################################################################ # Threading support ################################################################################ +set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads) list(APPEND Z3_DEPENDENT_LIBS ${CMAKE_THREAD_LIBS_INIT}) -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://www.aurel32.net