嵌入式技术论坛
直播中

张龙祥

8年用户 1161经验值
擅长:连接器
私信 关注
[问答]

RTT移植Jrtplib库能编译通过但是C++链接出错咋办?

在一个VOIP的项目中需要用的RTP库,开始选择ortp和mediastream库,现基本能实现一对一通话,但是otrp库没有实现RTP协议中多个参与者的情况,不满足项目需求。看了下现在网上用的很多的Jrtplib,只能支持多个参与者的情况,因此不得已移植Jrtplib到RTT上,但是Jrtplib 是C++编写的rtp库,库中使用了C++标准库,编译完后链接出现很大的问题,网上查了资料说没有连接libstdc++ libsupc++库,但是加上以后还是没有解决,主要错误提示有:

``In functionstd::list >::_M_insert(std::_List_iterator, jrtplib::RTCPPacket const&)’:
undefined reference to `std::detail:_List_node_base:_M_hook(std::detail::_List_node_base)’
In function __gnu_cxx::new_allocatorstd::_List_node >::allocate(unsigned int, void const*)': undefined reference tostd::__throw_bad_alloc()’

undefined reference to std::allocator::allocator()' undefined reference tostd::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)’
undefined reference to std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&)' undefined reference tostd::basic_string, std::allocator >::~basic_string()’
undefined reference to `std::allocator::~allocator()’

undefined reference to stdstringfind(char, unsigned int) const' undefined reference tostd:string:length() const’
undefined reference to `std::string::c_str() const’```

编译选项是:

DEVICE = '  -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp  -ffunction-sections -fdata-sections'
CFLAGS = DEVICE + ' -g -Wall -DSTM32F407ZG -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -D__ASSEMBLY__  -D__FPU_USED'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE+ ' -lc -lm -lstdc++ -lsupc++ -nostartfiles -Wl,-v,--gc-sections,-Map=rtthread-stm32.map,-cref,-u,Reset_Handler -T stm32_rom.ld'
CXXFLAGS=  CFLAGS + ' -fno-exceptions fno-rtti '

各位走过路过的大神们,帮小弟看下是什么原因,谢谢!!!

回帖(2)

goodmbby

2023-2-23 13:55:10
看下来是stdc++库的问题,你是直接在stm32f407上跑voip,407资源够吗?
举报

张龙祥

2023-2-23 13:55:44
难道这个newlib的stdc++本身有问题?我怀疑是链接脚本里没有加什么段,导致没有链接进代码中,但是在ld的手册上并没有找到相关的说明,贴出我的链接脚本供各位大神分析:
.text :
{
. = ALIGN(4);
_stext = .;
KEEP((.isr_vector)) / Startup code /
. = ALIGN(4); (.text) / remaining code /
(.text.) / remaining code /
(.rodata) / read-only data (constants) / (.rodata) (.glue_7)
(.glue_7t) (.gnu.linkonce.t*)

    *(.ARM.extab* .gnu.linkonce.armextab.*)
    *(.gcc_except_table)
    /* section information for module symbol */
    . = ALIGN(4);
    __rtmsymtab_start = .;
    KEEP(*(RTMSymTab))
    __rtmsymtab_end = .;
    /* section information for finsh shell */
    . = ALIGN(4);
    __fsymtab_start = .;
    KEEP(*(FSymTab))
    __fsymtab_end = .;
    . = ALIGN(4);
    __vsymtab_start = .;
    KEEP(*(VSymTab))
    __vsymtab_end = .;
    . = ALIGN(4);
    /* section information for initial. */
    . = ALIGN(4);
    __rt_init_start = .;
    KEEP(*(SORT(.rti_fn*)))
    __rt_init_end = .;
    . = ALIGN(4);
    PROVIDE(__ctors_start__ = .);
    /* old GCC version uses .ctors */
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
    PROVIDE(__ctors_end__ = .);
    . = ALIGN(4);
    /* .data section which is used for initialized data */
    PROVIDE(__dtors_start__ = .);
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
    PROVIDE(__dtors_end__ = .);
  . = ALIGN(4);
    _etext = .;
} > FLASH = 0
关于407做voip资源的问题,现在实现的一对一通话407资源够用(必须用上ccm内存),用speex编解码也没有问题,很流畅。考虑我们这个项目需要多方通话,407的ram就不够用了,因此用了外部的sram。用外部sram后speex编解码就不行了,延迟越来越大,看来内部ram和外部ram对浮点运算性能的影响还是很大的,改用pcma编码就没问题,毕竟只是在局域网内通话,网络带宽不是问题。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分