srs4.0 在ubuntu21 上configure编译错误

在Ubuntu10.3.0环境下,使用GCC10.3.0编译libsrtp-2-fit和openssl-1.1-fit时遇到重复定义错误。解决方案是在datatypes.c文件中将全局变量`bit_string`声明为`static`,以避免多个目标文件中重复定义的问题。经过修改,两个库的编译均成功通过。
摘要由CSDN通过智能技术生成

GCC版本:

gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1)

1、编译libsrtp-2-fit的错误:

gcc -DHAVE_CONFIG_H -Icrypto/include -I./include -I./crypto/include  -fPIC -Wall -pedantic -Wstrict-prototypes -O4 -fexpensive-optimizations -funroll-loops -I/home/wbin/work/huawei_rtc/srs-4.0.156/trunk/objs/Platform-Linux-5.11.0-GCC10.3.0-SRS4-x86_64/openssl-1.1-fit/_release/include -I./test -L.  -o crypto/test/datatypes_driver crypto/test/datatypes_driver.c test/util.c libsrtp2.a -L/home/work/srs-4.0.156/trunk/objs/Platform-Linux-5.11.0-GCC10.3.0-SRS4-x86_64/openssl-1.1-fit/_release/lib -lcrypto -ldl  -lsrtp2
/usr/bin/ld: libsrtp2.a(datatypes.o):(.bss+0x0): multiple definition of `bit_string'; /tmp/ccbkWd0W.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:215: crypto/test/datatypes_driver] Error 1

解决办法:修改文件./objs/Platform-Linux-5.11.0-GCC10.3.0-SRS4-x86_64/libsrtp-2-fit/crypto/math/datatypes.c  中 char bit_string[MAX_PRINT_STRING_LEN]; 加上static

编译通过

2、编译openssl-1.1-fit错误:

gcc -DHAVE_CONFIG_H -Icrypto/include -I./include -I./crypto/include  -fPIC -Wall -pedantic -Wstrict-prototypes -O4 -fexpensive-optimizations -funroll-loops -I/home/work/srs-4.0.156/trunk/objs/Platform-Linux-5.11.0-GCC10.3.0-SRS4-x86_64/openssl-1.1-fit/_release/include -I./test -L.  -o crypto/test/datatypes_driver crypto/test/datatypes_driver.c test/util.c libsrtp2.a -L/home/work/srs-4.0.156/trunk/objs/Platform-Linux-5.11.0-GCC10.3.0-SRS4-x86_64/openssl-1.1-fit/_release/lib -lcrypto -ldl  -lsrtp2
/usr/bin/ld: libsrtp2.a(datatypes.o):(.bss+0x0): multiple definition of `bit_string'; /tmp/ccdbuJWe.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:215: crypto/tes

解决办法:修改文件vim ./3rdparty/libsrtp-2-fit/crypto/math/datatypes.c char bit_string[MAX_PRINT_STRING_LEN]; 加上static

configure通过!


 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值