Part Number:AM62A7-Q1
1.下面是main.c文件代码:
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
2.下面是对应的CMakeLists.txt文件内容:
cmake_minimum_required (VERSION 2.8)
project (demo)
add_executable(main main.c)
3.编译时报错:
[linux-devkit]:/home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/hawk> make
[ 50%] Building C object CMakeFiles/main.dir/main.c.o
In file included from /home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/aarch64-oe-linux/usr/include/features-time64.h:21,
from /home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/aarch64-oe-linux/usr/include/features.h:392,
from /home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/aarch64-oe-linux/usr/include/bits/libc-header-start.h:33,
from /home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/aarch64-oe-linux/usr/include/stdio.h:27,
from /home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/hawk/main.c:1:
/home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/aarch64-oe-linux/usr/include/bits/timesize.h:23:10: fatal error: bits/timesize-32.h: 没有那个文件或目录
23 | #include <bits/timesize-32.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/main.dir/build.make:76:CMakeFiles/main.dir/main.c.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/main.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
Shine:
感谢您对TI产品的关注!由于问题比较复杂,已将您的问题发布在E2E英文技术论坛上,由资深的英文论坛工程师为您提供帮助。 您也可以点击下帖链接了解进展:https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1319426/am62a7-q1-cmake-build-error
,
qingfeng huang:
昨天尝试定位了一下,应该是交叉编译环境不支持32位编译导致的:set(CMAKE_C_COMPILER "${TOOLCHAIN_DIR}/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc")set(CMAKE_CXX_COMPILER "${TOOLCHAIN_DIR}/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-g++")
头文件搜索位置设置如下:
set(INCLUDE_PATH ${CMAKE_SYSROOT}/x86_64-arago-linux/usr/lib/aarch64-oe-linux/gcc/aarch64-oe-linux/11.4.0/include)
CMAKE_SYSROOT和TOOLCHAIN_DIR都是对应下面路径:
sdk安装目录\linux-devkit\sysroots
现在需要确认的应该集中在四个问题上:
1.SDK环境是否只支持编译64位的目标?
2.win10的ubuntu22.04虚拟机上交叉编译是使用x86_64-arago-linux下的编译工具吗?
3.gcc的头文件搜索位置设置是正确的吗?还需要确认g++的头文件搜索位置,否则不能编译cpp的文件;
4.为了编译64位目标时,CMAKE_C_FLAGS和CMAKE_CXX_FLAGS的编译选项怎么设置?
,
qingfeng huang:
按照Andreas Dannenberg的建议,执行cmake出错:
[linux-devkit]:/home/qingfeng/workspace/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/hawk> cmake . -B build -DCMAKE_GENERATOR_PLATFORM=ARM64 -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchains/aarch64_linux_buildroot.cmakeCMake Error at CMakeLists.txt:3 (PROJECT): Generator
Unix Makefiles
does not support platform specification, but platform
ARM64
was specified.
,
qingfeng huang:
通过阅读下面链接:https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_DSP_CMAKE_GENERATOR_PLATFORM.html generators,例如Visual Studio Generators。
而我现在遇到的问题是基于sdk的linux-devkit搭建交叉编译环境,是两个方向。
,
Shine:
已跟进,请关注帖子的回复。
,
Shine:
请看下面e2e工程师的回复,他可以编译您的代码。
I tried building your CMake-based example in the context of the Linux devkit part of AM62A SDK v9.1 and had no issues. Please see log below. You can see how the aarch64 binary output file 'main' was generated successully.
a0797059@dasso:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit$ source ./environment-setup [linux-devkit]:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit> cd tmp/ [linux-devkit]:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/tmp> cmake CMakeLists.txtCMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a …<max> suffix to tell CMake that the project does not need compatibility with older versions. — Toolchain file defaulted to '/home/a0797059/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/x86_64-arago-linux/usr/share/cmake/OEToolchainConfig.cmake'– The C compiler identification is GNU 11.4.0– The CXX compiler identification is GNU 11.4.0– Detecting C compiler ABI info– Detecting C compiler ABI info – done– Check for working C compiler: /home/a0797059/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc – skipped– Detecting C compile features– Detecting C compile features – done– Detecting CXX compiler ABI info– Detecting CXX compiler ABI info – done– Check for working CXX compiler: /home/a0797059/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-g++ – skipped– Detecting CXX compile features– Detecting CXX compile features – done– Configuring done– Generating done– Build files have been written to: /home/a0797059/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/tmp [linux-devkit]:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/tmp> lltotal 52drwxrwxr-x 3 a0797059 a0797059 4096 Feb 5 12:35 ./drwxr-xr-x 4 a0797059 a0797059 4096 Feb 5 12:34 ../-rw-rw-r– 1 a0797059 a0797059 18261 Feb 5 12:35 CMakeCache.txtdrwxrwxr-x 5 a0797059 a0797059 4096 Feb 5 12:35 CMakeFiles/-rw-rw-r– 1 a0797059 a0797059 1891 Feb 5 12:35 cmake_install.cmake-rw-rw-r– 1 a0797059 a0797059 83 Feb 5 12:34 CMakeLists.txt-rw-rw-r– 1 a0797059 a0797059 90 Feb 5 12:34 main.c-rw-rw-r– 1 a0797059 a0797059 5793 Feb 5 12:35 Makefile [linux-devkit]:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/tmp> make[ 50%] Building C object CMakeFiles/main.dir/main.c.o[100%] Linking C executable main[100%] Built target main [linux-devkit]:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/tmp> lltotal 68drwxrwxr-x 3 a0797059 a0797059 4096 Feb 5 12:35 ./drwxr-xr-x 4 a0797059 a0797059 4096 Feb 5 12:34 ../-rw-rw-r– 1 a0797059 a0797059 18261 Feb 5 12:35 CMakeCache.txtdrwxrwxr-x 5 a0797059 a0797059 4096 Feb 5 12:35 CMakeFiles/-rw-rw-r– 1 a0797059 a0797059 1891 Feb 5 12:35 cmake_install.cmake-rw-rw-r– 1 a0797059 a0797059 83 Feb 5 12:34 CMakeLists.txt-rwxrwxr-x 1 a0797059 a0797059 15536 Feb 5 12:35 main*-rw-rw-r– 1 a0797059 a0797059 90 Feb 5 12:34 main.c-rw-rw-r– 1 a0797059 a0797059 5793 Feb 5 12:35 Makefile [linux-devkit]:~/ti/ti-processor-sdk-linux-edgeai-am62axx-evm-09_01_00_07/linux-devkit/tmp> file mainmain: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=123cbf73df0ae93094777ad6ceddc62ff1861c1b, for GNU/Linux 3.14.0, with debug_info, not stripped