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

时间:2009-10-24 13:12:47

标签: c++ linux sip pjsip

我正在尝试在ubuntu下编译简单的PjSIP程序。我收到错误

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

这是什么意思?

这是输出: -

  

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

这是代码

#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;
}

这是一个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

由于

编辑:

我刚注意到构建PjSIP

时出错
  

make [2]:输入目录   /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
/家/ MYPC / pjproject-1.4.5 / pjnath /构建”   make [1]: * [pjnath]错误2 make [1]:   离开目录   `/home/mypc/pjproject-1.4.5/pjnath/build”   make:* [all]错误1

当我试图在/home/mypc/pjproject-1.4.5/pjnath/build$(PJDIR)/build.mak$(PJDIR)/build/common.mak中出现make文件时出现-Werror时,没有人知道它可能在哪里?

1 个答案:

答案 0 :(得分:3)

似乎pj *无法构建必要的库 - 要进行简单的修复,请尝试在/home/mypc/pjproject-1.4.5/build.mak中找到-Werror添加到$(APP_CFLAGS)并删除它的行( -Werror,如果添加了其他标志,则不是整行:)。

或者在src/pjnath/stun_session.c的第230行应用gcc建议的修复。

修改
请注意,您没有找到-Werror。你能粘贴stun_session.c的230行还是make文件?
源行是首选。