On 2020-09-28 15:12, Otto Kekäläinen wrote:
> After uploading mariadb-10.5 1:10.5.5-1 to Debian the build still
> fails with these:
> 
> /usr/bin/ld: /usr/include/c++/10/bits/atomic_base.h:464: undefined
> reference to `__atomic_compare_exchange_1'
> 
> The odd thing is that an identical build on Ubuntu Groovy passes OK:
> https://launchpadlibrarian.net/499652421/buildlog_ubuntu-groovy-riscv64.mariadb-10.5_1%3A10.5.5-1~ubuntu20.10.1~1601274184.7ad164279+master_BUILDING.txt.gz

Ubuntu has patched their version of cmake to link with -latomic on
riscv64. While patching cmake is a really good idea, the fix is wrong,
the correct think to do is to link with -pthread instead of -lpthread,
and do that for all architectures.

This is the strategy followed for mariadb-10.5 in the attached patch. I
have tested it and it builds fine on Debian.

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurel...@aurel32.net                 http://www.aurel32.net
--- mariadb-10.5-10.5.5/debian/patches/riscv64-link-pthread.patch
+++ mariadb-10.5-10.5.5/debian/patches/riscv64-link-pthread.patch
@@ -0,0 +1,10 @@
+--- mariadb-10.5-10.5.5.orig/configure.cmake
++++ mariadb-10.5-10.5.5/configure.cmake
+@@ -135,6 +135,7 @@ IF(UNIX)
+   IF(NOT LIBRT)
+     MY_SEARCH_LIBS(clock_gettime rt LIBRT)
+   ENDIF()
++  set(THREADS_PREFER_PTHREAD_FLAG ON)
+   FIND_PACKAGE(Threads)
+ 
+   SET(CMAKE_REQUIRED_LIBRARIES 
diff -Nru mariadb-10.5-10.5.5/debian/patches/series mariadb-10.5-10.5.5/debian/patches/series
--- mariadb-10.5-10.5.5/debian/patches/series
+++ mariadb-10.5-10.5.5/debian/patches/series
@@ -13,3 +13,4 @@
 prevent-executable-stack-due-to-objects-compiled-fro.patch
 env-perl-usr-bin-perl.patch
 fix-spelling.patch
+riscv64-link-pthread.patch

Reply via email to