c - Not able to link Mersenne twister inside Freeswitch module -
i trying add mersenne twister random library inside freeswitch module when try compile , link get:
making mod_svbilling compiling /usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/mod_svbilling.c... compiling /usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/mod_svbilling.c ... creating mod_svbilling.so... mtwist.o: in function `mts_lrand': mtwist.c:(.text+0x0): multiple definition of `mts_lrand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:417: first defined here mtwist.o: in function `mts_llrand': mtwist.c:(.text+0x6d): multiple definition of `mts_llrand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:446: first defined here mtwist.o: in function `mts_drand': mtwist.c:(.text+0x189): multiple definition of `mts_drand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:488: first defined here mtwist.o: in function `mts_ldrand': mtwist.c:(.text+0x210): multiple definition of `mts_ldrand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:507: first defined here mtwist.o: in function `mt_lrand': mtwist.c:(.text+0x349): multiple definition of `mt_lrand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:555: first defined here mtwist.o: in function `mt_llrand': mtwist.c:(.text+0x3d7): multiple definition of `mt_llrand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:575: first defined here mtwist.o: in function `mt_drand': mtwist.c:(.text+0x55c): multiple definition of `mt_drand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:618: first defined here mtwist.o: in function `mt_ldrand': mtwist.c:(.text+0x604): multiple definition of `mt_ldrand' .libs/mod_svbilling.o:/usr/src/freeswitch-1.2.12/src/mod/applications/mod_svbilling/./mtwist/mtwist.h:636: first defined here collect2: ld returned 1 exit status gcc -i. -i./svblic -i./mtwist -fpic -dversion= -dsvn_rev=108m -i/usr/src/freeswitch-1.2.12/libs/curl/include -i/usr/src/freeswitch-1.2.12/src/include -i/usr/src/freeswitch-1.2.12/src/include -i/usr/src/freeswitch-1.2.12/libs/libteletone/src -i/usr/src/freeswitch-1.2.12/libs/stfu -fpic -werror -fvisibility=hidden -dswitch_api_visibility=1 -dhave_visibility=1 -g -ggdb -dhave_openssl -g -o2 -wall -std=c99 -pedantic -wdeclaration-after-statement -d_gnu_source -shared -o .libs/mod_svbilling.so -shared -wl,-x .libs/mod_svbilling.o aes.o lic.o md5.o sysinfo.o mtwist.o -lsqlite3 -lm /usr/src/freeswitch-1.2.12/.libs/libfreeswitch.so -l/usr/src/freeswitch-1.2.12/libs/apr-util/xml/expat/lib -lpq /usr/src/freeswitch-1.2.12/libs/apr-util/xml/expat/lib/.libs/libexpat.a /usr/src/freeswitch-1.2.12/libs/apr/.libs/libapr-1.a -lpthread -l/usr/src/freeswitch-1.2.12/libs/srtp -lcrypt -lrt -lssl -lcrypto -ldl -lz -lncurses -ljpeg -lodbc -wl,--rpath -wl,/usr/local/freeswitch/lib -wl,--rpath -wl,/usr/local/freeswitch/mod make[4]: *** [mod_svbilling.so] error 1 make[3]: *** [all] error 1 make[2]: *** [mod_svbilling-all] error 1 make[1]: *** [mod_svbilling] error 2 make: *** [mod_svbilling] error 2
makefile using looks like:
base=../../../.. svn_rev=$(shell svnversion -n .) svb_lib_flags = -lm -lpthread -lsqlite3 svb_cflags = -i. -i./svblic -i./mtwist -fpic mod_cflags=$(svb_lib_flags) $(svb_cflags) -dversion=$(version) -dsvn_rev=$(svn_rev) local_objs=aes.o lic.o md5.o sysinfo.o mtwist.o local_depend: $(local_objs) sysinfo.o: ./svblic/sysinfo.c gcc $(svb_cflags) -c ./svblic/sysinfo.c aes.o: ./svblic/aes.c gcc $(svb_cflags) -c ./svblic/aes.c md5.o: ./svblic/md5.c gcc $(svb_cflags) -c ./svblic/md5.c lic.o: ./svblic/lic.c gcc $(svb_cflags) -c ./svblic/lic.c mtwist.o: ./mtwist/mtwist.c gcc $(svb_cflags) -c ./mtwist/mtwist.c include $(base)/build/modmake.rules
i added following header module source code:
#include "./mtwist/mtwist.h"
i don't know why sais functions defined. mtwist.h has 1 define in order avoid redefine functions
any idea?
regards
Comments
Post a Comment