Mingw32-make Error 1 & 2 while compiling a Libary - qt

I tried everything I could think of already to fix it but after several Hours I just give up. I want to compile a Lib with qmake to include a parse for csv files. Sadly when I use mingw32-make I get this Error:
C:\Users\Deto24\Downloads\qtcsv-1.5\build>qmake ..\qtcsv.pro CONFIG+=[release] DESTDIR=%cd%
Info: creating stash file C:\Users\Deto24\Downloads\qtcsv-1.5\build\.qmake.stash
Project MESSAGE: === Configuration of qtcsv ===
Project MESSAGE: Qt version: 6.0.2
Project MESSAGE: Library version: 1.5.0
Project MESSAGE: Library files will be created in folder: C:/Users/Deto24/Downloads/qtcsv-1.5/build
Project MESSAGE: === Configuration of qtcsv ===
Project MESSAGE: Qt version: 6.0.2
Project MESSAGE: Library version: 1.5.0
Project MESSAGE: Library files will be created in folder: C:/Users/Deto24/Downloads/qtcsv-1.5/build
Project MESSAGE: === Configuration of qtcsv ===
Project MESSAGE: Qt version: 6.0.2
Project MESSAGE: Library version: 1.5.0
Project MESSAGE: Library files will be created in folder: C:/Users/Deto24/Downloads/qtcsv-1.5/build
C:\Users\Deto24\Downloads\qtcsv-1.5\build>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/Deto24/Downloads/qtcsv-1.5/build'
g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -Werror -Wformat=2 -Wuninitialized -Winit-self -Wswitch-enum -Wundef -Wpointer-arith -Wdisabled-optimization -Wcast-align -Wcast-qual -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQTCSV_LIBRARY -DQT_NO_DEBUG -DQT_CORE_LIB -I../../qtcsv-1.5 -I. -I../include -IC:/Qt/6.0.2/mingw81_64/include -IC:/Qt/6.0.2/mingw81_64/include/QtCore -Irelease -IC:/Qt/6.0.2/mingw81_64/mkspecs/win32-g++ -o release\writer.o ..\sources\writer.cpp
In file included from ..\sources\writer.cpp:1:
../../qtcsv-1.5/include/qtcsv/writer.h:6:10: fatal error: QTextCodec: No such file or directory
#include <QTextCodec>
^~~~~~~~~~~~
compilation terminated.
mingw32-make[1]: *** [Makefile.Release:248: release/writer.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/Deto24/Downloads/qtcsv-1.5/build'
mingw32-make: *** [Makefile:45: release] Error 2
I'm fairly new to adding Lib's to QT and while there seems no real explains for how to compile those lib's step by step I could gather some Informations by myself. I created the PATH as you can see on the Picture, so I hope that is alright.
Any Ideas what I did wrong?

Related

Linking Qt with github actions using mingw

I'm using the jurplel/install-qt-action with itself uses aqtinstall under the covers to configure a github action to build a basic qt application against mingw53 (also tried mingw73 both win32 and win64) with obviously a windows build agent.
Build always fails on the link:
C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'D:/a/qt-github-console/qt-github-console'
g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I. -I../Qt/5.11.3/mingw53_32/include -I../Qt/5.11.3/mingw53_32/include/QtCore -Idebug -I../Qt/5.11.3/mingw53_32/mkspecs/win32-g++ -o debug/main.o main.cpp
g++ -Wl,-subsystem,console -mthreads -o debug/qt-github-console.exe debug/main.o -LD:/a/qt-github-console/Qt/5.11.3/mingw53_32/lib D:/a/qt-github-console/Qt/5.11.3/mingw53_32/lib/libQt5Cored.a
debug/main.o: In function `main':
D:\a\qt-github-console\qt-github-console/main.cpp:5: undefined reference to `__imp__ZN16QCoreApplicationC1ERiPPci'
D:\a\qt-github-console\qt-github-console/main.cpp:7: undefined reference to `__imp__ZN16QCoreApplication4execEv'
D:\a\qt-github-console\qt-github-console/main.cpp:5: undefined reference to `__imp__ZN16QCoreApplicationD1Ev'
D:\a\qt-github-console\qt-github-console/main.cpp:5: undefined reference to `__imp__ZN16QCoreApplicationD1Ev'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [Makefile.Debug:63: debug/qt-github-console.exe] Error 1
mingw32-make[1]: Leaving directory 'D:/a/qt-github-console/qt-github-console'
mingw32-make: *** [Makefile:36: debug] Error 2
The desktop QtCreator version of this minimal console app builds fine against exactly the same package versions. Have tried lots of combinations of versions and (potential) LIB/static flags but still no dice. The lack of any examples of representative mingw Qt builds on github makes me think that this is just an untested and always failing path but I am desperate to get it working! Any ideas for other thing to try? Project is here along with history of all the build failures:
https://github.com/bowniewk/qt-github-console
Ok it was pretty simple in the end but took me an age to conceptually work out.
At time of writing default windows-latest github actions agents come with mingw (8.2) and strawberryperl installed as chocolatey packages. Both of these have g++.exes (64-bit) which contaminate the path. Additionally there is no chocolatey package which I could find that does mingw 32-bit (either 5.3 or 7.3) which I could use against 32-bit Qt.
However you can uninstall the choco packages mentioned above and either go fully 64-bit or if you want 32-bit you can install the numworks/setup-msys2 action as follows:
name: CI
env:
QT_VERSION: "5.12.7"
MINGW_VERSION: "win32_mingw73"
MINGW_PATH: "mingw73_32"
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- name: Install correct version of mingw
run: |
choco uninstall mingw --force
choco uninstall strawberryperl --force
- uses: numworks/setup-msys2#v1
with:
msystem: MINGW32
- name: Install Qt
uses: jurplel/install-qt-action#v2.5.3
with:
version: ${{ env.QT_VERSION }}
arch: ${{ env.MINGW_VERSION }}
extra: --external 7z
- uses: actions/checkout#v1
[etc.]

Including wrong Qt version headers

I am trying to install QT Creator from source on Centos 6. I have installed (what I think are) the Qt5 libraries onto my system using yum. When I check which rpm's are installed I see
[qt-creator-2.8.1-src]# rpm -qa | grep qt
qt5-qtbase-x11-5.1.1-3.el6.x86_64
qt-4.6.2-26.el6_4.x86_64
qt-sqlite-4.6.2-26.el6_4.x86_64
qt-x11-4.6.2-26.el6_4.x86_64
qt5-qtbase-5.1.1-3.el6.x86_64
ibus-qt-1.3.0-2.el6.x86_64
qt3-3.3.8b-30.el6.x86_64
qt5-qtbase-devel-5.1.1-3.el6.x86_64
qt-devel-4.6.2-26.el6_4.x86_64
qt3-devel-3.3.8b-30.el6.x86_64
So qt5 seems to be installed, but so is qt4 and qt3 (perhaps required by some other apps, but this is a pretty plain system). So now I've downloaded the QT Creator source, and am trying to compile. I gave the full path the qt5 qmake (/usr/lib64/qt5/bin/qmake qtcreator.pro) and that worked. But now when I issue the command make I see:
[qt-creator-2.8.1-src]# make
cd src/ && ( test -e Makefile || /usr/lib64/qt5/bin/qmake /usr/src/qtcreator/qt-creator-2.8.1-src/src/src.pro -o Makefile ) && make -f Makefile
make[1]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
cd libs && make -f Makefile
make[2]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs'
cd aggregation && make -f Makefile
make[3]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs/aggregation'
g++ -c -pipe -Wall -W -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC -DAGGREGATION_LIBRARY -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT -I/usr/lib64/qt-3.3/mkspecs/default -I. -I/src -I\ -I/usr/lib64/qt-3.3/include -o aggregate.o aggregate.cpp
In file included from aggregate.h:33,
from aggregate.cpp:30:
aggregation_global.h:33:21: error: qglobal.h: No such file or directory
In file included from aggregate.cpp:30:
aggregate.h:35:19: error: QObject: No such file or directory
aggregate.h:36:17: error: QList: No such file or directory
aggregate.h:37:17: error: QHash: No such file or directory
aggregate.h:38:26: error: QReadWriteLock: No such file or directory
aggregate.h:39:23: error: QReadLocker: No such file or directory
aggregate.cpp:32:24: error: QWriteLocker: No such file or directory
aggregate.cpp:33:18: error: QDebug: No such file or directory
In file included from aggregate.cpp:30:
aggregate.h:43: error: expected initializer before ‘:’ token
aggregate.cpp:277: error: expected ‘}’ at end of input
make[3]: *** [aggregate.o] Error 1
make[3]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs/aggregation'
make[2]: *** [sub-aggregation] Error 2
make[2]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs'
make[1]: *** [sub-libs] Error 2
make[1]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
make: *** [sub-src-make_first-ordered] Error 2
so it looks like make is including the qt 3.3 headers I/usr/lib64/qt-3.3/mkspecs/default). How do I tell make or qmake to use the Qt5 headers/libraries?
I remove the qt3-devel package as suggested below, and now my error changes to:
cd src/ && ( test -e Makefile || /opt/Qt/5.1.1/gcc_64/bin/qmake /usr/src/qtcreator/qt-creator-2.8.1-src/src/src.pro -o Makefile ) && make -f Makefile
make[1]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
make[1]: *** No rule to make target `/usr/lib64/qt-3.3/mkspecs/default/qmake.conf', needed by `Makefile'. Stop.
make[1]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
make: *** [sub-src-make_first-ordered] Error 2
as you can see make is still referencing the qt3 stuff.
The solution for those encountering the same:
Remove qt3-devel
Install qt5-* (otherwise the make process will complain about missing items). You can probably be more selective but after 10 time install individual packages based on make complains, I just put them all in.
run qmake giving the full path to the qt5 version of qmake
run 'qmake -r' not 'qmake qtcreator.pro'

Error while testing QT test project

I have started using QT on Kubuntu. I first installed g++ via Package Manager. Then I installed QT 5.0.1. I then made a test project to check if everything is correct or not. Then I got following issues.
- cannot find -lGL
- collect2: error:Id returned 1 exit status
I saw in Compile Output
11:32:05: Running steps for project untitled2...
11:32:05: Configuration unchanged, skipping qmake step.
11:32:05: Starting: "/usr/bin/make" -w
make: Entering directory `/home/harsh/Desktop/untitled2-build-Desktop_Qt_5_0_1_GCC_64bit-Debug'
g++ -m64 -Wl,-rpath,/home/harsh/Qt5.0.1/5.0.1/gcc_64 -Wl,-rpath,/home/harsh/Qt5.0.1/5.0.1/gcc_64/lib -o untitled2 main.o mainwindow.o moc_mainwindow. -L/usr/X11R6/lib64 -L/home/harsh/Qt5.0.1/5.0.1/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [untitled2] Error 1
make: Leaving directory `/home/harsh/Desktop/untitled2-build-Desktop_Qt_5_0_1_GCC_64bit-Debug'
11:32:05: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled2 (kit: Desktop Qt 5.0.1 GCC 64bit)
When executing step 'Make'
Please help me fix these errors.
Qt != QT
The error tells you what is wrong, the compiler cannot find libGL.so. It's usually in /usr/lib64.

Qt 5.0 Build Warning

I have installed Qt 5.0 (the whole SDK) on Fedora 17. I have configured the compiler (GCC) and everything seems to be working fine, except that when I press "Ctrl-R" for having a demo of my GUI coding, I get the following error :
make: Entering directory `/home/Nisarg/Documents/Qt Projects/untitled-build-Desktop_Qt_5_0_1_GCC_32bit-Debug'
g++ -Wl,-rpath,/opt/Qt/5.0.1/gcc -Wl,-rpath,/opt/Qt/5.0.1/gcc/lib -o untitled main.o mainwindow.o moc_mainwindow.o -L/opt/Qt/5.0.1/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
**/usr/bin/ld: cannot find -lGL**
make: Leaving directory `/home/Nisarg/Documents/Qt Projects/untitled-build-Desktop_Qt_5_0_1_GCC_32bit-Debug'
collect2: error: ld returned 1 exit status
make: *** [untitled] Error 1
04:07:17: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled (kit: Desktop Qt 5.0.1 GCC 32bit)
When executing step 'Make'.
(The error above is that a file called -lGL is not found)
How do I go about solving this error ?
You will need to have the libGL development files installed. It's been awhile since I used Fedora, but check your package manager for a package named something like mesa-libGL-devel.

XCode 4 Unimotion

I use Xcode 4, and I currently dont have any iDevice right now to be able to test accelerometer in my application, so I googled for a while and find util named "unimotion". read me file for Unimotion says: "A Makefile is included so all you have to do is cd to the 'unimotion' directory and type 'make'." So I tried, but terminal give me a message
ls: /Developer/SDKs: No such file or directory cc -Wall -Os -g
-isysroot /Developer/SDKs/ -arch i386 -arch ppc -fconstant-cfstrings -c -o unimotion.o unimotion.c clang: warning: not using the clang compiler for the 'powerpc' architecture unimotion.c:72:10: fatal
error: 'IOKit/IOKitLib.h' file not found
include IOKit/IOKitLib.h>
1 error generated. make[1]: * [unimotion.o] Error 1 make: * [sub-unimotion] Error 2
again and again.
So, what am I doing wrong?
Thanks.
Rewrite all occurrences of /Developer/SDKs/ in the 3 Makefiles (calibrate/Makefile, motion/Makefile and unimotion/Makefile) with
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
that should help you. If you're using Xcode 4, you'll probably get further error also
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
as the -arch ppc is not supported there anymore. Just delete every single occurrence of -arch ppc in Makefiles, and it will work.

Resources