Search code examples
c++gccmakefileyoctoopenembedded

.h: No such file or directory YOCTO/Openembedded


I am trying to compile a simple PJSIP program with Yocto/Openembedded. And I have this error :
fatal error: pjsua-lib/pjsua.h: No such file or directory
Here is my Makefile:

all: simple_pjsua

simple_pjsua: simple_pjsua.c
    $(CC) -o $@ $< `pkg-config --cflags --libs libpjproject`

clean:
    rm -f simple_pjsua.o simple_pjsua

And here is my simplepjsua_2.6.bb:

DESCRIPTION = "Open source SIP stack and media stack for presence, im/instant \
               messaging, and multimedia communication"
SECTION = "libs"
HOMEPAGE = "http://www.pjsip.org/"
# there are various 3rd party sources which may or may not be part of the
# build, there license term vary or are not explicitely specified.
LICENSE = "CLOSED"

PR = "r0"

SRC_URI = "file://simple_pjsua.c \
           file://Makefile \
           file://README.txt"

S = "${WORKDIR}/"

do_compile() {
    cd ${S}
    #to prevent libpjproject.PC not found error
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    oe_runmake
}

do_install() {
        install -m 0755 -d ${D}${bindir} ${D}${docdir}/simple_pjsua
        install -m 0755 ${S}/simple_pjsua ${D}${bindir}
        install -m 0755 ${WORKDIR}/README.txt ${D}${docdir}/simple_pjsua
}

I tried adding INC=-I/usr/include/pjsua-lib/ in the Makefile but nothing changed.. And if I want to compile it on my computer with make it's working.

What can I do?

EDIT :
I tried adding export LD_LIBRARY_PATH=/usr/include in do_compile() in the bb file. Same issue


Solution

  • You're linking against host libraries which really isn't the right thing to do unless you're building a native package (which you are not).

    You need to make a recipe for pjsip to build and install that, and then this recipe should DEPEND on that.