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