在野火Linux开发板上使用Makefile编译文件时出现如下错误
arm-linux-gnueabihf-gcc -Wall -O2 -o server server.o -lpthread
/usr/bin/ld: cannot open output file server: Permission denied
collect2: error: ld returned 1 exit status
make: *** [Makefile_ser:15: server] Error 1
使用root用户依然报错
arm-linux-gnueabihf-gcc -Wall -O2 -o server server.o -lpthread
/usr/bin/ld: server.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: server.o(.text+0x2c): unresolvable R_ARM_THM_CALL relocation against symbol `perror@@GLIBC_2.4'
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [Makefile_ser:15: server] Error 1
最终解决办法是,忘记之前已经有编译过的文件了,先清除一次编译过的文件,再次重新编译就好了