Creating CMake project for embedded target without Qt fails
-
Hello everyone,
I'm trying to set up a simple CMake project in Qt Creator to test cross-compiling to Beaglebone Black single-board computer. My OS is Ubuntu 18.04. I've installed a cross compiler, tested it from command line. The compiled hello world program runs on Beaglebone.
The next step is to create a project in Qt Creator. What I did:- Installed CMake 3.21
- Ensured that cross compiler is auto detected in Qt Creator
- Added a kit to Qt Creator settings that uses the cross compiler
- Specified the path to sysroot of Beaglebone
- Set Qt profile to None
When I create a CMake project, I get the following messages:
Starting /usr/bin/cmake -S /home/azarubkin/beaglebone/fails_by_default -B /tmp/QtCreator-oBRncD/qtc-cmake-uOFBOzMA '-GUnix Makefiles' -DCMAKE_BUILD_TYPE:String=Debug -DCMAKE_SYSROOT:PATH=/home/azarubkin/beaglebone/rootfs -DCMAKE_C_COMPILER_TARGET:STRING=arm-linux-gnueabihf -DCMAKE_CXX_COMPILER_TARGET:STRING=arm-linux-gnueabihf -DQT_QMAKE_EXECUTABLE:STRING= -DCMAKE_PREFIX_PATH:STRING= -DCMAKE_C_COMPILER:STRING=/usr/bin/arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER:STRING=/usr/bin/arm-linux-gnueabihf-g++ на /tmp/QtCreator-oBRncD/qtc-cmake-uOFBOzMA. -- The CXX compiler identification is GNU 7.5.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ -- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ - broken -- Configuring incomplete, errors occurred! See also "/tmp/QtCreator-oBRncD/qtc-cmake-uOFBOzMA/CMakeFiles/CMakeOutput.log". See also "/tmp/QtCreator-oBRncD/qtc-cmake-uOFBOzMA/CMakeFiles/CMakeError.log". CMake Error at /usr/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:62 (message): The C++ compiler "/usr/bin/arm-linux-gnueabihf-g++" is not able to compile a simple test program. It fails with the following output: Change Dir: /tmp/QtCreator-oBRncD/qtc-cmake-uOFBOzMA/CMakeFiles/CMakeTmp Run Build Command(s):/home/azarubkin/beaglebone/rootfs/usr/bin/make -f Makefile cmTC_b5327/fast && /lib/ld-linux-armhf.so.3: No such file or directory CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) CMake process finished with code 1.
And the parsing of the project fails. As you can see, CMake tries to invoke
make
from within the sysroot, no wonder it fails, it's compiled for a different CPU architecture. If I remove sysroot, it works.
But how can I fix it when sysroot path is given? I need it for linking to additional libraries. -
If CMake is not a mandatory choosing for you, then you can use QBS as a build system instead. Because the QBS is a simplest ans a fastest way todo what you want. ;)
-
Yes, it is. But Qbs is better (IMHO), and you can use QtCreator && VSCode IDEs. ;)
CMake it is pain...