make报错:

collect2: error: ld returned 1 exit status
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)

changing mode of build/scripts-3.7/2to3 from 644 to 755
changing mode of build/scripts-3.7/pyvenv from 644 to 755
renaming build/scripts-3.7/pydoc3 to build/scripts-3.7/pydoc3.7
renaming build/scripts-3.7/idle3 to build/scripts-3.7/idle3.7
renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
gcc -pthread     -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.7m.a -lcrypt -lpthread -ldl  -lutil   -lm  
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: Programs/_testembed.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make: *** [Makefile:731: Programs/_testembed] Error 1
root@linaro-alip:/home/linaro/Downloads/EMB3581/Python-3.7.3# 

错误原因

文件之前在inter架构上被编译过,产生了编译文件*.o,
.o文件是inter架构(x86)系统上的,不能在ARM架构上继续使用。

解决方法

运行:make clean或者删除*.o文件

root@linaro-alip:/home/linaro/Downloads/EMB3581/Python-3.7.3# make clean
find . -depth -name '__pycache__' -exec rm -rf {} ';'
find . -name '*.py[co]' -exec rm -f {} ';'
find . -name '*.[oa]' -exec rm -f {} ';'
find . -name '*.s[ol]' -exec rm -f {} ';'
find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
find build -name 'fficonfig.h' -exec rm -f {} ';' || true
find build -name '*.py' -exec rm -f {} ';' || true
find build -name '*.py[co]' -exec rm -f {} ';' || true
rm -f pybuilddir.txt
rm -f Lib/lib2to3/*Grammar*.pickle
rm -f Programs/_testembed Programs/_freeze_importlib
find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
rm -f Include/pydtrace_probes.h
rm -f profile-gen-stamp

重新编译,大吉大利

root@linaro-alip:/home/linaro/Downloads/EMB3581/Python-3.7.3# make
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