i have the following problem: I am programming a little modding tool for a game, and everything works just fine. But when i'm compiling it static, with Qt built static, it crashes when im closing the application. This does not happen when im compiling it with the standard Qt dynamic libraries.
So what am i doing wrong? Here is the output of the gdb, im having:
I would appreciate any help. If you need any part of my code, just say it. I'm actually not sure here, which part of my code i should post!
Thanks
Edit: It appears that the problem is in the buildchain. I built the libraries with the same configuration except the -static. Is my error somewhere in there?
configure -release -nomake examples -nomake demos -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -no-sql-sqlite
Related
I will try to cut the story short as much as I can.
I statically compiled QT 5.11.2 to be able to compile a single executable under windows following this guide:
https://retifrav.github.io/blog/2018/02/17/build-qt-statically/
After many trials, compiling and such I was able to get in "release" mode a .exe of around 15MB.
I compiled it using different MinGW versions with the option "QTPLUGIN.imageformats = -" in the .pro project to avoid -ltiff error.
This is strange as my Application has no image handling opss...
My application is a basic and simple push button (no event associated).
The issue I am facing now is that when the mouse moves over the button and it should turn from grey to light blue the Windows wheel spins for a second before the application crashes with Segmentation fault.
Using dynamic compiling it works well and no crashes.
After many tries I found out that at least another QT objects crashes in the same way which is RadioBox. CheckBox and Tool Button are handled correctly the mouse over event.
I tried to change crashing object properties copying from working objects but still crashes!
I am desperate! After the nightmare of static compiling I landed to this issues and no googling helped me so far.
Tested Compilers are:
MinGW 4.9.2 g++
MinGW 5.3 g++
MinGW 7.3 g++
I also tried to remove the Debugger just in case.
Any help?
I am moving from Rad Studio to QT for its known issues finding more troubles than solutions.
I am posting this as an answer because its far too long for a comment...
I did a "from scratch" install of qt. I did this starting from the qt git hub repo. Once finished, I added it as a kit to my qtcreator and re-built some old GUI projects I had with push buttons. I then took the exe's (they where about 500mb because I used debug config) and ran them on a PC that has never seen Qt (a travel laptop) and the two programs I tested both ran fine with button presses and no crashes.
So, here is the list of instructions that I used (for windows 10), you can perhaps try this from the start to see if this helps:
1. Preparation
In no particular order:
install strawberry perl (required during compilation). Note normal perl does not seem to work very well.
from here: http://strawberryperl.com/
Get the qt source:
git clone https://github.com/qt/qt5.git qt5
git checkout 5.12.1 (specific build instead of 5.12 latest)
git submodule update --init --recursive
git submodule foreach --recursive "git clean -dfx" && git clean -dfx (ensure repo is clean)
Download and install mingw64 (32 bit) from: https://sourceforge.net/projects/mingw-w64/. I used options:
version 7.3.0
Arch i686
Threads posix
Exception dwarf
Build-rev 0
Windows 10 NTFS long path names
Get MediaCreationTool1809.exe from here https://www.microsoft.com/en-gb/software-download/windows10 and run it as admin.
https://superuser.com/questions/1119883/windows-10-enable-ntfs-long-paths-policy-option-missing
Once you installed step 1 (maybe reboot) then you should be able to do windows button "gpedit.msc" and see the open to open gpedit
Right click it, run as admin. Then: Local Computer Policy --> Computer Config --> Administrative Templates --> System --> FileSystem --> Enable Win32 Long Paths (double click)
In there click the enable tick box and ok.
Install Python (required during make install):
From here: https://www.python.org/downloads/
NOTE: in the mingw folder there should be a mingw-xx.bat file to open an cmd prompt environment for gcc. Run this for all cmd prompts to do the following actions.
NOTE: make sure you edit the paths so that strawberry perl .../bin is before any other perl's
So the dos env setup should look like:
set PATH=D:\install\StrawberryPerl\perl\bin;%PATH%
set PATH=D:\install\mingw-w64\i686-7.3.0-posix-dwarf\mingw32\bin;%PATH%
set PATH=D:\install\Qt\qt5\qtbase\bin;%PATH%
set PATH=D:\install\Qt\qt5\gnuwin32\bin;%PATH%
Where D:\install\Qt\qt5 is where my qt5 git repo is.
2. Configuration
2.1. Static Config
Create folder at the same level as ../qt5/ repo called ../qt5-static-build/ (for example) and cd into it, then run:
- ..\qt5\configure -debug -opensource -static -static-runtime -skip webengine -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlite -no-opengl -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -confirm-license -prefix "C:\install\Qt\5.12.1-static"
2.2. Shared Lib Config
Create folder at the same level as ../qt5/ repo called ../qt5-build/ (for example) and cd into it, then run:
..\qt5\configure -debug -opensource -skip webengine -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlite -no-opengl -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -confirm-license -prefix "C:\install\Qt\5.12.1-sharedlib"
3. Compile and installation
Either way you configured qt (static or not) this part is the same, basically run:
mingw32-make -j8
mingw32-make install -j8
Note: you can use whatever parallel number you want (-j<num-jobs>). Each stage takes a while depending on your CPU of course.
Once you have finished, the install path set in your config line (e.g. C:\install\Qt\5.12.1-static) will contain your qt install. You can then add this in qtcreator as a new qt version (if that is how you are building it).
Appendix - release static configuration
You may want the following configuration if you want release builds etc (but I did not test this yet):
..\qt5\configure with the following options:
-release -optimize-size -opengl desktop -no-pch -platform win32-g++ -opensource -static -static-runtime -skip webengine -nomake examples -nomake tests -nomake tools -accessibility -no-sql-sqlite -no-opengl -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -confirm-license -prefix "C:\install\Qt\5.12.1-static"
where I added:
-release - instead of debug
-optimize-size - make smallest size
-opengl desktop - opengl if you must have it
-no-pch - no pre-compiled headers, not sure you need this, but...
-platform win32-g++ - Again, this may help if you have build issues, but probably don't need it.
I started the migration from Qt 5.6 to 5.10.1 and faced with this problem. On 5.6 ver the style was "windowsvista" and all works well. Now it looks like Qt can't detect this one and use "windows" style.
Moreover, on my PC, the build of 5.10.1 looks good. It works on Windows 10 x64, same as buildbot.
Configuration line:
-release -prefix C:\repository\x64\qt5 -force-debug-info -platform win32-msvc2013 -nomake examples -no-compile-examples -nomake tests -opengl dynamic -opensource -confirm-license -mp -no-strip
I build Qt without Ruby and Perl libs, because it's unnecessary for my project.
Maybe the problem in configuration, because in 5.6 there was configureapp.exe in /qtbase and now I can't see it. But I do not understand the reason.
I found a problem. After Qt5.10.1 the "windowsvista" style becomes a plugin. So in the final deploy file windowsvistastyle.dll schould exists. I add a folder "/styles" with this .dll and a problem is gone.
I have compiled (make -j4) and installed (sudo make install) Qt 5.9.1 on Jetson TX1 Board from NVIDIA with following configure command
./configure
-opensource
-confirm-license
-release
-linuxfb
-no-tslib
-no-sql-sqlite
-qt-libpng
-qt-libjpeg
-qt-freetype
-qt-xkbcommon-x11
-skip multimedia
-skip wayland
-skip winextras
-skip webchannel
-skip webengine
-skip websockets
-skip webkit
-skip webview
-skip webkit-examples
-nomake examples
-nomake tests
-nomake tools
-prefix /usr
-opengl es2
Everything compiled fine and my QtQuick Project also compiled fine.
The trouble started, when i executed the program.
In release mode the program would run for half a minute and then crash without any message. In debug mode the program crashes at startup. I used Callgrind to pinpoint the crash reason and got the following messages:
Since I have compiled Qt with provided gcc/g++ compiler i don't get why an invalid opcode can be found in the libraries.
Any idea what the problem could be?
I also got some troubles on Jetson TX2 when using Qt (OS: Ubuntu 16.04, x64). I used this tutorial:
Install Jetson
It´s working for me so perhaps you can try it with mentioned dependences.
So I think after tedious debugging I got to the origin of the problem.
Apparently the usage of QCharts in QML on aarch64 Systems doesn't really work, at least it produces the crashes. When removing all QCharts from my QML files the program started working, though I now got a memory leak, that might be originating from the QML Image class (even though caching is disabled), so I'm thinking about replacing it with my own renderalgorithm.
When trying to create a makefile for Qt 4.8.5 with the provided configure.exe, it just shows me the list of options but doesn't configure anything.
What I did:
Downloaded the sourcecode from here http://qt-project.org/downloads
Extracted it to C:/Qt/
Opened the VS2012 Native Tools Command Prompt (tested with x86 and x64)
configure.exe -prefix C:\Qt\4.8.5 -release -qt-sql-sqlite -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-declarative -mp -nomake examples -nomake demos -nomake docs
After this, nothing happens except the output of all possible options.
Does anyone know how to fix this?
EDIT: I couldn't see the errors because the command prompt cut them off. I saved the output with CMD > command.txt and know now, that this is a compiler configuration issue. Thank you, commenters.
These are valid options and work for me.
Do not forget to set up your compiler properly, and also press 'o' for open source for example.
After building QT via my Visual Studio 2010 as described here I find out that most part of demos doesn't work. When I open qtdemo.exe and try to Launch some of them (for example Demonstrations->Browser, Demonstrations->Media Player, Qt Declarative Examples->TV Tennis, ...) the same error message "Could not launch the example. Ensure that it has been built." I get.
If you followed these configure flags from here, then obviously not all examples will work. These are the ones for a minimalistic Qt build:
configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg
If you want all example to work (except webkit), then use this:
configure.exe -release -no-webkit -no-ltcg
If you want the to build everything (takes something like 17 GB of HDD space and half a day):
configure.exe