cmake cross compile找不到头文件

时间:2017-09-21 06:03:06

标签: cmake openwrt

我想在openwrt平台上交叉编译 amazon Alexa SDK ,但在执行curl/curl.h时找不到make,这是我的操作步骤:

  1. 创建一个cmake工具链文件,如下所示:

    SET(CMAKE_SYSTEM_NAME Linux)
    SET(CMAKE_SYSTEM_VERSION 1)
    SET(CMAKE_C_COMPILER  arm-openwrt-linux-muslgnueabi-gcc)
    SET(CMAKE_CXX_COMPILER  arm-openwrt-linux-muslgnueabi-g++)
    
    SET(CMAKE_FIND_ROOT_PATH  /home/sundq/workspace/Develop/out/astar-parrot/staging_dir/target/rootfs)
    
    SET(CMAKE_SYSROOT  /home/sundq/workspace/Develop/out/astar-parrot/staging_dir/target/rootfs)
    
    SET(CMAKE_LIBRARY_PATH  /home/sundq/workspace/Develop/out/astar-parrot/staging_dir/target/rootfs/usr/lib)
    
    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_C_FLAGS "-I/home/sundq/workspace/Develop/out/astar-parrot/staging_dir/target/rootfs/usr/include")
    
    SET(CMAKE_CXX_FLAGS "-I/home/sundq/workspace/Develop/out/astar-parrot/staging_dir/target/rootfs/usr/include")
    
  2. 像这样执行cmake

    cmake ../avs-device-sdk-master-v1.0.2/ -DCMAKE_BUILD_TYPE=MINSIZEREL -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake
    
  3. 执行make,输出为:

    /AVSCommon/AVS/src/AlexaClientSDKInit.cpp:18:23: fatal error: curl/curl.h: No such file or directory
    
  4. 我确定curl / curl.h文件存在于/home/sundq/workspace/Develop/out/astar-parrot/staging_dir/target/rootfs/usr/include目录中。

1 个答案:

答案 0 :(得分:0)

正确的方法是为Alexa创建一个OpenWrt包,并添加libcurl作为依赖。

检查here如何创建包。