Bug 1386665

Summary: Build failure of texstudio against Qt >= 5.7
Product: [Fedora] Fedora Reporter: hannes <johannes.lips>
Component: qt5-qtbaseAssignee: Rex Dieter <rdieter>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: fedora, fmuro, itamar, jgrulich, johannes.lips, jreznik, kevin, lupinix.fedora, me, ovasik, rdieter, smparrish, than, umar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qt5-qtbase-5.7.1-9.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-09 20:26:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1404333    
Attachments:
Description Flags
build.log
none
root.log
none
Remove the version check macros for test none

Description hannes 2016-10-19 12:12:10 UTC
Description of problem:
Hi all,
unfortunately the build fails only on x86_64 for all newer fedora versions. It builds just fine on f24. I don't really know what's the root cause, but it seems to be related to a specific Qt/moc version.


List of failed builds, based on architecture:
http://koji.fedoraproject.org/koji/tasks?owner=hannes&state=all
Failed build log of x86_64 build:
https://kojipkgs.fedoraproject.org//work/tasks/8711/16058711/build.log

Version-Release number of selected component (if applicable):
Qt versions >= Qt in fedora 25

How reproducible:
see the build logs


https://sourceforge.net/p/texstudio/bugs/1938/

Comment 1 Rex Dieter 2016-10-19 12:35:49 UTC
It's failing at linking.

.obj/manhattanstyle.o: In function `ManhattanStyle::ManhattanStyle(QString const&)':
/builddir/build/BUILD/texstudio2.11.2/manhattanstyle.cpp:132: undefined reference to `vtable for ManhattanStyle'
.obj/manhattanstyle.o: In function `StyleAnimator::StyleAnimator(QObject*)':
/builddir/build/BUILD/texstudio2.11.2/styleanimator.h:90: undefined reference to `vtable for StyleAnimator'
.obj/manhattanstyle.o: In function `StyleAnimator::~StyleAnimator()':
/builddir/build/BUILD/texstudio2.11.2/styleanimator.h:85: undefined reference to `vtable for StyleAnimator'
.obj/manhattanstyle.o: In function `ManhattanStyle::~ManhattanStyle()':
/builddir/build/BUILD/texstudio2.11.2/manhattanstyle.cpp:137: undefined reference to `vtable for ManhattanStyle'
.obj/manhattanstyle.o: In function `StyleAnimator::~StyleAnimator()':
/builddir/build/BUILD/texstudio2.11.2/styleanimator.h:85: undefined reference to `vtable for StyleAnimator'
collect2: error: ld returned 1 exit status

Comment 2 hannes 2016-11-01 18:43:16 UTC
So this means, that it's the problem of texstudio? Since upstream said to me it's a fedora-only problem.
https://sourceforge.net/p/texstudio/bugs/1938/

Comment 3 Rex Dieter 2016-11-01 19:22:46 UTC
Ask them specifically if they've successfully built using Qt >= 5.7 or not

Comment 4 hannes 2016-11-01 20:24:37 UTC
If I am not totally mistaken they've built the Qt5 version against Qt 5.5
For more details, please see the OBS repository.



[1] https://build.opensuse.org/public/build/home:jsundermeyer/openSUSE_Leap_42.1/x86_64/texstudio-2.11.2/_log

[2] https://build.opensuse.org/package/view_file/home:jsundermeyer/texstudio-2.11.2/texstudio.spec?expand=1

Comment 5 Rex Dieter 2016-11-01 20:35:26 UTC
Right, so current evidence still suggests upstream issue when building with newer Qt releases.

Comment 6 Rex Dieter 2016-11-02 01:45:39 UTC
Adjusting summary to match current theory

Comment 7 hannes 2016-11-02 06:59:36 UTC
Ok, so they've built it against Qt 5.7 in Kubuntu 16.04 apparently.

Comment 8 Kevin Kofler 2016-11-02 12:30:53 UTC
Have you tried building without smp_mflags? These errors can be caused by parallel make race conditions, where the build runs before the .moc file is fully generated, usually with an entirely empty .moc file, and so the implementation of the QObject methods from the Q_OBJECT macro is missing.

