pjsip / pjproject

PJSIP project
http://www.pjsip.org
GNU General Public License v2.0
2.01k stars 767 forks source link

Cross Compilation Fails on ubuntu20.04 #2834

Closed zishucom closed 1 year ago

zishucom commented 2 years ago

Describe the bug

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' make: *** [Makefile:14: all] Error 1

Steps to reproduce

  1. ./configure --host=arm-elf-linux CC=aarch64-linux-gnu-gcc --disable-libwebrtc --disable-libyuv
  2. make dep && make

PJSIP version

2.11

Context

Log, call stack, etc

no log~ 

it was happend at make
zishucom commented 2 years ago

i got the "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

# 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
mathaou commented 1 year ago

I have this exact same issue. Still unsolved, over a year later.

colorhacker commented 1 year ago

how to solve

sauwming commented 1 year ago

Since the error happens in pjsua2-test, I think you can ignore it. Or just run make lib to build the library only.