[SR-Users] C++ module

Daniel-Constantin Mierla miconda at gmail.com
Thu Jan 12 11:32:37 CET 2017


Hello,

do you have your own rpm specs, or do you use an updated version (to add
your mode) of some spec in kamailio repository?

Cheers,
Daniel


On 11/01/2017 16:24, Patrick wrote:
> Hi Daniel, Thanks for the help
>
> Sort of. 
> The internal library seems to be compiled and linked each my module is
> compiled - this happens 2x, for %build and for %install of the RPM
> This doesn't seem to be a problem when the %build stage is executed:
>
>
> Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.EOkbPI
> ...
> + make all quiet=verbose 'skip_modules=mysql jabber cpl-c avp_radius
> auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc
> dbtext' cfg-target=//etc/kamailio/ 
> ...
> gcc -fPIC -DPIC -g -funroll-loops -Wcast-align -m64
> -minline-all-stringops -falign-loops -ftree-vectorize
> -fno-strict-overflow -mtune=opteron -Wall    -DNAME='"kamailio"'
> -DVERSION='"4.2.4"' -DARCH='"x86_64"' -DOS='linux_'
> -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.4.7"' -D__CPU_x86_64
> -D__OS_linux -DSER_VER=4002004 -DCFG_DIR='"/usr/local/etc/kamailio/"'
> -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP
> -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER
> -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DF_MALLOC -DDBG_F_MALLOC
> -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS
> -DMALLOC_STATS -DWITH_AS_SUPPORT -DFAST_LOCK -DADAPTIVE_WAIT
> -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2
> -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL
> -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM
> -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT
> -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT
>  -DKAMAILIO_MOD_INTERFACE -DRTC_COMMON_TRACE -DMOD_NAME='"db_arl"' -c
> db_arl_mod.c -o db_arl_mod.o -MMD -MP
> Makefile.defs defs skipped
> make[2]: `libsrdb2.so.1.0' is up to date.
> Makefile.defs defs skipped
> make[2]: `libsrdb1.so.1.0' is up to date.
> Makefile.defs defs skipped
> make[2]: `librtctrace.so.1.0' is up to date.
> COL_LOCAL_BUILDS_ROOT=/home/pshea/_localbuilds/
> Compiling db_arl_base.cpp
> g++ -fPIC -DPIC -g -funroll-loops -Wcast-align -m64
> -minline-all-stringops -falign-loops -ftree-vectorize
> -fno-strict-overflow -mtune=opteron -Wall -Wno-write-strings
> -Wno-deprecated -Wno-unused-function -Wno-sign-compare
> -Wno-strict-aliasing  -I
> /home/pshea/_localbuilds//ExternalLibs/boost/V1.60.0_27/ -I
> ./jsoncpp-dist/ -fPIC -DPIC -g -funroll-loops -Wcast-align -m64
> -minline-all-stringops -falign-loops -ftree-vectorize
> -fno-strict-overflow -mtune=opteron -Wall  -DNAME='"kamailio"'
> -DVERSION='"4.2.4"' -DARCH='"x86_64"' -DOS='linux_'
> -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.4.7"' -D__CPU_x86_64
> -D__OS_linux -DSER_VER=4002004 -DCFG_DIR='"/usr/local/etc/kamailio/"'
> -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP
> -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER
> -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DF_MALLOC -DDBG_F_MALLOC
> -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS
> -DMALLOC_STATS -DWITH_AS_SUPPORT -DFAST_LOCK -DADAPTIVE_WAIT
> -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2
> -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL
> -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM
> -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT
> -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT
>  -DKAMAILIO_MOD_INTERFACE -DRTC_COMMON_TRACE -DMOD_NAME='"db_arl"' -c
> db_arl_base.cpp -o db_arl_base.o
> db_arl_base.cpp: In function 'std::string convert_value(int, const
> db_val_t*)':
> db_arl_base.cpp:789: warning: enumeration value 'DB1_UNKNOWN' not
> handled in switch
> COL_LOCAL_BUILDS_ROOT=/home/pshea/_localbuilds/
> Compiling jsoncpp-dist/jsoncpp.cpp
> g++ -fPIC -DPIC -g -funroll-loops -Wcast-align -m64
> -minline-all-stringops -falign-loops -ftree-vectorize
> -fno-strict-overflow -mtune=opteron -Wall -Wno-write-strings
> -Wno-deprecated -Wno-unused-function -Wno-sign-compare
> -Wno-strict-aliasing  -I
> /home/pshea/_localbuilds//ExternalLibs/boost/V1.60.0_27/ -I
> ./jsoncpp-dist/ -fPIC -DPIC -g -funroll-loops -Wcast-align -m64
> -minline-all-stringops -falign-loops -ftree-vectorize
> -fno-strict-overflow -mtune=opteron -Wall  -DNAME='"kamailio"'
> -DVERSION='"4.2.4"' -DARCH='"x86_64"' -DOS='linux_'
> -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.4.7"' -D__CPU_x86_64
> -D__OS_linux -DSER_VER=4002004 -DCFG_DIR='"/usr/local/etc/kamailio/"'
> -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP
> -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER
> -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DF_MALLOC -DDBG_F_MALLOC
> -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS
> -DMALLOC_STATS -DWITH_AS_SUPPORT -DFAST_LOCK -DADAPTIVE_WAIT
> -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2
> -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL
> -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM
> -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT
> -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT
>  -DKAMAILIO_MOD_INTERFACE -DRTC_COMMON_TRACE -DMOD_NAME='"db_arl"' -c
> jsoncpp-dist/jsoncpp.cpp -o jsoncpp.o
> g++ -shared  -m64 -Wl,-O2 -Wl,-E    db_arl_mod.o  db_arl_base.o
> jsoncpp.o -lcurl -pthread  -L../../lib/srdb2/ -lsrdb2
>  -L../../lib/srdb1/ -lsrdb1 * -L../../lib/rtctrace/ -lrtctrace*
> -Wl,-rpath,/tmp/kamailio/BUILD/kamailio-4.2.4/lib/srdb2
> -Wl,-rpath,/tmp/kamailio/BUILD/kamailio-4.2.4/lib/srdb1
> -Wl,-rpath,/tmp/kamailio/BUILD/kamailio-4.2.4/lib/rtctrace -o db_arl.so
>
>
>
>
> However, during the %install stage - this does seem to cause a problem. 
> There are different options passed to make, in this case, and I am
> trying to figure out how this causes a problem.
> In this case, you'll see that the internal library is NOT "up to date"
> so make attempts to *rebuild*it. In the link line, you'll see the
> objects from the LIBS in my custom module.
>
>
> Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.AkEuuP
> ...
> + make install quiet=verbose 'skip_modules=mysql jabber cpl-c
> avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops
> unixodbc dbtext'
> *basedir=/tmp/kamailio/BUILDROOT/kamailio-4.2.4-0.x86_64 prefix=/usr
> cfg-prefix=/tmp/kamailio/BUILDROOT/kamailio-4.2.4-0.x86_64*cfg-target=//etc/kamailio/
> ...
> Makefile.defs defs skipped
> make[2]: `libsrdb2.so.1.0' is up to date.
> Makefile.defs defs skipped
> make[2]: `libsrdb1.so.1.0' is up to date.
> Makefile.defs defs skipped
> Makefile.defs defs skipped
> */opt/rh/devtoolset-4/root/usr/bin/g++ -fPIC -DPIC -g -funroll-loops
> -Wcast-align -m64 -minline-all-stringops -falign-loops
> -ftree-vectorize -fno-strict-overflow -mtune=opteron -Wall  
> -I/home/pshea/_localbuilds//RTC/Common/2.0.0_247//Applications_rhel6_x64_dts4_pic/include
>   -DNAME='"kamailio"' -DVERSION='"4.2.4"' -DARCH='"x86_64"'
> -DOS='linux_' -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.4.7"'
> -D__CPU_x86_64 -D__OS_linux -DSER_VER=4002004
> -DCFG_DIR='"/usr/local/etc/kamailio/"' -DPKG_MALLOC -DSHM_MEM
> -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE
> -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER
> -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DF_MALLOC -DDBG_F_MALLOC
> -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS
> -DMALLOC_STATS -DWITH_AS_SUPPORT -DFAST_LOCK -DADAPTIVE_WAIT
> -DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2
> -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL
> -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM
> -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT
> -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT  -std=c++0x
> -I/home/pshea/_localbuilds//RTC/Common/2.0.0_247//Applications_rhel6_x64_dts4_pic/include
> -c rtctrace.c -o rtctrace.o -MMD -MP*
> *
> *
> */opt/rh/devtoolset-4/root/usr/bin/g++ -shared  -m64 -Wl,-O2 -Wl,-E  
>  -Wl,-soname,librtctrace.so.1 rtctrace.o  db_arl_base.o jsoncpp.o
> -lcurl -pthread
> -L/home/pshea/_localbuilds//RTC/Common/2.0.0_247//Applications_rhel6_x64_dts4_pic/lib
> -lrtccommon
> -L/home/pshea/_localbuilds//ExternalLibs/boost/V1.60.0_22/Server_Linux26_x64_dts4_pic/lib
> -lboost_system -lboost_thread -lpthread   -o librtctrace.so.1.0*
> *g++: error: db_arl_base.o: No such file or directory*
> *g++: error: jsoncpp.o: No such file or directory*
> make[2]: *** [librtctrace.so.1.0] Error 1
> make[1]: *** [../../lib/rtctrace/librtctrace.so] Error 2
> make: *** [install-modules] Error 1
> error: Bad exit status from /var/tmp/rpm-tmp.AkEuuP (%install)
>
>
>
> On Wed, Jan 11, 2017 at 8:36 AM, Daniel-Constantin Mierla
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     Hello,
>
>     to be sure I understand properly the issue: you say that the value
>     of the LIBS from Makefile of the module is inherited when
>     compiling the internal library?
>
>     Cheers,
>     Daniel
>
>
>     On 11/01/2017 04:21, Patrick wrote:
>>     I added a C++ module to kamalio at some point, and now I am
>>     trying to integrate that module with another C++ internal
>>     library, but I'm getting all sorts of headaches when trying to
>>     compile. 
>>
>>     The latest problem is during the "make install" part of the build
>>     - it seems like the objects from the module are "infecting" the
>>     link line of the internal library it's dependent on.
>>
>>     Here is the Makefile for the module. At the time, the only way I
>>     figured to link in the C++ object was adding them to the LIBS.
>>     Now, i think this interferes with the 'make install' dependencies.
>>
>>     Any thoughs on how to do this properly would be great!
>>
>>     Thanks
>>
>>
>>     *_Module Makefile_*
>>
>>     #
>>     # db_cassandra module makefile
>>     #
>>     #
>>     # WARNING: do not run this directly, it should be run by the
>>     master Makefile
>>
>>     include ../../Makefile.defs
>>
>>     CXX=g++
>>     LD=g++
>>     auto_gen=
>>     NAME=db_arl.so
>>
>>     ifeq ($(CROSS_COMPILE),)
>>     CURL_BUILDER=$(shell \
>>     if pkg-config --exists libcurl; then \
>>     echo 'pkg-config libcurl'; \
>>     else \
>>     which curl-config; \
>>     fi)
>>     endif
>>
>>     DEFS+=-DKAMAILIO_MOD_INTERFACE -DRTC_COMMON_TRACE
>>     *LIBS += db_arl_base.o jsoncpp.o*-lcurl -pthread
>>
>>     CXXFLAGS=$(CFLAGS:-Wno-deprecated option=)
>>     CXXFLAGS+= -Wno-write-strings -Wno-deprecated
>>     -Wno-unused-function -Wno-sign-compare -Wno-strict-aliasing 
>>     CXXFLAGS+= -I ${COL_LOCAL_BUILDS_ROOT}/ExternalLibs/boost/V1.60.0_27/
>>     CXXFLAGS+= -I ./jsoncpp-dist/
>>
>>     SERLIBPATH=../../lib
>>     SER_LIBS+=$(SERLIBPATH)/srdb2/srdb2
>>     SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
>>     *SER_LIBS+=$(SERLIBPATH)/rtctrace/rtctrace*
>>
>>     include ../../Makefile.modules
>>
>>     jsoncpp.o: jsoncpp-dist/jsoncpp.cpp
>>     @echo COL_LOCAL_BUILDS_ROOT=${COL_LOCAL_BUILDS_ROOT}
>>     @echo "Compiling $<"
>>     $(CXX) $(CXXFLAGS) $(CFLAGS) $(C_DEFS) $(DEFS) -c $< -o $@
>>
>>     db_arl_base.o: db_arl_base.cpp db_arl_base.h
>>     @echo COL_LOCAL_BUILDS_ROOT=${COL_LOCAL_BUILDS_ROOT}
>>     @echo "Compiling $<"
>>     $(CXX) $(CXXFLAGS) $(CFLAGS) $(C_DEFS) $(DEFS) -c $< -o $@
>>
>>     db_arl.so: db_arl_base.o jsoncpp.o
>>
>>
>>     During 'make install' the objects in *red*have no business in the
>>     link line for the internal library
>>     /opt/rh/devtoolset-4/root/usr/bin/g++ -fPIC -DPIC -g
>>     -funroll-loops -Wcast-align -m64 -minline-all-stringops
>>     -falign-loops -ftree-vectorize -fno-strict-overflow
>>     -mtune=opteron -Wall  
>>     -I/home/pshea/_localbuilds/RTC/Common/2.0.0_247//Applications_rhel6_x64_dts4_pic/include
>>       -DNAME='"kamailio"' -DVERSION='"4.2.4"' -DARCH='"x86_64"'
>>     -DOS='linux_' -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.4.7"'
>>     -D__CPU_x86_64 -D__OS_linux -DSER_VER=4002004
>>     -DCFG_DIR='"/usr/local/etc/kamailio/"' -DPKG_MALLOC -DSHM_MEM
>>     -DSHM_MMAP -DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE
>>     -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER
>>     -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP -DF_MALLOC
>>     -DDBG_F_MALLOC -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS
>>     -DUSE_CORE_STATS -DSTATISTICS -DMALLOC_STATS -DWITH_AS_SUPPORT
>>     -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024
>>     -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN
>>     -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL
>>     -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
>>     -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT
>>     -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT  -std=c++0x
>>     -I/home/pshea/_localbuilds/RTC/Common/2.0.0_247//Applications_rhel6_x64_dts4_pic/include
>>     -c rtctrace.c -o rtctrace.o -MMD -MP
>>     /opt/rh/devtoolset-4/root/usr/bin/g++ -shared  -m64 -Wl,-O2
>>     -Wl,-E    -Wl,-soname,librtctrace.so.1 rtctrace.o * db_arl_base.o
>>     jsoncpp.o*-lcurl -pthread
>>     -L/home/pshea/_localbuilds/RTC/Common/2.0.0_247//Applications_rhel6_x64_dts4_pic/lib
>>     -lrtccommon
>>     -L/home/pshea/_localbuilds/ExternalLibs/boost/V1.60.0_22/Server_Linux26_x64_dts4_pic/lib
>>     -lboost_system -lboost_thread -lpthread   -o librtctrace.so.1.0
>>     *g++: error: db_arl_base.o: No such file or directory*
>>     *g++: error: jsoncpp.o: No such file or directory*
>>
>>
>>
>>     _______________________________________________
>>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>     sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>
>>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>     <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>
>     -- 
>     Daniel-Constantin Mierla
>     www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>     Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com <http://www.kamailioworld.com>
>
>     _______________________________________________ SIP Express Router
>     (SER) and Kamailio (OpenSER) - sr-users mailing list
>     sr-users at lists.sip-router.org
>     <mailto:sr-users at lists.sip-router.org>
>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>     <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users> 
>
-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20170112/924cac71/attachment.html>


More information about the sr-users mailing list