[bitbake-devel] need help to write a recipe to link a static library to my application

Khem Raj raj.khem at gmail.com
Tue Jul 25 17:40:29 UTC 2017


On Tue, Jul 25, 2017 at 8:46 AM, Viditha Murahari
<viditha at mpconsultants.org> wrote:
> Figured out the issue, it was actually a silly mistake
>
> ${CC} ${CFLAGS} ${LDFLAGS} rttapp.c -o rttapp
> should have been
> ${CC} rttapp.c ${CFLAGS} ${LDFLAGS} -o rttapp
>
good. yes link order is important

> On Mon, Jul 24, 2017 at 10:41 AM, Viditha Murahari
> <viditha at mpconsultants.org> wrote:
>>
>> Hello Khem Raj,
>>
>> I did a bitbake -e -c compile -f rttapp  , and this is how my  do_c0mpile
>> command looks
>>
>> do_compile() {
>>         arm-poky-linux-gnueabi-gcc  -march=armv7ve -mfpu=neon
>> -mfloat-abi=hard -mcpu=cortex-a7
>> --sysroot=/home/jeesu/viditha/imx6ul-evk-audio/build/tmp/sysroots/imx6ulevk
>> -I/home/jeesu/viditha/imx6ul-evk-audio/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/rttapp/1.0-r1/include
>> -DPJ_AUTOCONF=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -O2 -pipe -g
>> -feliminate-unused-debug-types
>> -fdebug-prefix-map=/home/jeesu/viditha/imx6ul-evk-audio/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/rttapp/1.0-r1=/usr/src/debug/rttapp/1.0-r1
>> -fdebug-prefix-map=/home/jeesu/viditha/imx6ul-evk-audio/build/tmp/sysroots/x86_64-linux=
>> -fdebug-prefix-map=/home/jeesu/viditha/imx6ul-evk-audio/build/tmp/sysroots/imx6ulevk=
>> -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
>> -L/home/jeesu/viditha/imx6ul-evk-audio/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/rttapp/1.0-r1/lib
>> -lpjsua2-arm-poky-linux-gnueabi -lstdc++ -lpjsua-arm-poky-linux-gnueabi -lm
>> -lrt -lpthread -lasound rttapp.c -o rttapp
>> }
>>
>> and i tried
>>
>> ls
>> /home/jeesu/viditha/imx6ul-evk-audio/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/rttapp/1.0-r1/lib
>>
>>
>> jeesu at MPCLinux:~/viditha/imx6ul-evk-audio/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/rttapp/1.0-r1/lib$
>> ls
>> libg7221codec-arm-poky-linux-gnueabi.a
>> libgsmcodec-arm-poky-linux-gnueabi.a
>> libilbccodec-arm-poky-linux-gnueabi.a
>> libpj-arm-poky-linux-gnueabi.a
>> libpjlib-util-arm-poky-linux-gnueabi.a
>> libpjmedia-arm-poky-linux-gnueabi.a
>> libpjmedia-audiodev-arm-poky-linux-gnueabi.a
>> libpjmedia-codec-arm-poky-linux-gnueabi.a
>> libpjmedia-videodev-arm-poky-linux-gnueabi.a
>> libpjnath-arm-poky-linux-gnueabi.a
>> libpjsip-arm-poky-linux-gnueabi.a
>> libpjsip-simple-arm-poky-linux-gnueabi.a
>> libpjsip-ua-arm-poky-linux-gnueabi.a
>> libpjsua2-arm-poky-linux-gnueabi.a
>> libpjsua-arm-poky-linux-gnueabi.a
>> libresample-arm-poky-linux-gnueabi.a
>> libspeex-arm-poky-linux-gnueabi.a
>> libsrtp-arm-poky-linux-gnueabi.a
>> pkgconfig
>>
>> It looks like -L in my compile command is pointing to the right location
>> for my libraries. So im not clear what im missing. Please help.
>>
>> On Fri, Jul 21, 2017 at 7:25 PM, Khem Raj <raj.khem at gmail.com> wrote:
>>>
>>>
>>> On Fri, Jul 21, 2017 at 6:43 PM Andre McCurdy <armccurdy at gmail.com>
>>> wrote:
>>>>
>>>> On Fri, Jul 21, 2017 at 12:11 PM, Viditha Murahari
>>>> <viditha at mpconsultants.org> wrote:
>>>> > I'm new to yocto and bitbake and I'm building a voip application for a
>>>> > custom imx6 board. I want to use  pjsip libraries to build my
>>>> > application, I
>>>> > have compiled pjsip in my yocto build and generated pjsip libraries (
>>>> > all
>>>> > pjsip libraries r static). I'm having issues building a recipe for my
>>>> > application that calls the pjsip functions. Below is how my recipe
>>>> > looks
>>>> >
>>>> >
>>>> > Filename: rttapp.bb
>>>> >
>>>> > DESCRIPTION = "Simple voip application"
>>>> > SECTION = "examples"
>>>> > LICENSE = "MIT"
>>>> > LIC_FILES_CHKSUM
>>>> >
>>>> > ="file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
>>>> > PR = "r1"
>>>> >
>>>> > SRC_URI += "file://rttapp.c"
>>>> > SRC_URI += "file://include"
>>>> > SRC_URI += "file://lib"
>>>> >
>>>> > S = "${WORKDIR}"
>>>> >
>>>> > CFLAGS_prepend += "-I${WORKDIR}/include -DPJ_AUTOCONF=1
>>>> > -DPJ_IS_BIG_ENDIAN=0
>>>> > -DPJ_IS_LITTLE_ENDIAN=1"
>>>> > LDFLAGS_append += "-L${WORKDIR}/lib -lpjsua2-arm-poky-linux-gnueabi
>>>> > -lstdc++
>>>> > -lpjsua-arm-poky-linux-gnueabi -lm -lrt -lpthread -lasound"
>>>> >
>>>> > do_compile() {
>>>> > ${CC} ${CFLAGS} ${LDFLAGS} rttapp.c -o rttapp
>>>>
>>>> Try splitting this into two commands. First compile rttapp.c to
>>>> rttapp.o and then link the final application as a second step. When
>>>> linking the application, ensure that rttapp.o is listed on the command
>>>> line before the libraries which provide the symbols it requires.
>>>>
>>>> > }
>>>> >
>>>> >
>>>> > When i do bitbake rttapp, the error i see is as below
>>>> >
>>>> >
>>>> > Log data follows:
>>>> > DEBUG: Executing shell function do_compile
>>>> > /tmp/cc6nn4Dp.o: In function `main':
>>>> > /usr/src/debug/rttapp/1.0-r1/rttapp.c:159: undefined reference to
>>>> > `pjsua_create'
>>>> > collect2: error: ld returned 1 exit status
>>>> > WARNING: exit code 1 from a shell command.
>>>> >
>>>> >
>>>> > Please advise
>>>
>>>
>>> You are not having the said libraries in your workdir ensure that either
>>> you have them via fetcher or via depends
>>>>
>>>>
>>>> >
>>>> > --
>>>> > _______________________________________________
>>>> > bitbake-devel mailing list
>>>> > bitbake-devel at lists.openembedded.org
>>>> > http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>>>> >
>>>> --
>>>> _______________________________________________
>>>> bitbake-devel mailing list
>>>> bitbake-devel at lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>>
>>
>
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>



More information about the bitbake-devel mailing list