setup qtcreator kit for cross compiling (mxe) - qt

I'm trying setup an environment to cross-compile my projects from ubuntu to windows.
Looking around I managed to compile qt through mxe, now the problem is I can't get it to work inside qtcreator.
Being specific, I added in QtVersion tab
/home/user_name/mxe/usr/i686-w64-mingw32.static/qt5/bin/qmake
which has the following attributes
Name: Qt 5.4.0 (qt5)
ABI: x86-windows-unknown-pe-32bit
Source: /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
mkspec: win32-g++
qmake: /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin/qmake
Version: 5.4.0
QMAKE_SPEC linux-g++
QMAKE_VERSION 3.0
QMAKE_XSPEC win32-g++
QT_HOST_BINS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin
QT_HOST_DATA /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_HOST_LIBS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/lib
QT_HOST_PREFIX /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_ARCHDATA /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_BINS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin
QT_INSTALL_CONFIGURATION /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/etc/xdg
QT_INSTALL_DATA /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_DEMOS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/examples
QT_INSTALL_DOCS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/doc
QT_INSTALL_EXAMPLES /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/examples
QT_INSTALL_HEADERS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/include
QT_INSTALL_IMPORTS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/imports
QT_INSTALL_LIBEXECS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin
QT_INSTALL_LIBS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/lib
QT_INSTALL_PLUGINS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/plugins
QT_INSTALL_PREFIX /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_QML /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/qml
QT_INSTALL_TESTS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/tests
QT_INSTALL_TRANSLATIONS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/translations
QT_SYSROOT
QT_VERSION 5.4.0
I tried to add every file in ../mxe/usr/bin directory as compiler but I always receive the same msg: "The compiler xxxxxx cannot produce code for this QT version"
Note that I simply gave make qt5, without arguments...
ps of course I set the "new" qt version also in the kit tab

Open QtCreator and go to Tools->Options->Build&Run->Compilers menu then change the default ABI value of installed appropriate compiler to what you see in the spec output of the toolchain: x86-unknown-unknown-32bit to x86-windows-unknown-pe-32bit.

Related

Crosscompile qt6 for raspberry pi 4

I have read this qt6 doc, so I start to play with this, but maybe the docs leaks some infos and the configure step fails quickly with this error:
CMake Error at cmake/QtBaseConfigureTests.cmake:21 (message):
Failed to compile architecture detection file.
Call Stack (most recent call first):
cmake/QtBaseConfigureTests.cmake:120 (qt_run_config_test_architecture)
cmake/QtBaseConfigureTests.cmake:133 (qt_run_qtbase_config_tests)
CMakeLists.txt:68 (include)
My cmake command is here:
'/usr/local/bin/cmake' '-DQT_HOST_PATH=/opt/qt6/6.0.1/gcc_64' '-DCMAKE_TOOLCHAIN_FILE=/home/mattia/raspi4-qt6/qt-cross/toolchain.cmake' '-DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON' '-DCMAKE_INSTALL_PREFIX=/usr/local/qt_v6.0.1' '-DCMAKE_STAGING_PREFIX=/home/mattia/raspi4-qt6/build/qt_v6.0.1' '-DQT_BUILD_EXAMPLES=FALSE' '-DQT_BUILD_TESTS=FALSE' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_opengl=es2' '-DINPUT_eglfs=ON' '-G' 'Ninja' '/home/mattia/raspi4-qt6/src/qtbase
While mine toolchaine.cmake is here:
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv8)
set(TARGET_SYSROOT /home/mattia/raspi4-qt6/sysroot)
set(CROSS_COMPILER /home/mattia/raspi4-qt6/tools/cross-pi-gcc-10.2.0-2/bin)
set(CMAKE_SYSROOT ${TARGET_SYSROOT})
set(CMAKE_C_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-g++)
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/arm-gnueabihf/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
The doc you linked worked properly for me. I added some more notes here: https://bugfreeblog.duckdns.org/2021/09/qt-6-on-raspberry-pi-on-eglfs.html. Maybe you can try with the toolchain I linked in the article.
I suppose that you are using Cygwin. I had same problem with cygwin, because ARM compiler not understand cygwin path /cygdrive/d/cygwin/home.....
For crosscompile qt6 on windows host use windows cmake and windows CMD. Cygwin is not needed..

