0x0
- 交叉编译平台: amd + ubuntu20
- 交叉编译目标平台:LOONGSON 3A4000
- 交叉编译器:7.3.1
在编译时出现如下报错:
mips-linux-gnu-ld -r -Lmips-loongson3a-app-gcc/lib -o octeontx_fpavf.o.o octeontx_fpavf.o.pmd.o octeontx_fpavf.o
mips-linux-gnu-ld: octeontx_fpavf.o.pmd.o: compiled for a little endian system and target is big endian
mips-linux-gnu-ld: octeontx_fpavf.o.pmd.o: endianness incompatible with that of the selected emulation
mips-linux-gnu-ld: failed to merge target specific data of file octeontx_fpavf.o.pmd.o
mips-linux-gnu-ld: octeontx_fpavf.o: compiled for a little endian system and target is big endian
mips-linux-gnu-ld: octeontx_fpavf.o: endianness incompatible with that of the selected emulation
mips-linux-gnu-ld: failed to merge target specific data of file octeontx_fpavf.o
mips-linux-gnu-ld: Attempt to do relocatable link with elf64-tradlittlemips input and elf32-tradbigmips output
mips-linux-gnu-ld: octeontx_fpavf.o: file class ELFCLASS64 incompatible with ELFCLASS32
mips-linux-gnu-ld: final link failed: File in wrong format
解决方法:
添加ld参数:
-EL -m elf64ltsmip
mips-linux-gnu-ld -r -EL -m elf64ltsmip -Lmips-loongson3a-app-gcc/lib -o octeontx_fpavf.o.o octeontx_fpavf.o.pmd.o octeontx_fpavf.o
即可编译成功