Search code examples
cmakealexa-skills-kityoctobitbakecustom-application

How to Compile SampleApp of Alexa-SDK using bitbake for RaspberryPi


I am trying to add a custom layer for Alexa-SDK. I created *.bb file and when I run bitbake alexa command every task completes successfully. But I am unable to find SampleApp executable in /tmp /deploy or /work direrctory.

Here is my *.bb file

SUMMARY = "bitbake-alexa recipe" 
DESCRIPTION = "Alexa SDK"  
SECTION = "alexa" 
LICENSE = "CLOSED"

SRC_URI = "git://github.com/alexa/avs-devicesdk.git;branch=master;protocol=https"

SRCREV = "8bf0160c5e56a3d5ebc1e1caeab14afc8658b0da"

INSANE_SKIP_${PN} = "dev-so" 
TARGET_CC_ARCH += "${LDFLAGS}"

S = "${WORKDIR}/git" 
SB = "${WORKDIR}/build"

AVS_DIR ?= "/home/root/Alexa_SDK"

inherit cmake
EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=RELEASE \
                 -DGSTREAMER_MEDIA_PLAYER=ON \
                 -DCMAKE_INSTALL_PREFIX=${D}${AVS_DIR}/avs-sdk-client \
                 -DPORTAUDIO=ON  \
                 -DPORTAUDIO_LIB_PATH=${STAGING_LIBDIR}/libportaudio.so \
                 -DPORTAUDIO_INCLUDE_DIR=${STAGING_INCDIR} \
"

RDEPENDS_${PN} += "bash perl" 
DEPENDS = "curl sqlite3 portaudio-v19 gstreamer1.0-plugins-base"

do_compile() {
    cd ${SB}
    oe_runmake ${PARALLEL_MAKE} SampleApp 
}

do_install() {
    install -d -m 0755 ${D}${AVS_DIR}
    install -d -m 0755 ${D}/sounds
    install -d -m 0755 ${D}/database
    install -d -m 0755 ${D}${AVS_DIR}/avs-sdk-client

    cd ${SB}
    find ./ -executable -type f -exec cp --parents -v {} 
   ${D}/${AVS_DIR}/avs-sdk-client \;

    find ./ -name *.py -exec cp --parents -v {} ${D}/${AVS_DIR}/avs-sdk-client \;

    find ${D}/${AVS_DIR}/avs-sdk-client -name "*.py" -exec sed -e s#${SB}#${AVS_DIR}/avs-sdk-client#g -i {} \;

    mkdir ${D}/${AVS_DIR}/avs-sdk-client/Integration
    mkdir ${D}/${AVS_DIR}/libs
    cd ${D}/${AVS_DIR}/libs
    find ../avs-sdk-client -executable -type f -exec ${WORKDIR}/libsInstall.sh {} \;

    cp -r -L ${S} ${D}/${AVS_DIR}/avs-device-sdk
    cd ${D}/${AVS_DIR}/avs-device-sdk
    git repack -a -d 
}

FILES_${PN} = "${AVS_DIR} /sounds /database" 
BBCLASSEXTEND = "native"

Please suggest what I am missing as I want to make SampleApp part of the image and run it on RaspberryPi

Updated .bb file

 SUMMARY = "bitbake-alexa recipe" DESCRIPTION = "Alexa SDK"  SECTION = "alexa" LICENSE = "CLOSED"

    SRC_URI = "git://github.com/alexa/avs-device-sdk.git;branch=master;protocol=https"

    SRCREV = "8bf0160c5e56a3d5ebc1e1caeab14afc8658b0da"


    S = "${WORKDIR}/git" SB = "${WORKDIR}/build"

    TARGET_CXXFLAGS += " -D_GLIBCXX_USE_CXX11_ABI=0
    -Wno-error=class-memaccess" 
inherit cmake 
INSANE_SKIP_${PN} = "install-vs-shipped" 
INSANE_SKIP_${PN} = "ldflags"

    AVS_DIR ?= "/home/root/Alexa_SDK"


    EXTRA_OECMAKE = " \     -DCMAKE_BUILD_TYPE=DEBUG \  -DGSTREAMER_MEDIA_PLAYER=ON \
            -DCMAKE_INSTALL_PREFIX=${D}${AVS_DIR}/avs-sdk-client \  -DPORTAUDIO=ON \    -DPORTAUDIO_LIB_PATH=${STAGING_LIBDIR}/libportaudio.so \    -DPORTAUDIO_INCLUDE_DIR=${STAGING_INCDIR} \ " RDEPENDS_${PN} += "bash 
            perl" 
            DEPENDS = " \   curl \  sqlite3 \
            portaudio-v19 \     gstreamer1.0-plugins-base \      
            gstreamer1.0-plugins-base \
            gstreamer1.0-plugins-good \
            gstreamer1.0-plugins-bad \  gstreamer1.0-plugins-ugly \      
          gstreamer1.0-libav \ "
 do_install(){
         install -d -m 0755 ${D}${AVS_DIR}
         install -d -m 0755 ${D}${AVS_DIR}/avs-sdk-client
         find ./ -executable -type f -exec cp --parents -v {} 
         ${D}/${AVS_DIR}/avs-sdk-client \;
         find ./ -name *.py -exec cp --parents -v {} ${D}/${AVS_DIR}/avs- 
         sdk-client \;
         find ${D}/${AVS_DIR}/avs-sdk-client -name "*.py" -exec sed -e 
         s#${SB}#${AVS_DIR}/avs-sdk-client#g -i {} \;
         mkdir ${D}/${AVS_DIR}/libs
         cd ${D}/${AVS_DIR}/libs
         find ../avs-sdk-client -executable -type f -exec 
         ${WORKDIR}/libsInstall.sh {} \;
         cp -r -L ${S} ${D}/${AVS_DIR}/avs-device-sdk
         cd ${D}/${AVS_DIR}/avs-device-sdk
         git repack -a -d
         rm .git/objects/info/alternates
 }

FILES_${PN}  += "${bindir}/SampleApp \
                          ${AVSDIR} \"

Solution

  • Since you are using cmake here you don't need to write do_compile() here as cmake bbclass will take of it when you do inherit cmake.

    If the CmakeLists.txt for you are application is fine, yocto will compile it out and created the required bins/libs as part of it.

    You can add

         FILES_${PN}  += "${bindir}/sample app \
                          ${AVSDIR} \
                          sounds"
    

    And then add your package into corresponding package group or add in local.conf.

    IMAGE_INSTALL_append = "sampleApp"
    

    Check whether now you are getting the required bins in rootfs.