Rpi4 Qt5 Qml drmModeGetResources failed error

I have been created a build with Buildroot. Also did it everthing on this comment -> https://www.raspberrypi.org/forums/viewtopic.php?t=263418#p1614833
Did my research, and dozens of trials, and I get nothing.
My config is:
Rpi4-64, QT5-Qml, Mesa v3d-vc4, opengl es 2.0
When I try to run my qt qml application on this build, I'm getting this error:
QStandardPaths: wrong permission on runtime directory /usr/bin/, 7755 instead of 7700
drmModeGetResources failed (Operation not supported)
no screens available, assuming 24 -bit color
Cannot create window: no screens available.
Summary : I need to run my qt5 qml application on Rpi 4 with hw accelerated.
I found the solution.
I think the Rpi4 with eglfs using default card for card0, and this is not work. Need to force using card1 for eglfs.
Create a file "eglfs.json" with the following content:
{ "device": "/dev/dri/card1" }
export QT_QPA_EGLFS_KMS_CONFIG=/wherever/is/the/file/eglfs.json
and run your qt app!
Also my qt5 qml program is not showing fonts or text on rpi4 buildroot system. Coping /usr/share/fonts/your_program_fonts worked for me.

Build Qt 5.2 for windows ce 6

I tried to build qt 5.2.1 (opensource.zip) on a Windows 7 64 bit machine with Visual Studio 2005 Professional while having ActivePerl etc. installed. I used the Visual Studio 2005 Command prompt with the following line for configure:
configure -platform win32-msvc2005 -xplatform wince60standard-armv4i-msvc2005 -opensource -nomake examples
which ends up in the following output after about 2 min.:
…
qglobal.cpp
qmalloc.cpp
qlibraryinfo.cpp
qnumeric.cpp
qlogging.cpp
D:\qt-source5.2.1\qtbase\src\corelib\global\qlogging.cpp(96) : error C3861: “GetConsoleWindow”: identifier not found.
Code will be generated…
NMAKE : fatal error U1077: ““C:\Program Files (x86)\Microsoft Visual Studio 8\VC\BIN\cl.EXE”“: return code “0×2”
Stop.
Building qmake failed, return code 2
I also tried to do just a simple:,
configure
within Visual Studio 2005 Command Prompt -> Ends up in the same error.
Does anybody know what wents wrong here? Am i doing something totally wrong or missing something?
I also posted this to the qt Forums of a thread created by a user who had a similar problem -> http://qt-project.org/forums/viewthread/36177/
But nobody replied there.
EDIT: Today i updated my question in QT forums. See -> http://qt-project.org/forums/viewthread/36177/ I modified the problem file qtbase\src\corelib\global\qlogging.h and added the following on top of it:
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0×0500
#endif
I found this solution while searching for “getConsoleWindow” problems. The reference is written down as remark here -> http://msdn.microsoft.com/en-us/library/windows/desktop/ms683175(v=vs.85).aspx
After this my configure runs fine without any problems. But now I expected the following error after calling nmake. After nmake runs ~30 mins i got this output:
d:\readonly\qtsrc\qtbase\include\qtcore\../../src/corelib/tools/qvector.h(666) : error
C2244: 'QVector<T>::erase' : unable to match function definition to an existing declaration definition 'QVector<T>::iterator QVector<T>::erase(QTypedArrayData<T>::iterator,QTypedArrayData<T>::iterator)'
existing declarations
'QTypedArrayData<T>::iterator QVector<T>::erase(QTypedArrayData<T>::iterator)'
'QTypedArrayData<T>::iterator QVector<T>::erase(QTypedArrayData<T>::iterator,QTypedArrayData<T>::iterator)'
There are some more errors but all with QVector::insert and QVector::erase. I Googled a bit and found this post here which looks like a similar problem and is also not replied yet: http://qt-project.org/forums/viewthread/36735
I think i have to say that i compile for custom ce sdk. So i changed the qtbase\mkspecs\wince60standard-armv4i-msvc2005\qmake.conf and added additional includes and libraries there. I also use the following defines there:
DEFINES += WINCE WINDOWS WINDOWS_CE_OS _WIN32_WCE=0×600 UNDER_CE=0×600 ARM _ARM ARMV4I UNICODE UNICODE _USE_32BIT_TIME_T _CRT_SECURE_NO_DEPRECATE $$CE_ARCH _AMRV7 armv7 ARM QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL
Is it so hard to compile qt 5.2.1 for ce? Should i use an older version of qt (i need at least qt5 for JSON handling)? Any suggestions regarding this issue here?
Use thirdpaty library for JSON. Visual Studio 2005 is too old compiler. For example - jsoncpp or QJson.

