abhiTronix / raspberry-pi-cross-compilers

Latest GCC Cross Compiler & Native (ARM & ARM64) CI generated precompiled standalone toolchains for all Raspberry Pis. 🍇
https://sourceforge.net/projects/raspberry-pi-cross-compilers
GNU General Public License v3.0
583 stars 102 forks source link

Cmake build fails for raspberry pi 4 target #82

Closed vishnucool220 closed 2 years ago

vishnucool220 commented 2 years ago

I have followed your tutorial and everything works smooth till i select cmake instead of qmake. Qt projects based on qmake build system works fine but Qt projects based on cmake is not working. I get the following Cmake build errors:

image

What exactly is the problem? and how can i debug it?

thank you!

Edit1 : how can i set Cmake from crosscompiler version instead of host. ?

abhiTronix commented 2 years ago

@vishnucool220 How your're using cmake, what's content of your cmake file, and on which system(linux, mac, WSL(windows)) you're using it?

I get the following Cmake build errors:

image

Which software is this?

vishnucool220 commented 2 years ago

@abhiTronix its basic cmake file:


cmake_minimum_required(VERSION 3.5)

project(cmake-example LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5Core)

add_executable(cmake-example
  main.cpp
)
target_link_libraries(cmake-example Qt5::Core)

I am on Linux Ubunu ( on VM (running on windows)). The software is Qt Creator.

How can i build my Qt project on my host system targeting raspberry pi 4 from termianl?

abhiTronix commented 2 years ago

@abhiTronix its basic cmake file:


cmake_minimum_required(VERSION 3.5)

project(cmake-example LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5Core)

add_executable(cmake-example
  main.cpp
)
target_link_libraries(cmake-example Qt5::Core)

I am on Linux Ubunu ( on VM (running on windows)). The software is Qt Creator.

How can i build my Qt project on my host system targeting raspberry pi 4 from termianl?

@vishnucool220 It will not work, you atleast need rsynced sysroot from raspberry pi to be able to cross-compile anything for your raspberry pi with cmake. See this doc: https://github.com/abhiTronix/raspberry-pi-cross-compilers/wiki/Cross-Compiler-CMake-Usage-Guide-with-rsynced-Raspberry-Pi-32-bit-OS#cross-compiler-cmake-usage-guide-with-rsynced-raspberry-pi-32-bit-os

vishnucool220 commented 2 years ago

@abhiTronix thank you for the quick response! With your wiki page. I have now finally working CMake project. Thanks :)

off topic. How can i specify my vcpkg tool chain ?"-DCMAKE_TOOLCHAIN_FILE=C:/Users/.../vcpkg/scripts/buildsystems/vcpkg.cmake"

when i am already giving the cross compile setting tool chain. -DCMAKE_TOOLCHAIN_FILE=../pi.cmake (took from your example)

possible answer: https://stackoverflow.com/questions/58777810/how-to-integrate-vcpkg-in-linux-with-cross-build-toolchain-as-well-as-sysroot