GCC fail
Shamun toha md <shamun.toha <at> gmail.com>
2010-08-01 11:51:31 GMT
Dear sir,
Thank you, for your feedback. Still its not working. You mention to use -L and -l, can you be kindly more specific, the whole PJSIP is complicated like rocket science, i am trying this for more then 7 days just to compile 10 lines of code and see the "Hello world".
14 line 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(int argc, char *argv[]) {
pj_status_t status;
status = pjsua_create();
return 0;
}
Tried so far, but not yet working:
=========================
[root <at> example mysip]# gcc -L/usr/local/lib/ myapp.c -lpjsua
/usr/bin/ld: cannot find -lpjsua
collect2: ld returned 1 exit status
[root <at> example mysip]#
OR
[root <at> example mysip]# gcc -Wall myapp.c
/tmp/ccqFqozz.o: In function `main':
myapp.c:(.text+0xa): undefined reference to `pjsua_create'
collect2: ld returned 1 exit status
[root <at> example mysip]#
Question 1:
=========
What did you mean by -L ? The libraries folder path like following .a extention files? or the trunk file i downloaded using svn checkout?
[root <at> example mysip]# ls /usr/local/lib/libpj*
/usr/local/lib/libpj-i686-pc-linux-gnu.a /usr/local/lib/libpjmedia-codec-i686-pc-linux-gnu.a /usr/local/lib/libpjsip-i686-pc-linux-gnu.a /usr/local/lib/libpjsua-i686-pc-linux-gnu.a
/usr/local/lib/libpjlib-util-i686-pc-linux-gnu.a /usr/local/lib/libpjmedia-i686-pc-linux-gnu.a /usr/local/lib/libpjsip-simple-i686-pc-linux-gnu.a
/usr/local/lib/libpjmedia-audiodev-i686-pc-linux-gnu.a /usr/local/lib/libpjnath-i686-pc-linux-gnu.a /usr/local/lib/libpjsip-ua-i686-pc-linux-gnu.a
[root <at> example mysip]#
Question 2
=========
What did you mean by -lpjsua ? Did you mean to use pjsua replace it by APP_LDLIBS ? after downloading the trunk file, there is a build.mak file example as following:
export MACHINE_NAME := auto
export OS_NAME := auto
export HOST_NAME := unix
export CC_NAME := gcc
export TARGET_NAME := i686-pc-linux-gnu
export CROSS_COMPILE :=
export LINUX_POLL := select
export ac_prefix := /usr/local
LIB_SUFFIX = $(TARGET_NAME).a
export APP_LDLIBS := -lpjsua-$(TARGET_NAME)\
-lpjsip-ua-$(TARGET_NAME)\
-lpjsip-simple-$(TARGET_NAME)\
-lpjsip-$(TARGET_NAME)\
-lpjmedia-codec-$(TARGET_NAME)\
-lpjmedia-$(TARGET_NAME)\
-lpjmedia-audiodev-$(TARGET_NAME)\
-lpjnath-$(TARGET_NAME)\
-lpjlib-util-$(TARGET_NAME)\
$(APP_THIRD_PARTY_LIBS)\
$(APP_THIRD_PARTY_EXT)\
-lpj-$(TARGET_NAME)\
-lm -lnsl -lrt -lpthread
Looking forward... :o(
Thank you
Best regards
Shamun
<div><p>Dear sir,<br><br>Thank you, for your feedback. Still its not working. You mention to use -L and -l, can you be kindly more specific, the whole PJSIP is complicated like rocket science, i am trying this for more then 7 days just to compile 10 lines of code and see the "Hello world".<br><br>14 line code:<br>==========<br>#include <pjlib.h><br>#include <pjlib-util.h><br>#include <pjmedia.h><br>#include <pjmedia-codec.h><br>#include <pjsip.h><br>#include <pjsip_simple.h><br>
#include <pjsip_ua.h><br>#include <pjsua-lib/pjsua.h><br><br>int main(int argc, char *argv[]) {<br> pj_status_t status;<br> status = pjsua_create();<br> return 0;<br>}<br><br><br>Tried so far, but not yet working:<br>
=========================<br>[root <at> example mysip]# gcc -L/usr/local/lib/ myapp.c -lpjsua<br>
/usr/bin/ld: cannot find -lpjsua<br>
collect2: ld returned 1 exit status<br>
[root <at> example mysip]# <br><br>OR <br><br>[root <at> example mysip]# gcc -Wall myapp.c<br>/tmp/ccqFqozz.o: In function `main':<br>myapp.c:(.text+0xa): undefined reference to `pjsua_create'<br>collect2: ld returned 1 exit status<br>
[root <at> example mysip]# <br><br><br><br><br>Question 1:<br>=========<br><br>What did you mean by -L ? The libraries folder path like following .a extention files? or the trunk file i downloaded using svn checkout?<br><br>[root <at> example mysip]# ls /usr/local/lib/libpj*<br>
/usr/local/lib/libpj-i686-pc-linux-gnu.a /usr/local/lib/libpjmedia-codec-i686-pc-linux-gnu.a /usr/local/lib/libpjsip-i686-pc-linux-gnu.a /usr/local/lib/libpjsua-i686-pc-linux-gnu.a<br>/usr/local/lib/libpjlib-util-i686-pc-linux-gnu.a /usr/local/lib/libpjmedia-i686-pc-linux-gnu.a /usr/local/lib/libpjsip-simple-i686-pc-linux-gnu.a<br>
/usr/local/lib/libpjmedia-audiodev-i686-pc-linux-gnu.a /usr/local/lib/libpjnath-i686-pc-linux-gnu.a /usr/local/lib/libpjsip-ua-i686-pc-linux-gnu.a<br>[root <at> example mysip]# <br><br><br>Question 2<br>=========<br>What did you mean by -lpjsua ? Did you mean to use pjsua replace it by APP_LDLIBS ? after downloading the trunk file, there is a build.mak file example as following: <br><br>export MACHINE_NAME := auto<br>export OS_NAME := auto<br>export HOST_NAME := unix<br>export CC_NAME := gcc<br>export TARGET_NAME := i686-pc-linux-gnu<br>export CROSS_COMPILE := <br>export LINUX_POLL := select <br><br>
export ac_prefix := /usr/local<br><br>LIB_SUFFIX = $(TARGET_NAME).a<br><br>export APP_LDLIBS := -lpjsua-$(TARGET_NAME)\<br> -lpjsip-ua-$(TARGET_NAME)\<br> -lpjsip-simple-$(TARGET_NAME)\<br> -lpjsip-$(TARGET_NAME)\<br>
-lpjmedia-codec-$(TARGET_NAME)\<br> -lpjmedia-$(TARGET_NAME)\<br> -lpjmedia-audiodev-$(TARGET_NAME)\<br> -lpjnath-$(TARGET_NAME)\<br> -lpjlib-util-$(TARGET_NAME)\<br> $(APP_THIRD_PARTY_LIBS)\<br> $(APP_THIRD_PARTY_EXT)\<br>
-lpj-$(TARGET_NAME)\<br> -lm -lnsl -lrt -lpthread <br><br><br>Looking forward... :o(<br><br><br>Thank you<br>Best regards<br>Shamun<br><br><br><br></p></div>