搭建arm交叉编译环境,不识别gcc编译器?

今日CentOS8搭建arm交叉编译环境,配置好环境变量后,输入arm-none-linux-gnueabi- ,按2下TAB键,可看到如下:

[binary@daemon ~]$ arm-none-linux-gnueabi-arm-none-linux-gnueabi-addr2line  arm-none-linux-gnueabi-c++filt    arm-none-linux-gnueabi-gcc-4.4.1  arm-none-linux-gnueabi-gprof      arm-none-linux-gnueabi-objdump    arm-none-linux-gnueabi-spritearm-none-linux-gnueabi-ar         arm-none-linux-gnueabi-cpp        arm-none-linux-gnueabi-gcov       arm-none-linux-gnueabi-ld         arm-none-linux-gnueabi-ranlib     arm-none-linux-gnueabi-stringsarm-none-linux-gnueabi-as         arm-none-linux-gnueabi-g++        arm-none-linux-gnueabi-gdb        arm-none-linux-gnueabi-nm         arm-none-linux-gnueabi-readelf    arm-none-linux-gnueabi-striparm-none-linux-gnueabi-c++        arm-none-linux-gnueabi-gcc        arm-none-linux-gnueabi-gdbtui     arm-none-linux-gnueabi-objcopy    arm-none-linux-gnueabi-size

但执行出现错误(错误信息为:No such file or directory):

[binary@daemon ~]$ arm-none-linux-gnueabi-gccbash: /data/vProgram/arm/arm-2009q3/bin/arm-none-linux-gnueabi-gcc: No such file or directory

有点奇怪,分明是有此文件,环境变量也是正确生效的,为何会提醒此错误?想想可这arm交叉编译器是32位的?

当前系统环境是64位,并没有32位的依赖库?

用ldd查看:

[binary@daemon bin]$ ldd arm-none-linux-gnueabi-gcc  not a dynamic executable

再用readelf查看:

[binary@daemon bin]$ readelf -l arm-none-linux-gnueabi-gcc
Elf file type is EXEC (Executable file)Entry point 0x80493e0There are 8 program headers, starting at offset 52
Program Headers:  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align  PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4  INTERP         0x000134 0x08048134 0x08048134 0x00013 0x00013 R   0x1      [Requesting program interpreter: /lib/ld-linux.so.2]  LOAD           0x000000 0x08048000 0x08048000 0x31af8 0x31af8 R E 0x1000  LOAD           0x031af8 0x0807aaf8 0x0807aaf8 0x0085c 0x01160 RW  0x1000  DYNAMIC        0x031b0c 0x0807ab0c 0x0807ab0c 0x000c8 0x000c8 RW  0x4  NOTE           0x000148 0x08048148 0x08048148 0x00020 0x00020 R   0x4  GNU_EH_FRAME   0x031a80 0x08079a80 0x08079a80 0x0001c 0x0001c R   0x4  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
 Section to Segment mapping:  Segment Sections...   00        01     .interp    02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame    03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss    04     .dynamic    05     .note.ABI-tag    06     .eh_frame_hdr    07     

提示错误,定位到问题,缺乏32位的支持:

 [Requesting program interpreter: /lib/ld-linux.so.2]

在root账户权限下,安装ld-linux.so.2:

[root@daemon bin]# yum install ld-linux.so.2Last metadata expiration check: 0:00:41 ago on Thu 19 Dec 2019 10:06:30 AM CST.Dependencies resolved.=================================================================================================================================================================================================================== Package                                          Arch                                            Version                                                 Repository                                          Size===================================================================================================================================================================================================================Installing: glibc32                                          x86_64                                          2.28-42.1.el8                                           AppStream                                          1.5 M
Transaction Summary===================================================================================================================================================================================================================Install  1 Package
Total download size: 1.5 MInstalled size: 5.2 MIs this ok [y/N]: yDownloading Packages:glibc32-2.28-42.1.el8.x86_64.rpm                                                                                                                                                   725 kB/s | 1.5 MB     00:02    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                                              388 kB/s | 1.5 MB     00:03     Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction  Preparing        :                                                                                                                                                                                           1/1   Installing       : glibc32-2.28-42.1.el8.x86_64                                                                                                                                                              1/1   Running scriptlet: glibc32-2.28-42.1.el8.x86_64                                                                                                                                                              1/1   Verifying        : glibc32-2.28-42.1.el8.x86_64                                                                                                                                                              1/1 
Installed:  glibc32-2.28-42.1.el8.x86_64
Complete!

执行arm-none-linux-gnueabi-gcc,这时已经正常了:

[binary@daemon bin]$ arm-none-linux-gnueabi-gccarm-none-linux-gnueabi-gcc: no input files

查看版本:

[binary@daemon bin]$ arm-none-linux-gnueabi-gcc --versionarm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q3-67) 4.4.1Copyright (C) 2009 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

问题得到解决~

有兴趣的朋友可以持续关注,接下来将推送嵌入式系列文章。

注:本文为binary原创,未经许可不得在任何平台转载。如需转载,与作者联系~

  欢迎加入linux交流群:734638086,分享工作经验。

关注微信公众号:技术训练营(微信ID:TechBootcamp),获取更多资讯~

微信扫一扫,发现更精彩。

发布了46 篇原创文章 · 获赞 5 · 访问量 2万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览