QtCreator 2.7 does not load debug symbols and it skips breakpoints

I'm trying for 3-4 days to set up my debugger in Qt without success.
I have Qt creator 2.7.0 with compiler MINGW and debugger gdb.exe on Windows 7
I'm building on debug mode, the debugger is skipping the breakpoints.
Thank you in advance for any tip
![qt setup][1]
This is how debugger output looks like:
sSetting breakpoints...
dSetting breakpoints...
dATTEMPT BREAKPOINT SYNCHRONIZATION
dTAKING OWNERSHIP OF BREAKPOINT 1 IN STATE 0
<53-break-insert -f "\"onmainwindow.cpp\":333"
dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED
dATTEMPT SYNC
dATTEMPT BREAKPOINT SYNCHRONIZATION
dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED
>&"No source file named onmainwindow.cpp in loaded symbols.\n"
>53^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"onmainwindow.cpp\":333",times="0"}
<54-break-delete 1
>54^done
<55-break-insert -f "\"onmainwindow.cpp\":333"
>&"No source file named onmainwindow.cpp in loaded symbols.\n"
>55^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"onmainwindow.cpp\":333",times="0"}
dATTEMPT BREAKPOINT SYNCHRONIZATION
dBREAKPOINTS ARE SYNCHRONIZED
dALL COMMANDS DONE; INVOKING CALLBACK
<56maint print msymbols C:/Users/Lucian/AppData/Local/Temp/gdb_ns_.Ae4844
>&"maint print msymbols C:/Users/Lucian/AppData/Local/Temp/gdb_ns_.Ae4844\n"
>56^done
dFOUND NON-NAMESPACED Qt
dNOTE: INFERIOR SETUP OK
dState changed from InferiorSetupRequested(4) to InferiorSetupOk(6) [master]
dState changed from InferiorSetupOk(6) to EngineRunRequested(7) [master]
dQUEUE: RUN ENGINE
dCALL: RUN ENGINE
<57-exec-run
>57^running
dNOTE: ENGINE RUN AND INFERIOR RUN OK
sRunning.
dState changed from EngineRunRequested(7) to InferiorRunOk(11) [master]
dINFERIOR STARTED
sApplication started
>~"[New thread 7144.0x1fdc]\n"
dFOUND PID 7144
dTaking notice of pid 7144
s[New thread 7144.0x1fdc]
>~"(no debugging symbols found)\n"
>~"(no debugging symbols found)\n"
>~"(no debugging symbols found)\n"
I installed also the new gdb debugger and it also doens;t stop ar breakpoints, this new gdb version outputs:
dATTEMPT SYNC
dATTEMPT BREAKPOINT SYNCHRONIZATION
dBREAKPOINTS ARE NOT FULLY SYNCHRONIZED
>&"No symbol table is loaded. Use the \"file\" command.\n"
>200^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="`<PENDING>",pending="\"onmainwindow.cpp\":55",times="0",original-location="\"onmainwindow.cpp\":55"}`
An interesting thing that I noticed is:
Although the debug build have the following configuration:
qmake.exe D:\Elance\X2GoClient\sources_v2.0\x2goclient.pro -r -spec win32-g++ "CONFIG+=debug" "CONFIG+=declarative_debug"
and after that it runs step 2: make:C:\mingw\bin\mingw32-make.exewhere the CINFIG+=debug is mentioned for the debug
the debug output window shows me this:
20:11:11: Configuration unchanged, skipping qmake step.
20:11:11: Starting: "C:\mingw\bin\mingw32-make.exe"
C:/mingw/bin/mingw32-make -f Makefile.Release
is shows:
make -f Makefile.Release..this is very strange
is it ok to show that is building with the makefile from Release?
Thanks
Ok, this might be useful for somebody:
I had the above described problem and solve it with this changes:
Step 1(This problem I think is related to Qt Creator, I think it is build with configure -release instead of configure -debug-and-release flags)
I altered the x2goClient.pro like:
**BEFORE:**
win32-* {
message(building $$TARGET for windows without ldap and cups)
LIBS += -lwinspool -lws2_32
CONFIG += static release
}
**AFTER:**
win32-* {
message(building $$TARGET for windows without ldap and cups)
LIBS += -lwinspool -lws2_32
CONFIG += static debug
}
Step 2(I think due to the fact that Qt might be compiled wrong, the default make.exe step was interpreted as make -f Makefile.release although I selected the Debug build)
In projects->Build Steps->Make arguments
I placed: -f Makefile.Debug
Step 3: After doing these changes, I got several error related to some DLLs. The interesting fact was that Makefile.Debug that was generated by Qt was not generated ok, it contained some dll's like QtCored.dll that wasn't present on Qt, I have changed it as I found the dll's like from QtCored.dll to QtCored4.dll
Step 4: It seemed that the builder and debugger that I had wasn't right. I downloaded the latest MingW and change BOTH builder and debugger. First time I changed only the debugger and got "During startup program exited with code 0xc0000005" Error. When I changed BOTH builder and debugger of the latest MingW it finally worked.
I am working with Qt for 2 weeks now, but I didn't have some much problems with an IDE so far in my life. Qt is good, but it's a bit hardcore to configure.

CMake CPack debian packages

Has someone worked with a working example of a CPack script for debian packages with Qt and OpenGL dependencies?
I've set this one
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12), libQtOpenGL (>=4.6.0), libQtCore (>=4.6.0), libQtGui (>=4.6.0), libglut (>=3.0), libICE (>=6.0), libX11 (>=6.0), libXext (>=6.0), libXmu (>=6.0), libXi (>=6.0), libstdc++ (>=6.0), libm (>=6.0), libgcc_s (>=1.0), libc (>=6.0), libGLU, libGL (>=1.0), libpthread" )
I googled around but never found a working example. My main problem is how to set the dependencies first for libGLU, then for libGL and the following libraries.
Once I've create the deb the installer says
**Error: Dependency is not satisfiable: libXXX**
where XXX is one the libraries I listed before (mainly Qt libraries)
Currently my cmake version is 2.8.2 but cpack_add_component command doesn't work
You could use the CPACK_DEBIAN_PACKAGE_SHLIBDEPS CPack variable:
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
This will resolve dependencies automatically.
I don't think that you can "order" the dependencies in CMake.
If you want a working example of a CMakeLists generating a .deb with qt dependencies look at :
project(QExhibitor)
cmake_minimum_required(VERSION 2.8)
FIND_PACKAGE(Qt4 REQUIRED QtNetwork QtGui QtCore QtXml)
FIND_PACKAGE(CSSRobopec REQUIRED)
#Some non interesting things ...
#.....
add_executable(QExhibitor ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
target_link_libraries(QExhibitor ${QT_LIBRARIES} ${CSSRobopec_LIBRARIES})
INSTALL(TARGETS QExhibitor DESTINATION /reetiPrograms/RApplications/Applications/)
INSTALL(FILES Icons/RQExhib.png DESTINATION /reetiPrograms/RApplications/Icons)
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "2")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "cssrobopec,libqt4-xml,libqt4-network,libqtgui4,treeupdatablereeti")
set(CPACK_PACKAGE_DESCRIPTION "Configure UExhibitor and launch missions")
set(CPACK_PACKAGE_CONTACT "Adrien BARRAL aba#robopec.com")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst")
include(CPack)

Resources