Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 711788 - dev-qt/qt-creator-4.10.1[clang] fails to link with sys-devel/clang:10
Summary: dev-qt/qt-creator-4.10.1[clang] fails to link with sys-devel/clang:10
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Davide Pesavento (RETIRED)
URL:
Whiteboard: fixed in 4.12.3
Keywords: PullRequest
: 730178 730236 730256 730620 730652 (view as bug list)
Depends on:
Blocks: llvm-10
  Show dependency tree
 
Reported: 2020-03-07 14:07 UTC by i.Dark_Templar
Modified: 2020-07-17 09:32 UTC (History)
12 users (show)

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


Attachments
build.log.bz2 (build.log.bz2,68.06 KB, application/x-bzip)
2020-03-07 14:08 UTC, i.Dark_Templar
Details
qt-creator-4.10.1-llvm9.patch (qt-creator-4.10.1-llvm9.patch,1.25 KB, patch)
2020-07-17 09:14 UTC, Fabio Rossi
Details | Diff
qt-creator-4.10.1-llvm10.patch (qt-creator-4.10.1-llvm10.patch,12.64 KB, patch)
2020-07-17 09:14 UTC, Fabio Rossi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description i.Dark_Templar 2020-03-07 14:07:32 UTC
dev-qt/qt-creator fails to build with sys-devel/clang:10. New version of clang is built without split libraries, and qt-creator fails to link to resulting clang libraries.

Reproducible: Always

Steps to Reproduce:
1. Copy and modify qt-creator ebuild to drop llvm/clang-8 compatibility restriction.
Applying following diff should be enough:

--- /usr/portage/dev-qt/qt-creator/qt-creator-4.10.1.ebuild     2019-12-11 02:41:53.000000000 +0300
+++ ./qt-creator-4.10.1.ebuild  2020-03-07 15:48:31.148920032 +0300
@@ -2,7 +2,6 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-LLVM_MAX_SLOT=8
 PLOCALES="cs da de fr ja pl ru sl uk zh-CN zh-TW"
 
 inherit llvm qmake-utils virtualx xdg
@@ -56,7 +55,7 @@
        >=dev-qt/qtwidgets-${QT_PV}
        >=dev-qt/qtx11extras-${QT_PV}
        >=dev-qt/qtxml-${QT_PV}
-       clang? ( sys-devel/clang:8= )
+       clang? ( sys-devel/clang:= )
        designer? ( >=dev-qt/designer-${QT_PV} )
        help? (
                >=dev-qt/qthelp-${QT_PV}

2. Apply upstream patches to fix compiling qt-creator with recent clang versions.
At least following two changes are required:
https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=6ec8017bc675692f3d325c0cd95c9c4c7a79db7d
https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=44023c8f43fd8daf8b7be305ea6d99b8b56fa551

3. ACCEPT_KEYWORDS="~*" emerge -1 clang:10
4. ACCEPT_KEYWORDS="~*" USE="clang" emerge -1 qt-creator
Actual Results:  
Build fails:

x86_64-pc-linux-gnu-g++ -Wl,-O1 -Wl,--as-needed -Wl,-z,origin '-Wl,-rpath,$ORIGIN:$ORIGIN/..:$ORIGIN/../lib64/qtcreator' -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath,/usr/lib64/llvm/10
/lib64 -Wl,--exclude-libs,ALL -shared -Wl,-soname,libClangFormat.so -o libClangFormat.so .obj/release-shared/clangformatbaseindenter.o .obj/release-shared/clangformatconfigwidget.o .o
bj/release-shared/clangformatindenter.o .obj/release-shared/clangformatplugin.o .obj/release-shared/clangformatsettings.o .obj/release-shared/clangformatutils.o .obj/release-shared/mo
c_clangformatconfigwidget.o .obj/release-shared/moc_clangformatplugin.o   -L/var/tmp/portage/dev-qt/qt-creator-4.10.1/work/qt-creator-opensource-src-4.10.1/lib64/qtcreator -L/var/tmp/
portage/dev-qt/qt-creator-4.10.1/work/qt-creator-opensource-src-4.10.1/lib64/qtcreator/plugins -lCppTools -lProjectExplorer -lCppEditor -lCore -lTextEditor -lQtcSsh -lCPlusPlus -lAggr
egation -lExtensionSystem -lUtils -lKSyntaxHighlighting -L/usr/lib64/llvm/10/lib64 -lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic -lL
LVM-10 /usr/lib64/libQt5Widgets.so /usr/lib64/libQt5Gui.so /usr/lib64/libQt5Concurrent.so /usr/lib64/libQt5Network.so /usr/lib64/libQt5Core.so /usr/lib64/libGL.so -lpthread   
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lclangFormat
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lclangToolingInclusions
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lclangToolingCore
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lclangRewrite
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lclangLex
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lclangBasic
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:358: ../../../lib64/qtcreator/plugins/libClangFormat.so] Error 1

