aws / aws-iot-device-sdk-embedded-C

SDK for connecting to AWS IoT from a device using embedded C.
MIT License
975 stars 623 forks source link

cross compile: RT_LIB causes build to fail #1820

Closed certabitmh closed 1 year ago

certabitmh commented 1 year ago

I'm helpless after hours of trying to cross compile 202108.00 with arm linux toolchain. c/c++ compiler, openssl lib are all found (because handled by a shell prep script setting all paths)

although I only want to compile shadow example, cmake scripts report an error because if missing RT_LIB.

-- The C compiler identification is GNU 8.4.0 -- The CXX compiler identification is GNU 8.4.0 -- Check for working C compiler: /opt/mytoolchainpath/host/bin/arm-buildroot-linux-gnueabi-gcc -- Check for working C compiler: /opt/mytoolchainpath/host/bin/arm-buildroot-linux-gnueabi-gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /opt/mytoolchainpath/host/bin/arm-buildroot-linux-gnueabi-g++ -- Check for working CXX compiler: /opt/mytoolchainpath/host/bin/arm-buildroot-linux-gnueabi-g++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE
-- Found Git: /usr/bin/git (found version "2.25.1") ..... -- Found OpenSSL: /opt/mytoolchainpath/host/arm-buildroot-linux-gnueabi/sysroot/usr/lib/libcrypto.so (found version "1.1.1g")

my build commands executed in sdk root dir:

cmake -S . -Bbuild -DAWS_IOT_ENDPOINT="myendpoint.amazonaws.com" -DROOT_CA_CERT_PATH="/mypathto/aws-iot-rootCA.crt" -DCLIENT_CERT_PATH="/mypathto/certificate.pem.crt" -DCLIENT_PRIVATE_KEY_PATH="/mypathto/private.pem.key" -DTHING_NAME="MYTHINGNAME" -DPLATFORM_NAME="posix"

make shadow_demo_main

this fails with:

... CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: LIB_RT linked by target "http_demo_s3_download_multithreaded" in directory /mypath/packages/aws-iot-device-sdk-embedded-C/demos/http/http_demo_s3_download_multithreaded linked by target "ota_demo_core_http" in directory /mypath/packages/aws-iot-device-sdk-embedded-C/demos/ota/ota_demo_core_http linked by target "ota_demo_core_mqtt" in directory /mypath/packages/aws-iot-device-sdk-embedded-C/demos/ota/ota_demo_core_mqtt

-- Configuring incomplete, errors occurred! See also "/mypath/packages/aws-iot-device-sdk-embedded-C/build/CMakeFiles/CMakeOutput.log". See also "/mypath/packages/aws-iot-device-sdk-embedded-C/build/CMakeFiles/CMakeError.log". make: *** No rule to make target 'shadow_demo_main'. Stop.

(full log attached)

please help! build_log.txt

archigup commented 1 year ago

Hi, are the librt headers available in your buildroot? It is odd that rt is being pulled in when only building shadow; I'll look into this.

archigup commented 1 year ago

What platform is the host?

certabitmh commented 1 year ago

Ubuntu x86, target is arm based


Von: Archit Gupta @.> Gesendet: Saturday, October 15, 2022 12:58:12 AM An: aws/aws-iot-device-sdk-embedded-C @.> Cc: Markus Hammer | CertaBit Engineering @.>; Author @.> Betreff: Re: [aws/aws-iot-device-sdk-embedded-C] cross compile: RT_LIB causes build to fail (Issue #1820)

What platform is the host?

— Reply to this email directly, view it on GitHubhttps://github.com/aws/aws-iot-device-sdk-embedded-C/issues/1820#issuecomment-1279560874, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJNK5TNC4AUN324ZCA2YUEDWDHQQJANCNFSM6AAAAAAQ7ORRPY. You are receiving this because you authored the thread.Message ID: @.***>

archigup commented 1 year ago

Hey, I'm not able to reproduce this. Do you have more information about the sysroot and host system? I see you are using GGC 8, have you tried a newer version? At some point librt was moved out of glibc, so that might be related

archigup commented 1 year ago

Hey, closing this; feel free to reopen in you have more info.