Home > Blockchain >  aarch64-linux-gnu-gcc Cross Complier for arm fails
aarch64-linux-gnu-gcc Cross Complier for arm fails

Time:09-27

./configure --host=arm-elf-linux  CC=aarch64-linux-gnu-gcc --disable-sdl --disable-ffmpeg --disable-v4l2 --disable-openh264 --disable-libwebrtc --disable-libyuv

make dep && make

arch64-linux-gnu-gcc -o ../bin/pjsua2-test-arm-elf-linux-gnu
output/pjsua2-test-arm-elf-linux-gnu/main.o -L/home/duma/Public/pjproject.doing/pjlib/lib -L/home/duma/Public/pjproject.doing/pjlib-util/lib -L/home/duma/Public/pjproject.doing/pjnath/lib -L/home/duma/Public/pjproject.doing/pjmedia/lib -L/home/duma/Public/pjproject.doing/pjsip/lib -L/home/duma/Public/pjproject.doing/third_party/lib -lpjsua2-arm-elf-linux-gnu -lstdc -lpjsua-arm-elf-linux-gnu -lpjsip-ua-arm-elf-linux-gnu -lpjsip-simple-arm-elf-linux-gnu -lpjsip-arm-elf-linux-gnu -lpjmedia-codec-arm-elf-linux-gnu -lpjmedia-arm-elf-linux-gnu -lpjmedia-videodev-arm-elf-linux-gnu -lpjmedia-audiodev-arm-elf-linux-gnu -lpjmedia-arm-elf-linux-gnu -lpjnath-arm-elf-linux-gnu -lpjlib-util-arm-elf-linux-gnu -lsrtp-arm-elf-linux-gnu -lresample-arm-elf-linux-gnu -lgsmcodec-arm-elf-linux-gnu -lspeex-arm-elf-linux-gnu -lilbccodec-arm-elf-linux-gnu -lg7221codec-arm-elf-linux-gnu -lpj-arm-elf-linux-gnu -lm -lrt -lpthread /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: Relocations in generic ELF (EM: 62) /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: output/pjsua2-test-arm-elf-linux-gnu/main.o: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status make[2]: *** [/home/duma/Public/pjproject.doing/build/rules.mak:125: ../bin/pjsua2-test-arm-elf-linux-gnu] Error 1 make[2]: Leaving directory '/home/duma/Public/pjproject.doing/pjsip/build' make[1]: *** [Makefile:286: pjsua2-test-arm-elf-linux-gnu] Error 2 make[1]: Leaving directory '/home/duma/Public/pjproject.doing/pjsip/build'

CodePudding user response:

Some of the libraries to link may not be built with the same toolchain. You can check with objdump.

Example (The "file format" may not be the exact result in your case):

$ aarch64-linux-gnu-objdump -TC libz.so

libz.so:     file format elf64-littleaarch64

Please confirm that the "file format" of all the libraries should match your toolchain.

CodePudding user response:

"file in wrong format" Err:

$ file main.o 
main.o: ELF 64-bit LSB relocatable, x86-64,

$file other *.o
sip_uri.o: ELF 64-bit LSB relocatable, ARM aarch64,

so main.o file format is x86-64 , but other .o files formate are ARM aarch64

but ....i still dont know how to solve that ( change the main.o file format)

the section of main.o in Makefile and i m sure the Problem at line:287

# Defines for building pjsua2-test application
161 #
162 export PJSUA2_TEST_SRCDIR = ../src/pjsua2-test
163 export PJSUA2_TEST_OBJS  = $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
164          main.o
165 export PJSUA2_TEST_CFLAGS  = $(_CFLAGS) $(PJ_VIDEO_CFLAGS)
166 export PJSUA2_TEST_CXXFLAGS = $(_CXXFLAGS) $(PJSUA2_LIB_CFLAGS) $(PJ_VIDEO_CFLAGS)
167 export PJSUA2_TEST_LDFLAGS  = $(PJ_LDXXFLAGS) $(PJ_LDXXLIBS) $(LDFLAGS)
168 ifeq ($(EXCLUDE_APP),0)
169 export PJSUA2_TEST_EXE := pjsua2-test-$(TARGET_NAME)$(HOST_EXE)
170 endif
171 export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
----------------------
pjsua2-test: $(PJSUA2_TEST_EXE)
281 $(PJSUA2_TEST_EXE): $(PJSIP_LIB) $(PJSIP_SONAME)
282 $(PJSUA2_TEST_EXE): $(PJSIP_UA_LIB) $(PJSIP_UA_SONAME)
283 $(PJSUA2_TEST_EXE): $(PJSIP_SIMPLE_LIB) $(PJSIP_SIMPLE_SONAME)
284 $(PJSUA2_TEST_EXE): $(PJSUA_LIB_LIB) $(PJSUA_LIB_SONAME)
285 $(PJSUA2_TEST_EXE): $(PJSUA2_LIB_LIB) $(PJSUA2_LIB_SONAME)
286 $(PJSUA2_TEST_EXE):
287   **$(MAKE) -f $(RULES_MAK) APP=PJSUA2_TEST app=pjsua2-test $(subst /,$(HOST_PSEP),$(BINDIR)/$@)**
  • Related