ld: cannot find atomic
-
Hello!
I was cross-compile Qt-6.2.0 for mipsel, Qt was found external libatomic and write this is to prl-filelibQt6Core.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. -
My workaround
sed 's/atomic/-latomic/' --in-place=.org $(QT_INSTALL_DIR)/mkspecs/modules/qt_lib_core_private.pri
-
@debian said in ld: cannot find atomic:
How can I fix this is?
Install the libatomic library package.
-
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? -
My workaround
sed 's/atomic/-latomic/' --in-place=.org $(QT_INSTALL_DIR)/mkspecs/modules/qt_lib_core_private.pri
-
@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.