错误:在ubuntu下编译简单的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/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
/home/mypc/pjproject-1.4.5/pjnath/build'make [1]: * [pjnath]错误2 make [1]:离开目录`/home/mypc/pjproject-1.4.5/pjnath/build'make:* [all]错误1
-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
当我试图找到-werror make文件出现在/home/mypc/pjproject-1.4.5/pjnath/build
, $(PJDIR)/build.mak
和$(PJDIR)/build/common.mak
它不存在有人知道它可能在哪里?
似乎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-files粘贴到某处?
源代码行将是首选。
上一篇: Error: Compiling simple PjSIP program under ubuntu
下一篇: C# Batch plot application (PrintServer & PrintQueue issues)