Expected Results:  
Successful build of qt-creator

As far as I can see, clangFormat and other libraries are hardcoded in qt-creator plugin's build, but they're missing now for clang:10 in Gentoo:

https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/shared/clang/clang_installation.pri#n210

Looks similar to bug #710306

Everything builds fine if clang:9 is used instead of clang:10 while following steps described above.
Comment 1 i.Dark_Templar 2020-03-07 14:08:37 UTC
Created attachment 617402 [details]
build.log.bz2

Full compressed build log
Comment 2 Tiernan Hubble 2020-03-14 19:49:34 UTC
This is related to bug #710306. In the >=clang-10 ebuilds, the "-DBUILD_SHARED_LIBS" flag has been set to "OFF". This causes problems when building various packages, including qt-creator and mesa. This is a list of broken packages for Fedora, where they're considering making the same change: https://fedoraproject.org/wiki/Changes/Stop-Shipping-Individual-Component-Libraries-In-clang-lib-Package#Dependencies

This change was apparently made to fix mlir, but it is breaking other packages. I'm not sure if any of these packages have upstream fixes or patches.
Comment 3 Tomasz Golinski 2020-05-04 21:22:10 UTC
Same thing happens with dev-qt/qt-creator-4.8.2 (it doesn't have LLVM_MAX_SLOT). I have both llvm:9 and llvm:10 installed.
Comment 4 Larry the Git Cow gentoo-dev 2020-06-25 07:11:14 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24dd58fe4592775fe430ee98d17ecb7825a02ade

commit 24dd58fe4592775fe430ee98d17ecb7825a02ade
Author:     Peter Levine <plevine457@gmail.com>
AuthorDate: 2020-05-08 07:11:14 +0000
Commit:     Jason A. Donenfeld <zx2c4@gentoo.org>
CommitDate: 2020-06-25 07:11:04 +0000

    dev-qt/qt-creator: Support clang-10
    
    Builds and runs without issue using patch from
    https://codereview.qt-project.org/c/qt-creator/qt-creator/+/299377
    
    Closes: https://bugs.gentoo.org/720240
    Closes: https://bugs.gentoo.org/711788
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Peter Levine <plevine457@gmail.com>
    Signed-off-by: Jason A. Donenfeld <zx2c4@gentoo.org>

 .../files/qt-creator-4.12.0-dylib-fix.patch        | 84 ++++++++++++++++++++++
 dev-qt/qt-creator/qt-creator-9999.ebuild           | 13 +++-
 2 files changed, 95 insertions(+), 2 deletions(-)
Comment 5 Andreas Sturmlechner gentoo-dev 2020-06-30 06:41:26 UTC
*** Bug 730178 has been marked as a duplicate of this bug. ***
Comment 6 Andreas Sturmlechner gentoo-dev 2020-06-30 11:34:12 UTC
*** Bug 730236 has been marked as a duplicate of this bug. ***
Comment 7 Mike Limansky 2020-06-30 11:53:50 UTC
Should the fixed version be stabilized now, because LLVM 10 became stable?
Comment 8 Andreas Sturmlechner gentoo-dev 2020-06-30 12:09:03 UTC
(In reply to Mike Limansky from comment #7)
> Should the fixed version be stabilized now, because LLVM 10 became stable?
Hence bug 720240.
Comment 9 Mike Limansky 2020-06-30 12:24:01 UTC
(In reply to Andreas Sturmlechner from comment #8)
> (In reply to Mike Limansky from comment #7)
> > Should the fixed version be stabilized now, because LLVM 10 became stable?
> Hence bug 720240.

Well, it looks like it's a pretty long task, because it's require Qt 5.15. Maybe the default USE flags should be changed? To make things just work by default?
Comment 10 Andreas Sturmlechner gentoo-dev 2020-06-30 17:42:17 UTC
*** Bug 730256 has been marked as a duplicate of this bug. ***
Comment 11 Andreas Sturmlechner gentoo-dev 2020-07-04 20:57:41 UTC
*** Bug 730620 has been marked as a duplicate of this bug. ***
Comment 12 Andreas Sturmlechner gentoo-dev 2020-07-04 20:57:55 UTC
*** Bug 730652 has been marked as a duplicate of this bug. ***
Comment 13 Fabio Rossi 2020-07-16 08:08:29 UTC
as the latest qt-creator requires Qt 5.15, is it possible to backport the patch to qt-creator-4.10.1?
Comment 14 Fabio Rossi 2020-07-17 09:13:23 UTC
I have backported the patches for LLVM 9 and 10 to qt-creator-4.10.1, simply by taking the relevant commits from upstream git repository. Morever the ebuild needs a few simple changes
Comment 15 Fabio Rossi 2020-07-17 09:14:21 UTC
Created attachment 649674 [details, diff]
qt-creator-4.10.1-llvm9.patch
Comment 16 Fabio Rossi 2020-07-17 09:14:50 UTC
Created attachment 649676 [details, diff]
qt-creator-4.10.1-llvm10.patch
Comment 17 Fabio Rossi 2020-07-17 09:15:31 UTC
Here are the changes for the ebuild

--- /usr/portage/dev-qt/qt-creator/qt-creator-4.10.1.ebuild	2020-07-17 10:56:50.238644177 +0200
+++ /var/lib/layman/__mine__/dev-qt/qt-creator/qt-creator-4.10.1.ebuild	2020-07-17 10:56:57.422643501 +0200
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-LLVM_MAX_SLOT=8
+LLVM_MAX_SLOT=10
 PLOCALES="cs da de fr ja pl ru sl uk zh-CN zh-TW"
 
 inherit llvm qmake-utils virtualx xdg
@@ -96,6 +96,12 @@
 done
 unset x
 
+PATCHES=(
+	"${FILESDIR}"/${P}-llvm9.patch
+	"${FILESDIR}"/${P}-llvm10.patch
+	"${FILESDIR}"/${PN}-4.12.0-dylib-fix.patch
+)
+
 pkg_setup() {
 	use clang && llvm_pkg_setup
 }
Comment 18 Fabio Rossi 2020-07-17 09:17:05 UTC
I don't know which is the purpose of the qt-creator-4.12.0-libclangformat-ide.patch but version 4.10.1 compiles successfully, is needed for runtime?
Comment 19 Fabio Rossi 2020-07-17 09:17:35 UTC
(In reply to Fabio Rossi from comment #18)
> I don't know which is the purpose of the
> qt-creator-4.12.0-libclangformat-ide.patch but version 4.10.1 compiles
> successfully, is needed for runtime?

I mean compiles successfully even without it
Comment 20 Fabio Rossi 2020-07-17 09:32:24 UTC
sorry I missed to update the clang dep in the ebuild:

--- /usr/portage/dev-qt/qt-creator/qt-creator-4.10.1.ebuild	2020-07-17 10:56:50.238644177 +0200
+++ /var/lib/layman/__mine__/dev-qt/qt-creator/qt-creator-4.10.1.ebuild	2020-07-17 11:27:48.442469303 +0200
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-LLVM_MAX_SLOT=8
+LLVM_MAX_SLOT=10
 PLOCALES="cs da de fr ja pl ru sl uk zh-CN zh-TW"
 
 inherit llvm qmake-utils virtualx xdg
@@ -56,7 +56,7 @@
 	>=dev-qt/qtwidgets-${QT_PV}
 	>=dev-qt/qtx11extras-${QT_PV}
 	>=dev-qt/qtxml-${QT_PV}
-	clang? ( sys-devel/clang:8= )
+	clang? ( <sys-devel/clang-$((LLVM_MAX_SLOT + 1)):= )
 	designer? ( >=dev-qt/designer-${QT_PV} )
 	help? (
 		>=dev-qt/qthelp-${QT_PV}
@@ -96,6 +96,12 @@
 done
 unset x
 
+PATCHES=(
+	"${FILESDIR}"/${P}-llvm9.patch
+	"${FILESDIR}"/${P}-llvm10.patch
+	"${FILESDIR}"/${PN}-4.12.0-dylib-fix.patch
+)
+
 pkg_setup() {
 	use clang && llvm_pkg_setup
 }