Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. ld: cannot find atomic
Forum Update on Monday, May 27th 2025

ld: cannot find atomic

Scheduled Pinned Locked Moved Solved Qt 6
6 Posts 2 Posters 677 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    debian
    wrote on last edited by
    #1

    Hello!
    I was cross-compile Qt-6.2.0 for mipsel, Qt was found external libatomic and write this is to prl-file

    libQt6Core.prl

    QMAKE_PRL_BUILD_DIR = /tmp/firmware/build-sml723x/qtbase-6.2.0/src/corelib
    QMAKE_PRL_TARGET = libQt6Core.so
    QMAKE_PRL_CONFIG = shared
    QMAKE_PRL_VERSION = 6.2.0
    QMAKE_PRL_LIBS = -latomic
    QMAKE_PRL_LIBS_FOR_CMAKE = -latomic
    

    libQt6Network.prl

    QMAKE_PRL_BUILD_DIR = /tmp/firmware/build-sml723x/qtbase-6.2.0/src/network
    QMAKE_PRL_TARGET = libQt6Network.so
    QMAKE_PRL_CONFIG = shared
    QMAKE_PRL_VERSION = 6.2.0
    QMAKE_PRL_LIBS = $$[QT_INSTALL_LIBS]/libQt6Core.so -latomic
    QMAKE_PRL_LIBS_FOR_CMAKE = $$[QT_INSTALL_LIBS]/libQt6Core.so;-latomic
    

    Now I try rebuild app, it use pro-file, but at link is fail with message ld: cannot find atomic: No such file or directory
    I was inspect Makefile and found strange

    ....................
    LIBS          = $(SUBLIBS) -L/tmp/firmware/staging_sml723x/usr/lib -L../qmap_parser -lqmapparser /tmp/firmware/staging_sml723x/qt6_bmips4380/lib/libQt6Gui.so /tmp/firmware/staging_sml723x/qt6_bmips4380/lib/libQt6Core.so -latomic -lpthread atomic  -Wl,-rpath-link,/tmp/firmware/staging_sml723x/usr/lib
    

    After this I run qmake at debug mode and it output contain follow lines

    ................
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:20: LD_USES := LIBATOMIC
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:21: entering loop for nu 
    over LIBATOMIC
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:21: loop iteration "LIBAT
    OMIC"
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:21: entering block
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: NOT
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: evaluating test funct
    ion "defined"
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: calling built-in defi
    ned(QMAKE_LIBS_LIBATOMIC, var)
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: test function returne
    d true
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: AND
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:23: skipped test function
     "error"
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:25: calling built-in $$ev
    al(QMAKE_LIBDIR_LIBATOMIC)
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:25: QMAKE_LIBDIR := /tmp/
    firmware/staging_sml723x/usr/lib
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:27: condition "android" i
    s false
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:27: taking 'else' branch
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:27: entering block
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:31: condition "debug" is 
    false
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:31: taking 'else' branch
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:31: entering block
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: calling built-in $$ev
    al(QMAKE_LIBS_LIBATOMIC_RELEASE)
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: calling built-in $$ev
    al(QMAKE_LIBS_LIBATOMIC)
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: LIBS := /tmp/firmware/staging_sml723x/qt6_bmips4380/lib/libQt6Core.so -lpthread atomic
    DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: leaving block, okey=true
    ...........
    

    Look like what qmake_use.prf add atomic to list of libraries.

    How can I fix this is?
    Thnak you.

    kshegunovK 1 Reply Last reply
    0
    • D Offline
      D Offline
      debian
      wrote on last edited by
      #5

      My workaround

      sed 's/atomic/-latomic/' --in-place=.org $(QT_INSTALL_DIR)/mkspecs/modules/qt_lib_core_private.pri
      

      https://bugreports.qt.io/browse/QTBUG-97728

      1 Reply Last reply
      0
      • D debian

        Hello!
        I was cross-compile Qt-6.2.0 for mipsel, Qt was found external libatomic and write this is to prl-file

        libQt6Core.prl

        QMAKE_PRL_BUILD_DIR = /tmp/firmware/build-sml723x/qtbase-6.2.0/src/corelib
        QMAKE_PRL_TARGET = libQt6Core.so
        QMAKE_PRL_CONFIG = shared
        QMAKE_PRL_VERSION = 6.2.0
        QMAKE_PRL_LIBS = -latomic
        QMAKE_PRL_LIBS_FOR_CMAKE = -latomic
        

        libQt6Network.prl

        QMAKE_PRL_BUILD_DIR = /tmp/firmware/build-sml723x/qtbase-6.2.0/src/network
        QMAKE_PRL_TARGET = libQt6Network.so
        QMAKE_PRL_CONFIG = shared
        QMAKE_PRL_VERSION = 6.2.0
        QMAKE_PRL_LIBS = $$[QT_INSTALL_LIBS]/libQt6Core.so -latomic
        QMAKE_PRL_LIBS_FOR_CMAKE = $$[QT_INSTALL_LIBS]/libQt6Core.so;-latomic
        

        Now I try rebuild app, it use pro-file, but at link is fail with message ld: cannot find atomic: No such file or directory
        I was inspect Makefile and found strange

        ....................
        LIBS          = $(SUBLIBS) -L/tmp/firmware/staging_sml723x/usr/lib -L../qmap_parser -lqmapparser /tmp/firmware/staging_sml723x/qt6_bmips4380/lib/libQt6Gui.so /tmp/firmware/staging_sml723x/qt6_bmips4380/lib/libQt6Core.so -latomic -lpthread atomic  -Wl,-rpath-link,/tmp/firmware/staging_sml723x/usr/lib
        

        After this I run qmake at debug mode and it output contain follow lines

        ................
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:20: LD_USES := LIBATOMIC
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:21: entering loop for nu 
        over LIBATOMIC
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:21: loop iteration "LIBAT
        OMIC"
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:21: entering block
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: NOT
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: evaluating test funct
        ion "defined"
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: calling built-in defi
        ned(QMAKE_LIBS_LIBATOMIC, var)
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: test function returne
        d true
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:22: AND
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:23: skipped test function
         "error"
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:25: calling built-in $$ev
        al(QMAKE_LIBDIR_LIBATOMIC)
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:25: QMAKE_LIBDIR := /tmp/
        firmware/staging_sml723x/usr/lib
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:27: condition "android" i
        s false
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:27: taking 'else' branch
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:27: entering block
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:31: condition "debug" is 
        false
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:31: taking 'else' branch
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:31: entering block
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: calling built-in $$ev
        al(QMAKE_LIBS_LIBATOMIC_RELEASE)
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: calling built-in $$ev
        al(QMAKE_LIBS_LIBATOMIC)
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: LIBS := /tmp/firmware/staging_sml723x/qt6_bmips4380/lib/libQt6Core.so -lpthread atomic
        DEBUG 1: /tmp/firmware/staging_sml723x/qt6_bmips4380/mkspecs/features/qmake_use.prf:34: leaving block, okey=true
        ...........
        

        Look like what qmake_use.prf add atomic to list of libraries.

        How can I fix this is?
        Thnak you.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #2

        @debian said in ld: cannot find atomic:

        How can I fix this is?

        Install the libatomic library package.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • D Offline
          D Offline
          debian
          wrote on last edited by
          #3

          Sorry, I don't understand you.
          Qt can't be build without atomic support, so this is support present, but it present as external library

          $ find toolchain/mipsel-rtk-linux-uclibc/ -name *atomic.so*
          toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/lib/libatomic.so
          toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/lib/libatomic.so.1.2.0
          toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/lib/libatomic.so.1
          toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/sysroot/lib/libatomic.so
          toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/sysroot/lib/libatomic.so.1.2.0
          toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/sysroot/lib/libatomic.so.1
          

          Problem in incorrect addititonal library name, LIBS contain correct -latomic and incorrect atomic.
          Question - why incorrect library name present at LIBS?

          kshegunovK 1 Reply Last reply
          0
          • D Offline
            D Offline
            debian
            wrote on last edited by
            #4

            I think I found atomic source, this is mkspecs/modules/qt_lib_core_private.pri

            ..............
            QMAKE_LIBS_LIBATOMIC = atomic
            .............
            

            I was change this is to QMAKE_LIBS_LIBATOMIC = -latomic and problem was solved

            1 Reply Last reply
            0
            • D Offline
              D Offline
              debian
              wrote on last edited by
              #5

              My workaround

              sed 's/atomic/-latomic/' --in-place=.org $(QT_INSTALL_DIR)/mkspecs/modules/qt_lib_core_private.pri
              

              https://bugreports.qt.io/browse/QTBUG-97728

              1 Reply Last reply
              0
              • D debian

                Sorry, I don't understand you.
                Qt can't be build without atomic support, so this is support present, but it present as external library

                $ find toolchain/mipsel-rtk-linux-uclibc/ -name *atomic.so*
                toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/lib/libatomic.so
                toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/lib/libatomic.so.1.2.0
                toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/lib/libatomic.so.1
                toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/sysroot/lib/libatomic.so
                toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/sysroot/lib/libatomic.so.1.2.0
                toolchain/mipsel-rtk-linux-uclibc/mipsel-rtk-linux-uclibc/sysroot/lib/libatomic.so.1
                

                Problem in incorrect addititonal library name, LIBS contain correct -latomic and incorrect atomic.
                Question - why incorrect library name present at LIBS?

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #6

                @debian said in ld: cannot find atomic:

                Problem in incorrect addititonal library name, LIBS contain correct -latomic and incorrect atomic.

                Sorry missed that. No idea on the question. The qmake feature appears to be incorrect in some way, but I have no clue why.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved