Error: Compiling simple PjSIP program under ubuntu

I am trying to compile simple PjSIP program under ubuntu. I am getting error as

/usr/bin/ld: cannot find -lpjsua-i686-pc-linux-gnu

What does it mean?

Here is the ouput:-

root@mypc-desktop:/home/mypc/pjsip# make

gcc -o myapp myapp.cpp -DPJ_AUTOCONF=1 -O2 -I/home/mypc/pjproject-1.4.5/pjlib/include -I/home/mypc/pjproject-1.4.5/pjlib-util/include -I/home/mypc/pjproject-1.4.5/pjnath/include -I/home/mypc/pjproject-1.4.5/pjmedia/include -I/home/mypc/pjproject-1.4.5/pjsip/include -L/home/mypc/pjproject-1.4.5/pjlib/lib -L/home/mypc/pjproject-1.4.5/pjlib-util/lib -L/home/mypc/pjproject-1.4.5/pjnath/lib -L/home/mypc/pjproject-1.4.5/pjmedia/lib -L/home/mypc/pjproject-1.4.5/pjsip/lib -L/home/mypc/pjproject-1.4.5/third_party/lib -lpjsua-i686-pc-linux-gnu -lpjsip-ua-i686-pc-linux-gnu -lpjsip-simple-i686-pc-linux-gnu -lpjsip-i686-pc-linux-gnu -lpjmedia-codec-i686-pc-linux-gnu -lpjmedia-i686-pc-linux-gnu -lpjmedia-audiodev-i686-pc-linux-gnu -lpjnath-i686-pc-linux-gnu -lpjlib-util-i686-pc-linux-gnu -lresample-i686-pc-linux-gnu -lmilenage-i686-pc-linux-gnu -lsrtp-i686-pc-linux-gnu -lgsmcodec-i686-pc-linux-gnu -lspeex-i686-pc-linux-gnu -lilbccodec-i686-pc-linux-gnu -lg7221codec-i686-pc-linux-gnu -lportaudio-i686-pc-linux-gnu -lpj-i686-pc-linux-gnu -lm -lnsl -lrt -lpthread

/usr/bin/ld: cannot find -lpjsua-i686-pc-linux-gnu collect2: ld returned 1 exit status make: *** [myapp] Error 1

Here is code

#include <pjlib.h>
#include <pjlib-util.h>
#include <pjmedia.h>
#include <pjmedia-codec.h>
#include <pjsip.h>
#include <pjsip_simple.h>
#include <pjsip_ua.h>
#include <pjsua-lib/pjsua.h>

int main()
{
        return 0;
}

Here is a Makefile

#Modify this to point to the PJSIP location.
PJBASE=/home/mypc/pjproject-1.4.5

include $(PJBASE)/build.mak

CC      = $(APP_CC)
LDFLAGS = $(APP_LDFLAGS)
LDLIBS  = $(APP_LDLIBS)
CFLAGS  = $(APP_CFLAGS)
CPPFLAGS= ${CFLAGS}

# If your application is in a file named myapp.cpp or myapp.c
# this is the line you will need to build the binary.
all: myapp

myapp: myapp.cpp
        $(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)

clean:
        rm -f myapp.o myapp

Thanks

EDIT:

I just noticed that there is a error building PjSIP

make[2]: Entering directory /home/mypc/pjproject-1.4.5/pjnath/build' gcc -c -Wall -DPJ_AUTOCONF=1 -O2
-Wno-unused-label -Werror -I../include -I../../pjlib/include -I../../pjlib-util/include -o output/pjnath-i686-pc-linux-gnu/stun_session.o ../src/pjnath/stun_session.c cc1: warnings being treated as errors ../src/pjnath/stun_session.c: In function 'apply_msg_options': ../src/pjnath/stun_session.c:230: error: suggest parentheses around && within || make[2]: *** [output/pjnath-i686-pc-linux-gnu/stun_session.o] Error 1 make[2]: Leaving directory
/home/mypc/pjproject-1.4.5/pjnath/build' gcc -c -Wall -DPJ_AUTOCONF=1 -O2
-Wno-unused-label -Werror -I../include -I../../pjlib/include -I../../pjlib-util/include -o output/pjnath-i686-pc-linux-gnu/stun_session.o ../src/pjnath/stun_session.c cc1: warnings being treated as errors ../src/pjnath/stun_session.c: In function 'apply_msg_options': ../src/pjnath/stun_session.c:230: error: suggest parentheses around && within || make[2]: *** [output/pjnath-i686-pc-linux-gnu/stun_session.o] Error 1 make[2]: Leaving directory
/home/mypc/pjproject-1.4.5/pjnath/build' gcc -c -Wall -DPJ_AUTOCONF=1 -O2
-Wno-unused-label -Werror -I../include -I../../pjlib/include -I../../pjlib-util/include -o output/pjnath-i686-pc-linux-gnu/stun_session.o ../src/pjnath/stun_session.c cc1: warnings being treated as errors ../src/pjnath/stun_session.c: In function 'apply_msg_options': ../src/pjnath/stun_session.c:230: error: suggest parentheses around && within || make[2]: *** [output/pjnath-i686-pc-linux-gnu/stun_session.o] Error 1 make[2]: Leaving directory
/home/mypc/pjproject-1.4.5/pjnath/build' make[1]: * [pjnath] Error 2 make[1]: Leaving directory `/home/mypc/pjproject-1.4.5/pjnath/build' make: * [all] Error 1

When I tried to find -Werror in make files present at /home/mypc/pjproject-1.4.5/pjnath/build , $(PJDIR)/build.mak and $(PJDIR)/build/common.mak its not present there anybody know where it could be ?


It seems that the pj* can't build the neccessary libaries - for a simple fix try to locate the line in /home/mypc/pjproject-1.4.5/build.mak where -Werror is added to $(APP_CFLAGS) and remove it (the -Werror , not the whole line if other flags are added :).

Alternatively apply the fix suggested by gcc on line 230 in src/pjnath/stun_session.c .

edit:
Just read that you found no -Werror . Could you either paste line 230 of stun_session.c or the make-files somewhere?
The source line would be preferred.

链接地址: http://www.djcxy.com/p/87936.html

上一篇: 模拟器无法在ios 7中设置

下一篇: 错误:在ubuntu下编译简单的PjSIP程序