I can reproduce the issue with your minimal hello world example and it happens only when using the static variant.
The qt5_wrap_cpp is yet another issue and seems to be the same problems as I already encountered with Qt5::lrelease/lupdate/lconvert. Unfortunately I don't know the source of this problem and could just provide (yet another) workaround. But I guess it is not too important because everybody uses automoc which is the real concern here.
Interestingly, the more complicated CMake projects I use for building my own applications such as Syncthing Tray and qtutilities work. The project also relies on automoc and autouic. As you can see in the log it generates everything correctly: http://paste.opensuse.org/86983509
So I'll try to figure out what my project does differently. This could then be a workaround at least.
Search Criteria
Package Details: mingw-w64-qt5-base-static 5.15.15+kde+r127-1
Package Actions
Git Clone URL: | https://aur.archlinux.org/mingw-w64-qt5-base-static.git (read-only, click to copy) |
---|---|
Package Base: | mingw-w64-qt5-base-static |
Description: | A cross-platform application and UI framework, native OpenGL backend (mingw-w64) |
Upstream URL: | https://www.qt.io/ |
Licenses: | custom, GPL3, LGPL3, FDL |
Groups: | mingw-w64-qt5 |
Submitter: | ant32 |
Maintainer: | Martchus |
Last Packager: | Martchus |
Votes: | 11 |
Popularity: | 0.000178 |
First Submitted: | 2013-08-28 23:57 (UTC) |
Last Updated: | 2024-09-10 21:19 (UTC) |
Dependencies (21)
- mingw-w64-crt (llvm-mingw-w64-toolchain-ucrt-binAUR, llvm-mingw-w64-toolchain-msvcrt-binAUR)
- mingw-w64-dbusAUR
- mingw-w64-harfbuzzAUR
- mingw-w64-libjpeg-turboAUR (mingw-w64-libjpegAUR)
- mingw-w64-libpngAUR
- mingw-w64-opensslAUR
- mingw-w64-pcre2AUR
- mingw-w64-qt5-baseAUR
- mingw-w64-sqliteAUR
- mingw-w64-zlibAUR
- mingw-w64-zstdAUR
- git (git-gitAUR, git-glAUR) (make)
- mingw-w64-environmentAUR (llvm-mingw-w64-environmentAUR) (make)
- mingw-w64-gcc (mingw-w64-gcc132AUR, llvm-mingw-w64-toolchain-ucrt-binAUR, llvm-mingw-w64-toolchain-msvcrt-binAUR) (make)
- mingw-w64-mariadb-connector-cAUR (make)
- mingw-w64-pkg-configAUR (llvm-mingw-w64-pkg-configAUR) (make)
- mingw-w64-postgresqlAUR (make)
- mingw-w64-vulkan-headersAUR (make)
- mingw-w64-mariadb-connector-cAUR (optional) – MySQL support
- mingw-w64-mesaAUR (mingw-w64-mesa-gitAUR) (optional) – use LLVMpipe software rasterizer for Qt Quick
- Show 1 more dependencies...
Required by (28)
- mingw-w64-awesomebump-git (make)
- mingw-w64-passwordmanager (make)
- mingw-w64-qt5-activeqt (make)
- mingw-w64-qt5-activeqt (optional)
- mingw-w64-qt5-canvas3d (make)
- mingw-w64-qt5-canvas3d (optional)
- mingw-w64-qt5-charts-static
- mingw-w64-qt5-connectivity-static
- mingw-w64-qt5-datavis3d-static
- mingw-w64-qt5-declarative-static
- mingw-w64-qt5-gamepad-static
- mingw-w64-qt5-imageformats-static
- mingw-w64-qt5-location-static
- mingw-w64-qt5-multimedia-static
- mingw-w64-qt5-networkauth-static
- mingw-w64-qt5-remoteobjects-static
- mingw-w64-qt5-script-static
- mingw-w64-qt5-sensors-static
- mingw-w64-qt5-serialport-static
- mingw-w64-qt5-svg-static
- mingw-w64-qt5-websockets-static
- mingw-w64-qt5-winextras-static
- mingw-w64-qt5-xmlpatterns-static
- mingw-w64-qtforkawesome (make)
- mingw-w64-qtutilities (make)
- mingw-w64-syncthingtray (make)
- mingw-w64-tageditor (make)
- mingw-w64-videodownloader (make)
Sources (33)
- 0001-Adjust-win32-g-profile-for-cross-compilation-with-mi.patch
- 0002-Ensure-GLdouble-is-defined-when-using-dynamic-OpenGL.patch
- 0003-Fix-too-many-sections-assemler-error-in-OpenGL-facto.patch
- 0004-Make-sure-.pc-files-are-installed-correctly.patch
- 0005-Don-t-add-resource-files-to-LIBS-parameter.patch
- 0006-Prevent-debug-library-names-in-pkg-config-files.patch
- 0007-Fix-linking-against-shared-static-libpng.patch
- 0008-Fix-linking-against-static-D-Bus.patch
- 0009-Don-t-try-to-use-debug-version-of-D-Bus-library.patch
- 0010-Fix-linking-against-static-freetype2.patch
- 0011-Fix-linking-against-static-harfbuzz.patch
- 0012-Fix-linking-against-static-pcre.patch
- 0013-Fix-linking-against-shared-static-MariaDB.patch
- 0014-Fix-linking-against-shared-static-PostgreSQL.patch
- 0015-Rename-qtmain-to-qt5main.patch
- 0016-Enable-rpath-for-build-tools.patch
- 0017-Use-system-zlib-for-build-tools.patch
- 0018-Merge-shared-and-static-library-trees.patch
- 0019-Use-.dll.a-as-import-lib-extension.patch
- 0020-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
- 0021-Allow-usage-of-static-version-with-CMake.patch
- 0022-Adjust-linker-flags-for-static-build-with-cmake-ming.patch
- 0023-Use-correct-pkg-config-static-flag.patch
- 0024-Fix-macro-invoking-moc-rcc-and-uic.patch
- 0025-Ignore-errors-about-missing-feature-static.patch
- 0026-Enable-and-fix-use-of-iconv.patch
- 0027-Ignore-failing-pkg-config-test.patch
- 0028-Prevent-qmake-from-messing-static-lib-dependencies.patch
- 0029-Hardcode-linker-flags-for-platform-plugins.patch
- 0030-Fix-linking-against-static-plugins-with-qmake.patch
- 0031-Prevent-Cannot-find-feature-windows_vulkan_sdk.patch
- 0032-Fix-crashes-in-rasterization-code-using-setjmp.patch
- git+https://invent.kde.org/qt/qt/qtbase#commit=ab13e81917207959785ad0185a3a9974e552a7f5
Martchus commented on 2017-01-09 21:58 (UTC) (edited on 2017-01-09 22:00 (UTC) by Martchus)
woggioni commented on 2017-01-09 12:48 (UTC) (edited on 2017-01-09 12:51 (UTC) by woggioni)
Actually I was using version 5.7.0-10, I tried to compile the latest version (5.7.1-1) but it stuck with
./.obj/release/qtextdocument_p.o: In function `ZN16QFragmentMapDataI17QTextFragmentDataE14createFragmentEv':
/home/woggioni/Scaricati/build/aur-mingw-w64-qt5-base/src/qtbase-opensource-src-5.7.1/include/QtGui/5.7.1/QtGui/private/../../../../../src/gui/text/qfragmentmap_p.h:258: undefined reference to `_imp___Z26qCalculateGrowingBlockSizejjj'
then I installed the binary version of 5.7.1-1 from your personal repo of both mingw-w64-qt5-base and mingw-w64-qt5-base-static and got the same result (AUTOMOC and AUTOUIC not working with static libs)
Martchus commented on 2017-01-09 12:10 (UTC)
Your project file looks good - strange because building my own projects (https://github.com/Martchus/qtutilities/blob/master/cmake/modules/QtConfig.cmake#L262) works (also when only building the static version).
The issue might be similar to the Qt5::lrelease/lupdate/lconvert issue (https://aur.archlinux.org/packages/mingw-w64-qt5-tools/). Just strange that is only happens when using the static version.
But I'll look into it again using exactly your project file. I assume you use the latest version of the package?
woggioni commented on 2017-01-09 10:49 (UTC) (edited on 2017-01-09 11:32 (UTC) by woggioni)
Sorry for late answer Martchus, but I actually did not notice your last post until today.. I tried both stock Archlinux cmake with toolchain file '/usr/share/mingw/toolchain-x86_64-w64-mingw32.cmake' and CMake wrapper provided by mingw-w64-cmake package with the same result: I got a linker error and the moc files are not generated.
I am using package version 5.7.0-10 and don't know whether it has ever worked before because it's my very first trial.
You can find a very basic example app I just wrote for testing here:
https://github.com/oggio88/Qt-CMake-HelloWorld
update:
I just discovered that also AUTOUIC does not work with static version
and using qt5_wrap_cpp also does not work, it runs
/usr/x86_64-w64-mingw32/lib/qt/bin/moc Qt5::moc @/tmp/build-hello/moc_mainwindow.cpp_parameters
which results in this error:
Too many input files specified: 'Qt5::moc' '/home/woggioni/code/Qt-CMake-HelloWorld/mainwindow.h'
It seems that an extra parameter 'Qt5::moc' is given to the moc program
Martchus commented on 2016-12-28 13:15 (UTC) (edited on 2016-12-28 13:17 (UTC) by Martchus)
@woggioni I can check. So auto moc works only if you use find_package(Qt5Core) in addition to find_package(StaticQt5Core)? Any error messages or simple app to reproduce? Did it work with previous versions of the package? Do you use CMake wrapper provided by mingw-w64-cmake package?
woggioni commented on 2016-12-28 11:27 (UTC)
When using only static version of qt with CMake, automoc does not work
Martchus commented on 2016-07-27 22:17 (UTC)
The static variant of mingw-w64-qt5-base currently doesn't work.
- Linking with CMake is not possible. It always uses the shared version and there is not way to change that (eg. by setting a variable before calling find_package). In addition the transitive dependencies (which are required when linking against a static library) wouldn't be added automatically and plugins aren't detected.
- I'm unable to build static versions of the further Qt modules which are not part of the base repository. (The errors are undefined reference to `_imp___ZNK10QQmlEngine7baseUrlEv' and similar, so adding all required dependencies doesn't seem to work.)
- As consequence of the last point not all Qt modules are available.
The first point could be fixed by using the patches from MSYS2. However, those patches must be adjusted because MSYS2 installs static Qt in a separate prefix but the version here installs everything in one prefix. Maybe it would be easier to use separate prefixes here, too. What do you think?
Not sure how to fix the problem with the additional Qt modules. Are you able to build static versions of them?
Martchus commented on 2016-07-10 19:47 (UTC) (edited on 2016-09-19 18:26 (UTC) by Martchus)
All my packages are managed at GitHub where you can also contribute directly: https://github.com/Martchus/PKGBUILDs
Patches for this package are managed at: https://github.com/Martchus/qtbase/tree/5.7.0-mingw-w64
There also exist a binary repository: https://martchus.no-ip.biz/repo/arch/ownstuff
For general discussion and issues not only concerning this variant please use the comment section of the package mingw-w64-qt5-base.
ant32 commented on 2015-09-03 12:37 (UTC)
I'll try do that this week. All that should need to be done is add -static to the main qt5 package but I didn't test it yet.
ethon commented on 2015-09-03 08:17 (UTC)
Any chance for an update to 5.5?
Pinned Comments
Martchus commented on 2020-09-13 11:43 (UTC)
Also take note of the sticky comments on the mingw-w64-qt5-base package.
Martchus commented on 2017-01-10 21:24 (UTC) (edited on 2019-12-10 13:02 (UTC) by Martchus)
Notes about using static Qt with CMake:
Note about using static Qt with qmake:
CONFIG+=no_smart_library_merge
to qmake arguments to prevent qmake from messing linker flags for freetype2/harfbuzz (which have dependency cycle).Martchus commented on 2016-07-10 19:47 (UTC) (edited on 2016-09-19 18:26 (UTC) by Martchus)