Bug 1379156

Summary: Headless mode fails with qt 5.7 / Fedora 25
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: calibreAssignee: Kevin Fenzi <kevin>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: chkr, frankly3d, helio, kevin, nushio, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: calibre-2.69.0-1.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-09 02:45:24 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:

Description Hans de Goede 2016-09-25 13:25:58 UTC
Hi,

Headless mode (and book import from the gui which seems to depend on headless mode for some books) fails when using qt 5.7 (with the Fedora calibre-2.68.0 pkgs on Fedora 25), the error reported is:

"
This application failed to start because it could not find or load the Qt platform plugin "headless"
in "/usr/lib64/calibre/calibre/plugins".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.

Reinstalling the application may fix this problem.
"

I've managed to hack around this (fixing using calibre under X at least) with this:

--- /usr/lib64/calibre/calibre/gui2/__init__.py~ 2016-09-17 17:58:30.000000000 +0200
+++ /usr/lib64/calibre/calibre/gui2/__init__.py 2016-09-25 15:02:29.831338885 +0200
@@ -876,10 +876,7 @@
         self.file_event_hook = None
         if override_program_name:
             args = [override_program_name] + args[1:]
- if headless:
- if not args:
- args = sys.argv[:1]
- args.extend(['-platformpluginpath', sys.extensions_location, '-platform', 'headless'])
+ headless = False
         self.headless = headless
         qargs = [i.encode('utf-8') if isinstance(i, unicode) else i for i in args]
         self.pi = plugins['progress_indicator'][0]
@@ -1186,6 +1183,7 @@
 _ea_lock = Lock()

 def ensure_app(headless=True):
+ headless = False
     global _store_app
     with _ea_lock:
         if _store_app is None and QApplication.instance() is None:

Which allows me to import books again. I realize this is a useless fix, but it proves that the problem is with headless and that calibre works fine otherwise.

I've filed an upstream bug for this here:

https://bugs.launchpad.net/calibre/+bug/1627494

Hopefully upstream will fix this soon, if not we should probably use my hack to at least get the gui to work properly on F25.

Comment 1 Hans de Goede 2016-09-26 11:41:45 UTC
The problem is a #if QT version check in src/calibre/headless/main.cpp somehow failing to properly detect the right qt version. Upstream has done this commit:

https://github.com/kovidgoyal/calibre/commit/eb43e53372bbd4a4d7d51eb6c0beec5f39312e4f

Which fixes this by getting rid of the #if, so we should probably cherry-pick this.

It would be good to actually know why the #if fails though ... This may be related to the building of the headless plugin not honoring rpm_opt_flags.

Comment 2 Kevin Fenzi 2016-09-28 18:50:15 UTC
I'll cherry pick this soon if they don't do a new release with it. 
(They usually do releases weekly around thursday/friday).

Comment 3 Fedora Update System 2016-10-01 22:22:26 UTC
calibre-2.69.0-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-9eb14544b5

Comment 4 Fedora Update System 2016-10-09 02:45:24 UTC
calibre-2.69.0-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.