Hi, Krita [fails to build on RISC-V with Debian unstable](https://buildd.debian.org/status/package.php?p=krita&suite=sid), and although I don't have a patch, I'm pretty sure I've found the cause. (I'm more of a GLib/GTK person myself.) It fails like /usr/bin/ld: CMakeFiles/kritaimage.dir/tiles3/kis_tile_data_store.cc.o: in function `Leapfrog<ConcurrentMap<int, KisTileData*, DefaultKeyTraits<int>, DefaultValueTraits<KisTileData*> > >::TableMigration::run()': ./obj-riscv64-linux-gnu/libs/image/./libs/image/3rdparty/lock_free_map/leapfrog.h:475: undefined reference to `__atomic_exchange_1' ``` The CMake module that tries to check atomic support seems to be doing this: if (LLVM_COMPILER_IS_GCC_COMPATIBLE) # First check if atomics work without the library. check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB) # If not, check if the library exists, and atomics work with it. if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB) check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) On RISC-V, atomics of four and eight bytes do not require library support (such as with `-pthread`), but for one and two bytes it does. Hence if this check is missing out on checking the need to link for one-byte atomics, that would explain the failure. For a more eloquent explanation, here's a similar issue in zstd that was fixed: https://github.com/facebook/zstd/pull/1103
This issue seems to be fixed by this merge request, which removes the internal CheckAtomic.cmake and instead uses the more robust one from extra-cmake-modules: https://invent.kde.org/graphics/krita/-/merge_requests/498
I ran into the same problem while trying to build Krita for RISC-V 64 bit. Going to try the patch in the PR.
Marking as confirmed because of an upcoming duplicate bug.
*** Bug 443817 has been marked as a duplicate of this bug. ***
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1099
Git commit f963f4f42b66715405c9bf087c630df8725332a2 by Halla Rempt, on behalf of L. E. Segovia. Committed on 19/10/2021 at 07:45. Pushed by rempt into branch 'master'. Upgrade CheckAtomic module to a copy of ECM 5.75 I am making this commit since !498 seems to not have progressed for quite a few months. Related: bug 443817 Closes !498 M +61 -59 cmake/modules/CheckAtomic.cmake https://invent.kde.org/graphics/krita/commit/f963f4f42b66715405c9bf087c630df8725332a2
Git commit 8e7ccd3cd7601ac4c27696eafd8cd1bb8a40296c by L. E. Segovia. Committed on 22/10/2021 at 21:23. Pushed by lsegovia into branch 'master'. Fix compiler check on CheckAtomic LLVM_COMPILER_IS_GCC_COMPATIBLE is set by another module in LLVM, which neither we nor ECM copy on their source. Related: bug 443817 M +14 -4 cmake/modules/CheckAtomic.cmake https://invent.kde.org/graphics/krita/commit/8e7ccd3cd7601ac4c27696eafd8cd1bb8a40296c
Git commit 410ed417d5ac317f85eefc0f3b5c437b53537d07 by L. E. Segovia. Committed on 22/10/2021 at 21:56. Pushed by lsegovia into branch 'krita/5.0'. Upgrade CheckAtomic module to a copy of ECM 5.75 I am making this commit since !498 seems to not have progressed for quite a few months. Related: bug 443817 Closes !498 (cherry picked from commit f963f4f42b66715405c9bf087c630df8725332a2) M +61 -59 cmake/modules/CheckAtomic.cmake https://invent.kde.org/graphics/krita/commit/410ed417d5ac317f85eefc0f3b5c437b53537d07
Git commit daa53222c830c9b7a5b6c9e8efb322233d7cbc67 by L. E. Segovia. Committed on 22/10/2021 at 21:56. Pushed by lsegovia into branch 'krita/5.0'. Fix compiler check on CheckAtomic LLVM_COMPILER_IS_GCC_COMPATIBLE is set by another module in LLVM, which neither we nor ECM copy on their source. Related: bug 443817 (cherry picked from commit 8e7ccd3cd7601ac4c27696eafd8cd1bb8a40296c) M +14 -4 cmake/modules/CheckAtomic.cmake https://invent.kde.org/graphics/krita/commit/daa53222c830c9b7a5b6c9e8efb322233d7cbc67