gpt4 book ai didi

c - azure-iot-sdk-c 交叉编译链接器问题 : ld: cannot find -luuid

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:36:09 27 4
gpt4 key购买 nike

总的来说,我尝试遵循 cross compile azure iot sdk 中的准则.

以下是azure-iot-sdk-c/build_all/linuxtoolchain-bb.cmake的内容

INCLUDE(CMakeForceCompiler)

SET(CMAKE_SYSTEM_NAME Linux) # this one is important
SET(CMAKE_SYSTEM_VERSION 1) # this one not so much

SET(CMAKE_C_COMPILER /mnt/yocto/bsp-yocto/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_FIND_ROOT_PATH /mnt/yocto/yocto_repo/build/arago-tmp-external-linaro-toolchain/sysroots/am57xx-evm/usr)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# openssl directories
SET(OPENSSL_ROOT_DIR /mnt/yocto/yocto_repo/build/tmp/sysroots/am57xx-evm/usr/lib/)
SET(OPENSSL_INCLUDE_DIR /mnt/yocto/yocto_repo/build/tmp/sysroots/am57xx-evm/usr/include/)

SET(CURL_LIBRARY /mnt/yocto/yocto_repo/build/tmp/sysroots/am57xx-evm/usr/lib/libcurl.a)
SET(CURL_INCLUDE_DIR /mnt/yocto/yocto_repo/build/tmp/sysroots/am57xx-evm/usr/include/curl/)

SET(UUID_LIBRARY_DIRS /mnt/yocto/yocto_repo/build/arago-tmp-external-linaro-toolchain/sysroots/am57xx-evm/usr/lib)

azure-iot-sdk-c/build_all/linux/ 我使用以下命令:

sudo ./build.sh --toolchain-file toolchain-bb.cmake

这是输出:

Linking C static library libumqtt.a
Linking C executable iot_c_utility
[ 68%] Built target umqtt
Scanning dependencies of target iothub_client_mqtt_transport
Scanning dependencies of target iothub_client_mqtt_ws_transport
/mnt/yocto/bsp-yocto/gcc-linaro-5.3-2016.02-x86_64_arm-linux-
gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../../arm-linux-
gnueabihf/bin/ld: cannot find -luuid
collect2: error: ld returned 1 exit status
make[2]: *** [c-utility/samples/iot_c_utility/iot_c_utility] Error 1
make[1]: *** [c-
utility/samples/iot_c_utility/CMakeFiles/iot_c_utility.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

在上面列出的 StackOverflow 链接中,提到 --sysroot 非常重要。但是,当我如下所示指定 --sysroot 时,构建很早就失败了(即构建中大约 [5%])。

 sudo ./build.sh --toolchain-file toolchain-bb.cmake -cl --sysroot=/mnt/yocto/bsp-yocto/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/lib

重要说明:libuuid.a 存在于:

/mnt/yocto/yocto_repo/build/arago-tmp-external-linaro-toolchain/sysroots/am57xx-evm/usr/lib

最佳答案

您应该包含这一行:

set(compileOption_C "--sysroot=<your_path_to_sysroot>")

并确保您已在主机系统中安装了 libuuid

sudo apt-get install uuid-dev

关于c - azure-iot-sdk-c 交叉编译链接器问题 : ld: cannot find -luuid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48738129/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com