If you wonder why this results in a missing vtable: to avoid emitting the vtable in all classes including the header, g++ picks a virtual method as the "key method" and only emits the vtable in the class implementing the method. If, for some reason, the implementation is missing, the vtable will be generated nowhere. And an empty .moc file is a reason.

Comment 9 hannes 2016-11-02 12:53:26 UTC
I think I did this and the problems persisted. Unfortunately all the build.logs were removed already. I'll try to initiate all the builds again, so that one can have a closer look, what's happening.

Comment 10 hannes 2016-11-03 18:55:05 UTC
Ok, so I kicked of all builds for f25 on all arches and made sure that the smp_mflags are disabled.
x86_64:
http://koji.fedoraproject.org/koji/taskinfo?taskID=16284659
i686:
http://koji.fedoraproject.org/koji/taskinfo?taskID=16284685
armv7hl:
http://koji.fedoraproject.org/koji/taskinfo?taskID=16284687

Thanks for helping!

Comment 11 hannes 2016-11-08 05:43:58 UTC
*** Bug 1392614 has been marked as a duplicate of this bug. ***

Comment 12 Fernando 2016-11-21 16:48:21 UTC
Hi hannes, first of all, thanks for packing TeXstudio for Fedora. I was planning to upgrade tomorrow to F25. Would it be possible to pack version 2.11.0 meanwhile, or the same problems arise? If there's anything I can help with, please let me know (I warn you I have 0 packing skills, but I'm willing to help even if this implies making efforts).

Comment 13 hannes 2016-11-22 08:56:46 UTC
Well, I don't have enough time at the moment and I don't really know how to debug it properly. 2.11.0 should be in fedora 25, only 2.11.2 is not yet available.

Comment 14 hannes 2016-11-23 20:38:05 UTC
Created attachment 1223429 [details]
build.log

Build log for http://koji.fedoraproject.org/koji/taskinfo?taskID=16584778

Comment 15 hannes 2016-11-23 20:38:42 UTC
Created attachment 1223430 [details]
root.log

root.log from http://koji.fedoraproject.org/koji/taskinfo?taskID=16584778

Comment 16 Fernando 2016-11-24 09:52:52 UTC
Hi, guys. TeXstudio developer Jan Sundermeyer has an OBS repo with SRPM for the current and previous versions:

https://build.opensuse.org/project/show/home:jsundermeyer

I've imported the SRPM into the following copr repo, and it builds well:

https://copr.fedorainfracloud.org/coprs/edarfoc/TeXstudio/

