Crosscompile qt6 for raspberry pi 4 - qt

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..

Related

Intel oneAPI dpcpp compiler with google test

I'm kinda new to the world of Intel's HPC toolchain and I'm facing some troubles making even simple DPC++ application to work when gtest is used as a testing framework
This is the CMakeLists "structure" I'm following
cmake_minimum_required(VERSION 3.14)
project(foo)
set(CMAKE_CXX_COMPILER "dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -fsycl")
# add executables
# target linked libraries
# ...
option(ENABLE_TESTS ON)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(tests)
endif()
If I remove the last block, it compiles and runs as expected, otherwise I get the following error:
CMake Error at build/_deps/googletest-src/CMakeLists.txt:10 (project):
The CMAKE_CXX_COMPILER:
dpcpp
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/u141905/foo/build/CMakeFiles/CMakeOutput.log".
See also "/home/u141905/foo/build/CMakeFiles/CMakeError.log".
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= /usr/bin/c++
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
make: *** [Makefile:2: all] Error 1
Please notice that dpcpp is correctly set, in fact I'm using Intel's devcloud platform.
Setting CXXto the output of whereis dpcpp produces the same error.
The only "workaround" (I doubt it is one though) I found is using clang++ instead (the version from Intel's llvm). Any help or suggestion is much appreciated, thanks in advance!
EDIT: after some more attempts, I noticed that if I set CMAKE_CXX_COMPILER just after fetching gtest, everything works fine. Anyway I don't understand why this happens and how can be properly fixed.
Use the path for dpcpp binary for setting the CMAKE_CXX_COMPILER instead of using"set(CMAKE_CXX_COMPILER "dpcpp")". After adding the path("/opt/intel/oneapi/compiler/2022.0.1/linux/bin/dpcpp") to the CMAKE_CXX_COMPILER, you can run the program successfully.
Please find the below CMakeLists.txt for setting the CMAKE_CXX_COMPILER:
project(foo)
set(CMAKE_CXX_COMPILER "/opt/intel/oneapi/compiler/2022.0.1/linux/bin/dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -fsycl")
# add executables
# target linked libraries
# ...
set(ENABLE_TESTS ON)
include(FetchContent)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(tests)
endif()
Thanks & Regards,
Hemanth
Did you run the source /opt/intel/oneapi/setvars.sh intel64 script? I.e. is dpcpp on your path before running cmake?

Driver and kernel module install for FPGS fails

I am trying to install OpenCL on a machine with the following specs:
CentOS 6.8
Kernel version 2.6.32-642.el6.x86_64
4G of RAM
FPGA board "Nallatech 395 – with Stratix V D8"
aocl version
aocl 16.0.0.211 (Altera SDK for OpenCL, Version 16.0.0 Build 211, Copyright (C) 2016 Altera Corporation)
However, I receive error [Q 2-3] described in the following page:
http://www.alteraforum.com/forum/showthread.php?t=46355
/#aocl install aocl install: Running install from
/root/altera/16.0/hld/board/nalla_pcie/linux64/libexec Using kernel
source files from /usr/src/kernels/2.6.32-642.el6.x86_64 make: ***
/usr/src/kernels/2.6.32-642.el6.x86_64: No such file or directory.
Stop. cp: cannot stat `./aclpci_drv.ko': No such file or directory
FATAL: Module aclpci_drv not found.
The page above suggests to execute the following command:
yum install kernel-devel
However I still receive the same error.
Please advise!
I found a thread with a similar error, the following solution could work for you. However, this solution is based on version 14.
First navigate to the linux/driver of the BSP folder which for you should be located at root/altera/16.0/hld/board/nalla_pcie/linux64/driver
Find and edit the file aclpci.c: At the top of the file add the following lines:
#define __devinit
#define __devexit
Secondly edit aclpci_cmd.c: On line 83 remove the assignment
Change:
result = pci_restore_state(aclpci->pci_dev);
to:
pci_restore_state(aclpci->pci_dev);
On lines 438-440 comment out the following statements:
if (dev->aer_firmware_first) {
return -EIO;
}
You should now be able to run "aocl install" successfully.

Installing terminator on cygwin

After going through a lot of sites about best terminal for system admins I was trying to install on Cygwin. Unfortunately, I did not find any good site with instruction about how to do it.
Is anyone done this before? Please help me with steps and packages that I need to install.
Also is there any terminals I can try (like Cygwin)?
I don't know since what version, but now you can install terminator just from the Cygwin installer. And runs great
Regards
If you don't want to use cygwinports, you can actually install all of terminator's dependencies from the cygwin installer, except for terminator itself.
In the cygwin installer select and install:
python-dbus
python-gobject
python-gtk2.0
python-vte (under GNOME tab for some reason)
GConf2
Then, pull down the latest terminator tarball from https://launchpad.net/terminator/+download and extract it somewhere. In a administrator terminal just run python setup.py install and as long as you have a running X server just running terminator will work perfectly.
The sources about how to install terminator are a bit obscures. What I did, and may help you, was this: (although I'm still having segmentation faults errors)
Update your Cygwin to the latest
Open a Cygwin terminal and run: (if you have the x86 version use that. The idea of this step is to use Cygwin Ports)
cygstart -- /your/cygwin/path/setup-x86_64.exe -K http://cygwinports.org/ports.gpg
In the section Choose A Download Site:
Add "http://downloads.sourceforge.net/cygwin-ports"
Add " ftp://ftp.cygwinports.org/pub/cygwinports"
Select another mirror close to you
Check that you have a total of three URLs selected
It may show you warning about not loading the .ini configuration but ignore them (Note: I looked for different port URLs but the official ones threw me errors and I could not pass this step, that's why I used alternatives URLs)
First, you need to install the packages for the X Window:
http://x.cygwin.com/docs/ug/setup.html
Basically they are:
xorg-server (required, the Cygwin/X X Server)
xinit (required, scripts for starting the X server: xinit, startx, startwin (and a shortcut on the Start Menu to run it), startxdmcp.bat )
xorg-docs (optional, man pages)
Also search and select the terminator package
It takes quite a while before it finishes.
Go to Start->All Programs->Cygwin-X->X Win Server (windows tool bar)
A xterm window should open. Type:
terminator
You should know have terminator with Cygwin.
Note: After I run terminator I get this error:
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::sm-connect after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::show-crash-dialog after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::display after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
/usr/lib/python2.7/site-packages/terminatorlib/terminator.py:87: Warning: Attempt to add property GnomeProgram::default-icon after class was initialised
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
Warning: python-keybinder is not installed. This means the hide_window shortcut will be unavailable
Unable to bind hide_window key, another instance/window has it.
Segmentation fault (core dumped)
I've looking to fix this issue but sadly I couldn't find anything. If you use Cygwin x86 your outcome can be different.
Hope this can help you.

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.

illegal text reloc to non_lazy_ptr error while building in xcode 4 with libav* libraries

I'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error:
ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386
I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend.
One more thing: my libav* libraries are fat binaries (i386 + x86_64).
Any ideas what can it be?
I have the same error. Finally, I got the solution at
http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
just add other link flag:
-read_only_relocs suppress
* EXPLANATION * The two assembly commands load the absolutes address of _trail into R15. Doing so is fine if _trail is ultimately
in the same linkage unit. _trail is in libmodule.dylib. For this to
work, at runtime the dynamic loader (dyld) would have to rewrite the
two instructions. Normally dyld only updates data pointers. One work
around is to make libdyalog an archive (e.g. libdyalog.a) and link
that with pere.s. Then all the code would be in the same linkage unit,
so there would be no need for runtime text relocs. The runtime (dyld)
does support text relocs (updating instructions) for i386, but you
need to link with -read_only_relocs suppress.

Resources