linux链接.a库时error adding symbols: file format not recognized

时间:2025-03-15 20:00:22
linux链接.a库时error adding symbols: file format not recognized

乐犬: 是这样的,这里报ld链接.a库错:error addingg symbols file的错误,就可以使用readelf工具去查看目标.a文件,然后就会发现工程中的.a文件编译出来是x86类型而非arm类型,与工程中其他文件不一致,故链接失败。这个时候的解决方法就是将有问题的.a文件重新使用源码以arm的架构生成新的.a文件,然后再去链接整个工程 [code=plain] 文件:() ELF 头: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 类别: ELF32 数据: 2 补码,小端序 (little endian) 版本: 1 (current) OS/ABI: UNIX - System V ABI 版本: 0 类型: REL (可重定位文件) 系统架构: ARM 版本: 0x1 入口点地址: 0x0 程序头起点: 0 (bytes into file) Start of section headers: 18168 (bytes into file) 标志: 0x5000000, Version5 EABI 本头的大小: 52 (字节) 程序头大小: 0 (字节) Number of program headers: 0 节头大小: 40 (字节) 节头数量: 24 字符串表索引节头: 23 [/code]