Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 634760 - Qt linking problem with gold linker on arm
Summary: Qt linking problem with gold linker on arm
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-19 09:23 UTC by Alessandro Pezzato
Modified: 2017-12-22 12:17 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Pezzato 2017-10-19 09:23:27 UTC
I'm using a raspberry pi 3 (32bit)

I've installed dev-qt/qtquickcontrols2-5.7.1 and dev-qt/qtcore-5.7.1-r3

When I compile something with qmake, it ends with this error:

> /usr/lib/libQt5QuickTemplates2.so.5:(*IND*+0x0): multiple definition of `_edata'
> /usr/lib/libQt5QuickTemplates2.so.5:(*IND*+0x0): multiple definition of `__bss_start'
> /usr/lib/libQt5QuickTemplates2.so.5:(*IND*+0x0): multiple definition of `_end'


This seems to be caused by qt compiled with gold linker, as noted here: https://wiki.qt.io/Native_Build_of_Qt_5.4.1_on_a_Raspberry_Pi

> To compile Qt 5.7 in Rpi3, you need to add the flag -no-use-gold-linker to configure. Apparently gnu gold linker has issues with ARMv8

When emerging dev-qt/qtquickcontrols2 this appears in the log:

> armv7a-hardfloat-linux-gnueabi-g++ -Wl,-O1 -Wl,--as-needed -fuse-ld=gold -Wl,--enable-new-dtags -shared -o libqtquickcontrols2universalstyleplugin.so .obj/qtquickcontrols2universalstyleplugin.o .obj/qquickuniversalfocusrectangle.o .obj/qquickuniversalprogressring.o .obj/qquickuniversalprogressstrip.o .obj/qquickuniversalstyle.o .obj/qquickuniversaltheme.o .obj/qrc_qtquickcontrols2universalstyleplugin.o .obj/moc_qquickuniversalfocusrectangle_p.o .obj/moc_qquickuniversalprogressring_p.o .obj/moc_qquickuniversalprogressstrip_p.o .obj/moc_qquickuniversalstyle_p.o  -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lpthread -L/var/tmp/portage/dev-qt/qtquickcontrols2-5.7.1/work/qtquickcontrols2-opensource-src-5.7.1/lib -lQt5QuickTemplates2 -lQt5QuickControls2 -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lpthread

This is where the gold linker is enabled: "-fuse-ld=gold"

I guess it should be disabled removing it or replacing with "-fuse-ld=bfd"
Comment 1 Alessandro Pezzato 2017-10-19 09:47:26 UTC
I've found this in qt5-build.eclass line 605:

> # let configure automatically detect if GNU gold is available
> #-use-gold-linker

Note that it is commented, so Qt "configure" is finding the gold linker and using it. 


This is what Qt says about the gold linker: 

> # Example configure command below. We disable using the GNU gold
> # linker as it apparently has issues with ARMv8. In the configure
> # output check that "EGLFS GBM .......... yes" is present, otherwise
> # eglfs will not be functional.
> #
> # ./configure -release -opengl es2 -device linux-rpi3-vc4-g++ \
> #   -device-option CROSS_COMPILE=~/raspbian/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- \
> #   -sysroot ~/raspbian/sysroot \
> #   -prefix /usr/local/qt5pi -extprefix ~/raspbian/qt5pi -hostprefix ~/raspbian/qt5 \
> #   -v -nomake examples -nomake tests -no-use-gold-linker

(see file /usr/lib/qt5/mkspecs/devices/linux-rpi3-vc4-g++/qmake.conf)
Comment 2 Michael Palimaka (kensington) gentoo-dev 2017-10-19 12:43:01 UTC
This may be a duplicate of bug #623566.
Comment 3 Alessandro Pezzato 2017-10-19 13:25:33 UTC
It may be related to bug #623566. Nevertheless, Qt recommends turning off the golden compiler for ARMv8. I'm now building Qt manually, using the recommended configuration. I'll update you if this fixes this issue.
Comment 4 Alessandro Pezzato 2017-10-22 11:54:36 UTC
I've manually compiled Qt and it is working as expected. This seems to me an hint that the problem is in Qt ebuild/eclass.
Comment 5 Davide Pesavento (RETIRED) gentoo-dev 2017-10-29 16:57:25 UTC
(In reply to Alessandro Pezzato from comment #4)
> I've manually compiled Qt and it is working as expected. This seems to me an
> hint that the problem is in Qt ebuild/eclass.

No, it's not. It's a hint that the problem is in gold. We can add a workaround to qt5-build.eclass, but that doesn't fix the root problem. It also doesn't seem gentoo-specific, so maybe Qt upstream should add a blacklist or something to their configure-time gold detection mechanism.

What version of binutils are you using btw? Can you try a newer one?
Comment 6 Michael Palimaka (kensington) gentoo-dev 2017-12-10 11:51:57 UTC
I pushed a commit to the overlay to use the system linker:
https://gitweb.gentoo.org/proj/qt.git/commit/?id=fe45faae1a15c644db0420f33a67df5197c52fcc
Comment 7 Michael Palimaka (kensington) gentoo-dev 2017-12-22 12:17:31 UTC
I pushed this to main tree now:
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64b2ad10079f4c4931520ef102b35f672ee74d99