Bug 1092465

Summary: Linking fails on a cmake based project using Qt 5 since libqtmain.a is not found
Product: [Fedora] Fedora Reporter: Aki Koskinen <redhat>
Component: mingw-qt5-qtbaseAssignee: Erik van Pienbroek <erik-fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: erik-fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: mingw-qt5-qtbase-5.2.1-3.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-13 19:20:06 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:
Embargoed:
Attachments:
Description Flags
Test case for the bug none

Description Aki Koskinen 2014-04-29 11:31:51 UTC
Description of problem:

Trying to cross-compile a Qt 5 based project for Windows using mingw. The build system of the project is cmake. Linking an executable fails with error: 

make[2]: *** No rule to make target `/usr/i686-w64-mingw32/sys-root/mingw/lib/libqtmain.a', needed by <the binary name>. Stop.

Version-Release number of selected component:
5.2.1-1.fc19

How reproducible: always

Steps to Reproduce:
1. have a Qt 5 based project using cmake
2. execute mingw32-cmake
3. execute make

Actual results:
Linking fails as described above

Expected results:
Linking should succeed

Additional info:

The problem seems to be that the build process looks for a file called libqtmain.a in /usr/i686-w64-mingw32/sys-root/mingw/lib directory. But the file provided by the mingw32-qt5-qtbase package is called libqt5main.a which I guess should be used instead.

The wrong path comes from the
/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake
file on line 76 which says:
set(imported_location "${_qt5Core_install_prefix}/lib/libqtmain.a")

I changed that line to use the libqt5main.a file and then the linking succeeded.

Comment 1 Erik van Pienbroek 2014-04-29 17:00:39 UTC
Do you have a minimal CMakeLists.txt which shows this behaviour?

Comment 2 Aki Koskinen 2014-04-29 19:52:56 UTC
Created attachment 890918 [details]
Test case for the bug

Running the test:
Extract the archive and cd to the directory it created
$> mingw32-cmake .
$> mingw32-make

Comment 3 Erik van Pienbroek 2014-04-30 19:16:30 UTC
Thanks for the testcase!
I've prepared a new build (against Fedora 19) which should fix the problem (though I didn't fully test it yet): https://koji.fedoraproject.org/koji/taskinfo?taskID=6796108
Could you check if this resolves the issue for you?

Comment 4 Aki Koskinen 2014-05-03 06:05:51 UTC
(In reply to Erik van Pienbroek from comment #3)
> I've prepared a new build (against Fedora 19) which should fix the problem
> Could you check if this resolves the issue for you?

This seems to fix the issue.

Comment 5 Fedora Update System 2014-05-04 10:29:49 UTC
mingw-qt5-qtbase-5.2.1-3.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/mingw-qt5-qtbase-5.2.1-3.fc19

Comment 6 Fedora Update System 2014-05-04 10:30:49 UTC
mingw-qt5-qtbase-5.2.1-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mingw-qt5-qtbase-5.2.1-3.fc20

Comment 7 Fedora Update System 2014-05-06 03:28:25 UTC
Package mingw-qt5-qtbase-5.2.1-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mingw-qt5-qtbase-5.2.1-3.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-5988/mingw-qt5-qtbase-5.2.1-3.fc20
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2014-05-13 19:20:06 UTC
mingw-qt5-qtbase-5.2.1-3.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2014-05-13 19:23:05 UTC
mingw-qt5-qtbase-5.2.1-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.