Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QtCreator on Windows to Cross Compile for Linux ARM with CodeSourcery Toolchain

I have Qt Creator installed on my Windows 7 machine and my target is an OMAP3 Embedded Linux board. I downloaded the target toolchain, Sourcery-G++ Lite for Windows, and also installed MinGW ( http://www.mingw.org/ ) on my Windows Machine. In QT Creator I added the CodeSourcery toolchain as a 'Manual' toolchain as shown in the image below. Then, I tried to build the demo Qt App 'analogclock' using this toolchain by editing 'Build Settings' under 'Projects' for the 'analogclock' demo app. But the toolchain is not available here under Build Settings as shown in the second image.

How can I achieve building this demo app, or any Qt app, from Qt Creator using the Code Sourcery Toolchain in the Build Options? I absolutely must use Windows to accomplish this ( cannot use Linux VM... ).

I believe it may have to do with building the Qt library for the target but am not sure if that is true or how to do that on Windows. I greatly appreciate your help and insight.

Qt Creator CodeSourcery Toolchain

Qt Creator Build Settings

EDIT: New Information - need help configuring Qt Creator:

I've used the CodeSourcery toolchain to build the Qt 4.8 library with no error and I have the .so files in the /lib directory after following http://c2143.blogspot.com/?view=classic. Now I am trying to hook in the CodeSourcery compiler and built Qt 4.8 to Qt Creator so I can build an example app for the target board.

I read the following articles: http://doc.qt.nokia.com/qtcreator-2.4/creator-project-qmake.html http://doc.qt.nokia.com/qtcreator-2.4/creator-tool-chains.html describing how to add a Qt version new toolchain to Qt Creator. Please see the images attached for how I've configured Qt Creator. I am using Qt Creator 2.4.1.

Qt VersionsToolchainsBuildsettings

I'm getting an error without much information pasted below... Any thoughts on this or my configuration?

09:51:07: Running build steps for project analogclock...
09:51:07: Configuration unchanged, skipping qmake step.
09:51:07: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" 
arm-none-linux-gnueabi-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=neon -mfloat-abi=softfp -Wa,-mimplicit-it=thumb -O2 -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I"..\qt-4.8-src\include\QtCore" -I"..\qt-4.8-src\include\QtNetwork" -I"..\qt-4.8-src\include\QtGui" -I"..\qt-4.8-src\include" -I"." -I"c:\QtSDK\Examples\4.7\widgets\analogclock" -I"." -I"..\qt-4.8-src\mkspecs\default" -o analogclock.obj c:\QtSDK\Examples\4.7\widgets\analogclock\analogclock.cpp
arm-none-linux-gnueabi-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mthumb -mfpu=neon -mfloat-abi=softfp -Wa,-mimplicit-it=thumb -O2 -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I"..\qt-4.8-src\include\QtCore" -I"..\qt-4.8-src\include\QtNetwork" -I"..\qt-4.8-src\include\QtGui" -I"..\qt-4.8-src\include" -I"." -I"c:\QtSDK\Examples\4.7\widgets\analogclock" -I"." -I"..\qt-4.8-src\mkspecs\default" -o main.obj c:\QtSDK\Examples*\4.7\widgets\analogclock\main.cpp
C:\Users\pclass\Desktop\qt_creator_toolchain\qt-4.8-src\bin\moc.exe -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I"..\qt-4.8-src\include\QtCore" -I"..\qt-4.8-src\include\QtNetwork" -I"..\qt-4.8-src\include\QtGui" -I"..\qt-4.8-src\include" -I"." -I"c:\QtSDK\Examples\4.7\widgets\analogclock" -I"." -I"..\qt-4.8-src\mkspecs\default" c:\QtSDK\Examples\4.7\widgets\analogclock\analogclock.h -o moc_analogclock.cpp
mingw32-make.exe: *** [moc_analogclock.cpp] Error -1073741515
09:51:09: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project analogclock (target: Desktop)
When executing build step 'Make'
like image 346
PhilBot Avatar asked Nov 04 '22 20:11

PhilBot


2 Answers

You need the Qt library for the target first. You can build it with CodeSourcery toolchain. Then, some tools(qmake, moc...) and library are available.

like image 60
liuyi.luo Avatar answered Nov 12 '22 17:11

liuyi.luo


I added mingw to the path and then did a build and it succeeded. If I do a ‘file’ command on the example it gives me the following, which looks promising. Now to try it on the board.

$ file analogclock analogclock: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

like image 43
PhilBot Avatar answered Nov 12 '22 16:11

PhilBot