https://bugs.kde.org/show_bug.cgi?id=430872

            Bug ID: 430872
           Summary: Fails to build on RISC-V due to failing to link with
                    atomics
           Product: krita
           Version: 4.4.1
          Platform: Debian unstable
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: General
          Assignee: krita-bugs-n...@kde.org
          Reporter: jsc...@posteo.net
  Target Milestone: ---

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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to