this happens while building on ARCH=rsicv, both occur with gcc-10.2.0, 11.1.0 /usr/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: .obj/qv4typedarray.o: in function `.L932': qv4typedarray.cpp:(.text._Z8atomicOrIsEyPcN3QV45ValueE[_Z8atomicOrIsEyPcN3QV45ValueE]+0xa2): undefined reference to `__atomic_fetch_or_2' /usr/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: .obj/qv4typedarray.o: in function `.L1156': qv4typedarray.cpp:(.text._Z21atomicCompareExchangeIsEyPcN3QV45ValueES2_[_Z21atomicCompareExchangeIsEyPcN3QV45ValueES2_]+0xe8): undefined reference to `__atomic_compare_exchange_2' /usr/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: .obj/qv4typedarray.o: in function `.L1373': qv4typedarray.cpp:(.text._Z21atomicCompareExchangeItEyPcN3QV45ValueES2_[_Z21atomicCompareExchangeItEyPcN3QV45ValueES2_]+0xe4): undefined reference to `__atomic_compare_exchange_2' /usr/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: .obj/qv4typedarray.o: in function `.L1412': qv4typedarray.cpp:(.text._Z21atomicCompareExchangeIaEyPcN3QV45ValueES2_[_Z21atomicCompareExchangeIaEyPcN3QV45ValueES2_]+0xe8): undefined reference to `__atomic_compare_exchange_1' /usr/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: .obj/qv4typedarray.o: in function `.L1451': qv4typedarray.cpp:(.text._Z21atomicCompareExchangeIhEyPcN3QV45ValueES2_[_Z21atomicCompareExchangeIhEyPcN3QV45ValueES2_]+0xe4): undefined reference to `__atomic_compare_exchange_1' collect2: error: ld returned 1 exit status Reproducible: Always
Created attachment 709434 [details] full build log
The same bug happened to me as well on qemu riscv64. I modified the source code in the portage tmp working folder as a quick hack. In file src/qml/Makefile, add '-latomic' to "LIBS=..." It passes the compilation and seems to work fine.
probably we could fix it as similar as this commit? https://github.com/MariaDB/server/pull/978/commits/27b380ed8ee8457597117ed3fae155b7ac94d60a
this is a simple patch that works for me.. --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -19,6 +19,7 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 # Ensure this gcc optimization is switched off for mips platforms to avoid trouble with JIT. gcc:isEqual(QT_ARCH, "mips"): QMAKE_CXXFLAGS += -fno-reorder-blocks +gcc:isEqual(QT_ARCH, "riscv64"): LIBS += -latomic DEFINES += QT_NO_FOREACH
This bug has been around in Qt 5.2 since May of last year. Check out <https://bugreports.qt.io/browse/QTBUG-84580>. If anyone can confirm this bug in Qt6, please report it to upstream as well. I will also try testing Qt 6.
(In reply to Yixun Lan from comment #4) > this is a simple patch that works for me.. > > --- a/src/qml/qml.pro > +++ b/src/qml/qml.pro > @@ -19,6 +19,7 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 > > # Ensure this gcc optimization is switched off for mips platforms to avoid > trouble with JIT. > gcc:isEqual(QT_ARCH, "mips"): QMAKE_CXXFLAGS += -fno-reorder-blocks > +gcc:isEqual(QT_ARCH, "riscv64"): LIBS += -latomic > > DEFINES += QT_NO_FOREACH I don't think this is the right fix, it would mean every consumer of the QAtomic stuff (both inside and outside of Qt) has to be patched to link with -latomic. A likely better fix is to have qtcore detect the need for -latomic at configure time and, if needed, link to it. That being said, I think we can merge the proposed workaround as it doesn't affect other arches and a better fix is unlikely to come any time soon.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=980dc7e8d6fd082c77650dc05051af0f7e1b8b3a commit 980dc7e8d6fd082c77650dc05051af0f7e1b8b3a Author: Yixun Lan <dlan@gentoo.org> AuthorDate: 2021-07-17 15:18:56 +0000 Commit: Yixun Lan <dlan@gentoo.org> CommitDate: 2021-07-17 22:45:21 +0000 dev-qt/qtdeclarative: riscv: fix missing atomic library this will workaroud the error when build in ARCH=riscv, tested with gcc-11 A likely better fix is to have qtcore detect the need for -latomic at configure time and, if needed, link to it Bug: https://bugs.gentoo.org/790689 Closes: https://github.com/gentoo/gentoo/pull/21689 Package-Manager: Portage-3.0.19, Repoman-3.0.3 Signed-off-by: Yixun Lan <dlan@gentoo.org> .../files/qtdeclarative-5.15.2-riscv-atomic.patch | 12 ++++++++++++ dev-qt/qtdeclarative/qtdeclarative-5.15.2.ebuild | 1 + 2 files changed, 13 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/qt.git/commit/?id=d841a158e7300cdacdf53c8e79c1fe368d36f7d5 commit d841a158e7300cdacdf53c8e79c1fe368d36f7d5 Author: Yixun Lan <dlan@gentoo.org> AuthorDate: 2021-07-17 15:18:56 +0000 Commit: Andreas Sturmlechner <asturm@gentoo.org> CommitDate: 2021-08-10 18:33:01 +0000 dev-qt/qtdeclarative: riscv: fix missing atomic library this will workaroud the error when build in ARCH=riscv, tested with gcc-11 A likely better fix is to have qtcore detect the need for -latomic at configure time and, if needed, link to it Bug: https://bugs.gentoo.org/790689 Package-Manager: Portage-3.0.19, Repoman-3.0.3 Signed-off-by: Yixun Lan <dlan@gentoo.org> Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> .../files/qtdeclarative-5.15.2-riscv-atomic.patch | 12 ++++++++++++ dev-qt/qtdeclarative/qtdeclarative-5.15.9999.ebuild | 1 + 2 files changed, 13 insertions(+)
Is the linked KDE MR relevant to us in any way?
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a3d629983330ad7148cbfc5b7b79083362124f4 commit 8a3d629983330ad7148cbfc5b7b79083362124f4 Author: Andreas Sturmlechner <asturm@gentoo.org> AuthorDate: 2022-03-30 18:13:29 +0000 Commit: Andreas Sturmlechner <asturm@gentoo.org> CommitDate: 2022-03-30 18:56:24 +0000 dev-qt/qtdeclarative: Fix patchset, drop riscv patch Previous patchset mistakenly did not contain full Qt5PatchCollection already on top of 5.15.2-r15. A proper riscv patch is now part of qtcore-5.15.3. Closes: https://bugs.gentoo.org/790689 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> dev-qt/qtdeclarative/Manifest | 1 + .../qtdeclarative/qtdeclarative-5.15.3-r1.ebuild | 66 ++++++++++++++++++++++ 2 files changed, 67 insertions(+)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/qt.git/commit/?id=5fd72895b4a0c9c4bf1a143c3fa8d9b8745f4e89 commit 5fd72895b4a0c9c4bf1a143c3fa8d9b8745f4e89 Author: Andreas Sturmlechner <asturm@gentoo.org> AuthorDate: 2022-03-30 18:13:29 +0000 Commit: Andreas Sturmlechner <asturm@gentoo.org> CommitDate: 2022-04-01 18:08:25 +0000 dev-qt/qtdeclarative: Drop riscv patch A proper riscv patch is now part of qtcore-5.15.3. Closes: https://bugs.gentoo.org/790689 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> .../files/qtdeclarative-5.15.2-riscv-atomic.patch | 12 ------------ dev-qt/qtdeclarative/qtdeclarative-5.15.3.9999.ebuild | 1 - 2 files changed, 13 deletions(-)