xpertsavenue / WiringOP-Zero

WiringPi / WiringOP libary for the Orange Pi Zero with 26 pin GPIO header
GNU Lesser General Public License v3.0
173 stars 82 forks source link

error in build gpio.o: error adding symbols: Bad value (R_ARM_THM_MOVW_ABS_NC) #19

Open bodtx opened 6 years ago

bodtx commented 6 years ago

Hi, I'm trying to build on my OPIZ

here is the PI:

Welcome to ARMBIAN 5.38 stable Debian GNU/Linux 9 (stretch) 4.14.18-sunxi   
System load:   0.41 0.25 0.10   Up time:       1 min        
Memory usage:  9 % of 493MB     IP:            192.168.1.18
CPU temp:      35°C             
Usage of /:    8% of 15G

here is the log

GPIO Utility
[Link]
/usr/bin/ld: gpio.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
gpio.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'gpio' failed
make: *** [gpio] Error 1

I tried to add -fPIC flag in gpio/Makefile with no success

@$(CC) -o $@ $(OBJ) $(LDFLAGS) -fPIC $(LIBS)

pkrich commented 6 years ago

same here

rzeldent commented 6 years ago

This can be resolved by adding -fPIC in the CFLAGS in the Makefile for wiringPi:

CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC

bodtx commented 6 years ago

Same error with your line

hunasdf commented 5 years ago

rzeldent solution works for me if I deleted the already complied *.o files.

cd gpio
rm *.o
cd ..
./build