Cross-compile Qt for specific arm target from 64bits Linux - c++

I'm currently trying to compile a project and port it to a 32bit target deploying a Linux based system.
My host machine runs x86_64 Debian Stretch and my target is an Atmel SAMA5d2 running a custom Linux.
My cross toolchain is generated from buildroot.
At the moment I'm able to cross compile applications for the target using the buildroot generated toolchain. However, I would like to integrate Qt and build Qt apps for the target.
To be able to build my applications for the targetted platform I need to compile Qt for my target.
To do so I have to tell Qt to use the buildroot toolchain instead of the native one.
From what I found I either have to provide -device <device> --device-option CROSS_COMPILE=$TOOLCHAIN_PATH or -xplatform <mkspec> to configure Qt with the expected toolchain.
Obviously my target is not in the device list under qtbase/mkspecs/devices so I think the best solution is to create a mkspec for my target.
My command should look like this :
./configure -xplatform <my_mkspec> -embedded arm -prefix <customQtPath>
However I'm kinda lost and I don't know how to do it only from documentation and what I found by googling my problem.
Also do I need to specify the target is 32bit as armv7 is only 32bits?
I would be glad to have some help on this.
Thanks.

Your assumptions are correct. You can read similar specs and create your own, those are pretty simple. For instance Pi2 is an armv7 device, you can start from this qmake.conf. Then, pass to configure:
-device <given_name> -device-option CROSS_COMPILE=<path_and_prefix> -sysroot <your_sysroot>
just change paths, tune cflags if needed etc... Then follow build tutorials.

Related

ARM platform specific Qmake.bin

I have been trying to develop a GUI using Qt on STM32MP157C-DK2 as provided by STMicroelectronics.
I am using the SW suite which is given by them i.e https://www.st.com/en/embedded-software/stm32mp1dev.html
y query revolves around the issue where-in i am trying to configure a Qt project for this field
enter image description here
I can seem to find qmake.bin specific to ARM architecture.
If i do qmake --version on my linux host i get o/p as
QMake version 3.1
Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu
But if i used this qmake.bin for configuration then QT complains that it is not able to find compatability between the target compiler configuration and current qmake which is 64-bit linux based.
From where i can get a qmake.bin for my stm32mp1 platform ? Any leads will be highly appreciated.

Cross Compile a automake project?

I am developing an application for enocean. I am able to compile it for my Host system. I want to cross compile it for beaglebone black running openwrt. I have cross compiler and all other libraries. I am not sure how to change the existing configure, Makefiles to cross-compile it.
Please help!
you don't have to change anything. autotools comes with full cross-compilation support.
Just pass the proper --host= flag for your target architecture, e.g.:
./configure --host arm-linux-gnueabihf
This will look for toolchain programs with the given prefix (in the above case, it would look e.g. for a compiler arm-linux-gnueabihf-gcc) in your current $PATH. Most cross-compiling toolchains should automatically adhere to this convention.
See also the official documentation

Building Xalan for iOS (armv7/armv7s) platform

