无法在Freeswitch模块内链接Mersenne twister

时间:2014-03-10 13:19:48

标签: c gcc freeswitch

我正在尝试在Freeswitch模块中添加Mersenne twister随机库,但是当我尝试编译和链接时,我得到:

making all 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看起来像:

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

我只在标题源代码中添加了以下标题:

#include "./mtwist/mtwist.h"

我不知道为什么这些功能已经定义了。 mtwist.h有一个定义,以避免重新定义这些函数

有什么想法吗?

此致

0 个答案:

没有答案