How to write custom recipe to install AWS C SDK from github #yocto #linux #dunfell


Vijay Rakesh Munganda
 

Hi,

I'm trying to write a recipe to install AWS SDK into the build(https://github.com/aws/aws-iot-device-sdk-embedded-C), but I complete don't know how to do it. Based on online example https://github.com/joaocfernandes/Learn-Yocto/blob/master/develop/Recipe-CMake.md I have written my recipe file and download the sdk into files folder of my recipe. When I run build do_configure got failed.

SUMMARY = "AWS IoT SDK EMBEDDED C"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
SRC_URI = "file://CMakeLists.txt"
 
S = "${WORKDIR}"
 
inherit cmake
 
EXTRA_OECMAKE = ""

I know it is wrong, but kindly please someone help to write it correctly, thank you.

Thanks & Regards,
VR


Ross Burton
 

I suggest looking at meta-aws (https://github.com/aws/meta-aws) to see
if that has a recipe already, and if it doesn't use one of the recipes
there as a starting point.

Ross

On Wed, 2 Dec 2020 at 10:02, <vijayrakeshmunganda@gmail.com> wrote:

Hi,

I'm trying to write a recipe to install AWS SDK into the build(https://github.com/aws/aws-iot-device-sdk-embedded-C), but I complete don't know how to do it. Based on online example https://github.com/joaocfernandes/Learn-Yocto/blob/master/develop/Recipe-CMake.md I have written my recipe file and download the sdk into files folder of my recipe. When I run build do_configure got failed.

SUMMARY = "AWS IoT SDK EMBEDDED C"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://CMakeLists.txt"

S = "${WORKDIR}"

inherit cmake

EXTRA_OECMAKE = ""

I know it is wrong, but kindly please someone help to write it correctly, thank you.

Thanks & Regards,
VR


Quentin Schulz
 

Hi VR,

On Wed, Dec 02, 2020 at 02:02:39AM -0800, vijayrakeshmunganda@gmail.com wrote:
Hi,

I'm trying to write a recipe to install AWS SDK into the build(https://github.com/aws/aws-iot-device-sdk-embedded-C), but I complete don't know how to do it. Based on online example https://github.com/joaocfernandes/Learn-Yocto/blob/master/develop/Recipe-CMake.md I have written my recipe file and download the sdk into files folder of my recipe. When I run build do_configure got failed.
If you don't give us the log, we won't be able to help you.

SUMMARY = "AWS IoT SDK EMBEDDED C"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://CMakeLists.txt"
Where is the sdk? You need to add it into your SRC_URI (you can also
just pass a URL to a git repo or tarball download link).

Quentin


Vijay Rakesh Munganda
 

Hi Quentin Schulz,

Thanks for the reply. I had downloaded the SDK into "files" folder of my recipe and given CMakeLists.txt as SRCURI. Is it correct to do like this?

Here is the Error: (It's a long error)

ERROR: aws-1.0-r0 do_configure: Execution of '/home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/temp/run.do_configure.28296' failed with exit code 1:
-- The C compiler identification is GNU 9.3.0
-- Check for working C compiler: /home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
-- Check for working C compiler: /home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found OpenSSL: /home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/recipe-sysroot-native/usr/lib/libcrypto.so (found version "1.1.1g")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
Downloading the Amazon Root CA certificate...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Download  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (77) error setting certificate verify locations:
CAfile: /home/bl-docker/rity/bsp/tmp/work/x86_64-linux/curl-native/7.69.1-r0/recipe-sysroot-native/etc/ssl/certs/ca-certificates.crt
CApath: none
Downloading the Baltimore Cybertrust Root CA certificate...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (77) error setting certificate verify locations:
CAfile: /home/bl-docker/rity/bsp/tmp/work/x86_64-linux/curl-native/7.69.1-r0/recipe-sysroot-native/etc/ssl/certs/ca-certificates.crt
CApath: none
CMake Error at demos/defender/defender_demo_json/CMakeLists.txt:6 (include):
include could not find load file:
/home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/libraries/standard/coreMQTT/mqttFilePaths.cmake
CMake Error at demos/defender/defender_demo_json/CMakeLists.txt:9 (include):
include could not find load file:
/home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/libraries/standard/backoffAlgorithm/backoffAlgorithmFilePaths.cmake
CMake Error at demos/defender/defender_demo_json/CMakeLists.txt:12 (include):
include could not find load file:
/home/bl-docker/rity/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/libraries/standard/coreJSON/jsonFilePaths.cmake (Similar errors continued for few files)

Thanks & Regards,
VR


Quentin Schulz
 

Hi VR,

On Wed, Dec 02, 2020 at 03:27:51AM -0800, vijayrakeshmunganda@gmail.com wrote:
Hi Quentin Schulz,

Thanks for the reply. I had downloaded the SDK into "files" folder of my recipe and given CMakeLists.txt as SRCURI. Is it correct to do like this?
You need to put the SDK filename into SRC_URI as well otherwise Yocto
does not fetch it from the files directory.

Also, Ross had a good suggestion too, please check that the recipe or a
similar one does not exist already in meta-aws (or other layers).

Quentin


Vijay Rakesh Munganda
 

Hi Quentin Schulz & Ross,

Thanks for the information. Based on meta-aws I had written the recipe and do_compile has completed. Now I want to install demos in to the build which are located at tmp/work/aarch64-poky-linux/aws/1.0-r0/git/demos/mqtt/mqtt_demo_mutual_auth, so how do I write do_install? ( https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/main/demos/mqtt/mqtt_demo_mutual_auth

do_install() {
         install -d ${D}${bindir}
         install -m 0755 mqtt_demo_mutual_auth ${D}${bindir}
}

Does above code works?

Thanks & Regards,
VR.


Vijay Rakesh Munganda
 

Hi,

do_install failed with an error "ninja: error: unknown target 'install'". Kindly please help me to fix the above issue.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/poky/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/build [0/2] /home/poky/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/recipe-sysroot-native/usr/bin/cmake -P /home/poky/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/build/CMakeFiles/VerifyGlobs.cmake ninja: error: unknown target 'install' WARNING: /home/poky/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/temp/run.do_install.15415:1 exit 1 from 'eval ${DESTDIR:+DESTDIR=${DESTDIR} }VERBOSE=1 cmake --build '/home/poky/bsp/tmp/work/aarch64-poky-linux/aws/1.0-r0/build' "$@" -- ${EXTRA_OECMAKE_BUILD}' ERROR: Task (/home/poky/src/meta-application/recipes-bleapp/aws/aws_1.0.bb:do_install) failed with exit code '1'

Thanks & Regards,
VR