Has anybody successful cross compiled the Xalan C++ library for armv7/armv7s arch to be used on iOS device (not simulator)?
I was able to cross compile the xerces library by setting the iOS g++/gcc compilers for armv7 but using the same procedure for Xalan gives me below error while running the make file:
iComp:c iComp$ make
Linux, Solaris, AIX, Compaq Tru64, OS/390, MacOSX, HP-UX, NETBSD, FREEBSD, CYGWIN, and MINGW are the only platforms supported.
Above error clearly states that I cannot target the iOS platform.
So was there some problem in configuring the makefiles?
UPDATE
The above issue was occurring because of incorrect usage of Xalan's runConfigure file.
The correct usage to pass additional options to Configure file via runConfigure is to use '-C' option with "--host=arm-apple-darwin --disable-shared"
This has helped to resolve the above platform detection issue and generated the cross-compile make files.
PROBLEM
But now the issue is while running the make, default MsgLoader (inmeme)executable is generated (target: armv7) and after that the make file tries to run the armv7 executable on Mac OSX obviously giving the error 'Bad CpuType in executable'
How can I either avoid the building of Xalan by creating a armv7 exe of MsgLoader or run this armv7 exe in terminal (doesn't seems possible!) so that it proceeds with the build.
Thanks in advance for any help!!!

How install 64-bit Qt on Windows with C++11 support?

IN A NUTSHELL:
My 64-bit Qt build doesn't have C++11 support.
My Qt build with C++11 is 32-bit.
Qt5 using the online installer is 32-bit
Despite having dedicated the last 3 days of my life to this, I can't get 64-bit Qt5 to build from source.
Help! Something must be incompatible in my environment, but what could it be?
So, I need to develop 64-bit Qt apps with C++11 on Windows. I've found threads/guides here, here, here, here and here, and none of them work or apply, though I note the second of these let me build Qt 4.8.3 with C++11 support (but 32-bit). The third one looks more complicated than it should be and also involves building with VS 2010, which seems like part of the problem, so I haven't tried it. I have also wasted a lot of time trying to build previous versions with different compilers, like mingw and clang, so I'm pretty sure that cl is what I need to use.
Basically, I've gotten to the point where I can build Qt4.8.3 and execute 64-bit apps from within QtCreator 2.6.1, but I can't get full C++11 support. It finds only cl from VS 10.0 which has only very limited C++11 support. Figuring out how to get it to use cl from VS 11.0 would be one solution to my problem. But when I try
QMAKE_CXX = C:/Program Files (x86)/Microsoft Visual Studio
11.0/VC/bin/cl
the build fails with a jom Error 2, and if I select the option for building with nmake I get a similar error.
Qt 5 should have full C++11 support. But when I try to build it myself from source, it fails. The reason for this seems to be that despite running configure/make from the VS2012 x64 Cross Tools command prompt, specifying -platform win32-2012 in the configure step, and specifying QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32 as per
this guide, in both the win32-msvc2010 and win32-msvc2012 mkspecs, it still builds with the cl from VS 2010 and that is causing some kind of conflict. Here is my configure command:
configure -static -debug-and-release -confirm-license -opensource
-nomake tests -nomake exampmles -opengl desktop -no-libjpeg -platform win32-msvc2012
And here's the linker failure when I try to build:
At the end of the top 2 paragraphs you can see that msvc-2010 is being included, and earlier in the console output (not shown) there is -D_MSC_VER=1600 in the moc commands.
So I'm at a loss, can anyone help?
Edit: I had stated that I was building 64-bit apps with Qt5, actually I'm able to build 64-bit apps (w/o C++11 support) off a build of Qt 4.8.3. If I try this with Qt5, I get this error:
LNK1112: module machine type 'X86' conflicts with target machine type
'x64'
So this leads back to compiling Qt5 in 64-bit mode, which I can't seem to do.
Finally got a 'good enough' solution by going back and rebuilding 4.8.3 in 64-bit mode, this time ensuring that it was built with C++11 support. Since a solution involving Qt5 is what would be ideal, I'll leave this open for awhile to see if anyone can figure out how to do that.
Importantly, I note that I successfully built 64-bit, C++11-supporting 4.8.3 from the same prompt I had been using to try to build 5.0. Just changed directories. So same environment, everything. And I also have downloaded all the extra prereqs required for Qt5.
You can find prebuilds of Qt 5.0.1 SDK with 64bit support here:
http://releases.qt-project.org/digia/5.0.1/latest/
Tested and working :)
I found Qt 4.8.5 windows version qt-win-opensource-4.8.5-vs2008.exe at https://download.qt.io/archive/qt/4.8/4.8.5/ for VC++ projects.

Compiling my C++ code for ARM Architecture

I am a java developer. I have some C++ code to make some system realted calls. This code is compiled on Intel 32-bit platform using GCC (I have make files) and it works fine on regular Intel based 32-bit linux machine. Now I need to run this on a linux OS running on Marvell ARM processor. When I load the shared objects in java I get the following error.
cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)
Please tell me how to resolve this issue. I looked at the GCC options and I found one option to specify the architecture (-march=armv5) and I can't compile with that option.
Thanks in advance.
You need more than just a switch, you need a cross-compiler. You can make your own, but probably the easiest way is :
Find the development tools for your board. It probably comes with a development kit that includes a cross-compilation toolchain
If you don't have these, you can try to install a precompiled cross-compilation like the ones provided freely by CodeSourcery
Then you have to make the location of your toolchain (look for something like arm-none-linux-gnueabi-gcc) available in your path.
Cross compiling simple project is then easy, just override the CC variable in your Makefile :
CROSS = arm-none-linux-gnueabi-
CC = $(CROSS)gcc
LD = $(CROSS)ld
Try using the -mcpu=armv5 switch for gcc.
Here is what's written on http://elinux.org/RPi_Software#ARM:
-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s