TeXstudio is built against Qt4 in this way, despite I haven't used the specific Qt4 repo. Maybe he had similar problems trying to compile with Qt5. It's equally fully functional, though. It integrates better in GTK and other environments (fonts, scroll bars... I've checked Gnome, but it has a big list of styles which the current Qt5 version 2.11.0 lacks of, probably because they are not yet available for Qt5). Even more importantly, I previously had inline preview problems for some TiKZ pictures which do not arise now. This is indeed great for me, I use it a lot, and I was previously relying on EqualX (which is not that feature rich for partial compilations) because of this. 

Hannes, what would you think of building the official Fedora TeXstudio with Qt4 for the time being? I see more pros than cons.

Comment 17 hannes 2016-11-24 13:12:42 UTC
Sorry, I won't go back to Qt4. It's actually not a really important update, which needs to get out as soon as possible. I will update texstudio as soon as we figured out the reason for the build failure on Qt5. 
Going back to Qt4 again does not really solve the issue at hand.

Comment 18 Fernando 2016-11-24 17:30:08 UTC
It does, and the preview issue too, which was reported upstream:

https://sourceforge.net/p/texstudio/bugs/1351/

But I'm a total ignorant, so I wouldn't like to insist, I'm sure there must be reasons unknown to me which advice against using qt4. I'm happy with the copr for my own needs.

Comment 19 Sammy 2016-12-08 14:22:01 UTC
Any developments on this? Here is what I tried that may be useful:

On fully updated Fedora 24 with qt5-5.6.2 I updated hunspell to the version on
Fedora 25 and was able to build texstudio 2.11.2, which then I use on my Fedora
25 machines. So, the issue is not simply qt5 but perhaps qt5 5.7.0 and Fedora
25.

I can also build qt4 version on Fedora 25 with no problem bu just changing two
lines in the spec file. I am not a c++ programmer but if one googles this vtable
error you find some explanation as to why it happens. I am not sure how Tim
Hoffman says he can build it with 5.7.0 on Kubuntu 16.04 in:

https://sourceforge.net/p/texstudio/bugs/1938/?limit=25

Hope there is a solution to this soon. Thanks.

Comment 20 Christian Dersch 2016-12-08 17:49:19 UTC
This is an issue with moc, which produces no output for manhattanstyle.h and styleanimator.h on x86_64. Removing the version check macros (patch in attachment) in these files (so solving them by brain) fixes the compilation.

http://koji.fedoraproject.org/koji/taskinfo?taskID=16799880

Comment 21 Christian Dersch 2016-12-08 17:50:14 UTC
Created attachment 1229568 [details]
Remove the version check macros for test

Comment 22 Rex Dieter 2016-12-08 18:45:46 UTC
After adding some debugging and educated guesses, we found that *something* in rawhide was defining macros 'major' 'minor' which are both commonly used in other code (often for version checks).  We suspect glibc's sysmacros.h to be the culprit, so we're testing 2 changes:

1.  patching QT_VERSION_CHECK to use safer/namespaced variables
2.  patch moc to define _SYS_SYSMACROS_H

http://koji.fedoraproject.org/koji/taskinfo?taskID=16800142

Comment 23 Christian Dersch 2016-12-09 20:26:44 UTC
Latest qt5-qtbase build (5.7.1-9.fc26) seems to fix the issue, I already rebuilt texstudio.

http://koji.fedoraproject.org/koji/taskinfo?taskID=16808397

Comment 24 Sammy 2016-12-09 21:46:25 UTC
I also used the relevant patches in 5.7.0 in fc15 and rebuilt qt5 and texstudio
compiled there as well. The question I have is whether this issue was only
limited to texstudio or did it effect other builds as well in a more subtle way?

Comment 25 Sammy 2016-12-09 22:16:23 UTC
Found one case when building kile development version. The below patch was
failing the rpm build because files were still in the deleted kxmlgui directory.
With the patched qt5 it builds fine:

=======================kile patch===================================--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -201,6 +201,9 @@ ecm_add_app_icon(kile_SRCS
 	${CMAKE_CURRENT_SOURCE_DIR}/data/icons/128-apps-kile.png
 )
 
+# add the resource file containing the ui files
+qt5_add_resources(kile_SRCS kile.qrc)
+
 kf5_add_kdeinit_executable(kile ${kile_SRCS})
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # for Mac OS X
@@ -259,7 +262,6 @@ install(FILES net.sourceforge.kile.main.xml DESTINATION ${DBUS_INTERFACES_INSTAL
 install(PROGRAMS org.kde.kile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
 install(FILES kile.kcfg DESTINATION ${KCFG_INSTALL_DIR})
 install(FILES data/bibtexentries.rc data/biblatexentries.rc DESTINATION ${DATA_INSTALL_DIR}/kile)
-install(FILES kileui.rc docpartui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kile)
 install(FILES data/kile.categories DESTINATION ${KDE_INSTALL_CONFDIR})
 install(FILES data/org.kde.kile.appdata.xml DESTINATION ${CMAKE_INSTALL_METAINFODIR})
 
diff --git a/src/kile.qrc b/src/kile.qrc
new file mode 100644
index 0000000..520d1a3
--- /dev/null
+++ b/src/kile.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+    <qresource prefix="/kxmlgui5/kile">
+        <file>kileui.rc</file>
+        <file>docpartui.rc</file>
+    </qresource>
+</RCC>

Comment 26 Christian Dersch 2016-12-10 09:06:06 UTC
This issue was not limited to TeXstudio. At least also Qupzilla is affected, but as QT_VERSION macros are widely used I think there are more affected applications. We have to check and rebuild.