0

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

Tagadac
  • 393
  • 1
  • 4
  • 20

2 Answers2

2

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.

Ross Burton
  • 3,516
  • 13
  • 12
  • Thank you ! You'r my man ! I already had a PJSIP layer, I just added `DEPENDS = "pjproject"` and now my program works on my board. Thank you again ! – Tagadac Apr 13 '17 at 13:49
0

make sure that /usr/include/pjsua-lib/pjsua.h file exist.

# INC=-I/usr/include/pjsua-lib # not ok
INC=-I/usr/include
sailfish009
  • 2,561
  • 1
  • 24
  • 31
  • Thank you for your help. Same error and : `/usr$ find -iname "pjsua.h" ./local/include/pjsua-lib/pjsua.h ./local/include/pjsua.h ./include/pjsua-lib/pjsua.h ./include/pjsua.h` – Tagadac Apr 13 '17 at 11:28
  • you have to include path to your bb or else where, not makefile. http://elinux.org/Bitbake_Cheat_Sheet – sailfish009 Apr 13 '17 at 11:31
  • I tried adding `export LD_LIBRARY_PATH=/usr/include` in do_compile() in the bb file. Same issue – Tagadac Apr 13 '17 at 12:59
  • The problem here is that you're not tying back to the "native" sysroot with any of this. You're reaching out of the cross-compile sandbox that OE uses to build with and grabbing it from the HOST. (Bad, bad, bad...) You need to patch the makefile to properly refer back to the path to the Python you're needing in the *NATIVE* sysroot. – Svartalf May 03 '18 at 17:19
  • As for what that entails, I'm...unsure...since I'm not futzing with it myself. I just had to make a custom kernel build recipe do the right things as it is. – Svartalf May 03 '18 at 17:20