0

我正在构建 HelloWorld示例应用程序。但是我已经改变了它,以针对工具链 arm-none-linux-gnueabi。

如果编译器是原生的如下,没问题,它会编译 .

cmake_minimum_required(VERSION 3.10.2)

set(CMAKE_SYSTEM_NAME Generic)

set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_CROSSCOMPILING 1)

set(CMAKE_BUILD_IMAGE_VERSION 1)
   

set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
 
set(CMAKE_EXE_LINKER_FLAGS " -Wl, --no-as-needed -ldl -llttng-ust")

   
project(HelloWorld LANGUAGES C CXX)
    

include_directories(/usr/lib/x86_64-linux-gnu)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

include_directories(/usr/include/x86_64-linux-gnu/lttng)
      


add_library(hello-tp STATIC hello-tp.c hello-tp.h)
  

add_library(hello hello.c)

target_link_libraries(hello hello-tp)


target_include_directories(hello PUBLIC /usr/include/x86_64-linux-gnu/lttng)

但是如果我想通过添加以下两行来交叉编译:

set(CMAKE_C_COMPILER "/usr/bin/arm-linux-gnueabi-gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/arm-linux-gnueabi-g++")

如果我本地安装 lttng -> 为本地编译器成功构建当我尝试为 arm-linux-gnueabi-gcc 编译器构建应用程序时 - 我收到以下错误

fatal error: lttng/tracepoint.h: No such file or directory 

#include <lttng/tracepoint.h> 

如何使 lttng 跟踪交叉编译应用程序?

4

0 回答 0