使用arm-none-linux-gnueabi-gcc–ohellohello.c编译完。。。

卫星电视接收卡使⽤arm-none-linux-gnueabi-gcc–ohellohello.c编译完。。。问题:
巨人传奇
使⽤arm-none-linux-gnueabi-gcc –o hello hello.c编译完成,在上运⾏出现报错:
-sh: ./hello: No such file or directory
原因:
朱虹
因为我们的程序使⽤的是动态链接⽅式编译的,⽽ARM上的链接库⽂件路径不同,导致不到⽂件,可以⽤gcc -static命令改⽤静态链接的⽅式编译:
arm-none-linux-gnueabi-gcc –o hello hello.c -static
编译器的架构有差
这是发⽣在⼀次新的开发板的交叉编译中产⽣的,同样的程序⽤同样的⼯具链编译后,⼀个开发板正常,⼆另⼀个报No such file or directory,⽂件明明存在,这个问题在于arm-Linux-guneabi-和arm-linux-guneabihf-这两个链的差别在于hf⼆字,这个是浮点单元的⽀持与否,选择错误会导致上述错误发⽣。
格林伯格⽤uname -a查看ARM的架构和Linux版本,举例:
root@imx6qsabresd:~# uname -a
Linux imx6qsabresd 3.14.28-1.0.0_ga+g91cf351 #14 SMP PREEMPT Tue Apr 25 16:25:22 CST 2017 armv7l GNU/Linux
查看执⾏程序的属性,举例:钛板>吃的真相
zhao@zhao-VirtualBox:/home/nfs/file/ntp$ file ntpdate
ntpdate: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped
以上的情况就⽆法执⾏,显⽰“No such file or directory”,然后通过更换GCC成功了。新版本:
gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_

本文发布于:2024-09-25 14:31:35,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/264572.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:编译   错误   链接   导致   架构   程序
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议