gpt4 book ai didi

交叉编译 Ubuntu 树莓派

转载 作者:行者123 更新时间:2023-12-04 18:41:29 25 4
gpt4 key购买 nike

关注 this tutorial我安装了所有提到的工具链。在“.bashrc”文件中选择合适的工具链“gcc-linaro-arm-linux-gnueabihf-raspbian”后。在我提交“source .bashrc”但“arm-linux-gnueabi-gcc -v”不起作用之后。

这是我在“.bashrc”文件中的行:

enter image description here

这是我的 bin 文件夹:

enter image description here

当我尝试检查它时,结果如下:

enter image description here

根据需要,前一条命令回声 $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/v1sc3rr4k/Universita/Android/sdk/tools:/home/v1sc3rr4k/Universita/Android/sdk/platform-tools:/home/v1sc3rr4k/Universita/Android/android-ndk-r9d:/home/v1sc3rr4k/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin



而后者 ls -l

-rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 620076 feb 11 23:02 arm-linux-gnueabihf-addr2line -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 644400 feb 11 23:02 arm-linux-gnueabihf-ar -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 1085080 feb 11 23:02 arm-linux-gnueabihf-as lrwxrwxrwx 1 v1sc3rr4k v1sc3rr4k 23 feb 11 23:02 arm-linux-gnueabihf-c++ -> arm-linux-gnueabihf-g++ -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 618316 feb 11 23:02 arm-linux-gnueabihf-c++filt -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 572984 feb 11 23:02 arm-linux-gnueabihf-cpp -rw-r--r-- 1 v1sc3rr4k v1sc3rr4k 2977 feb 11 23:02 arm-linux-gnueabihf-ct-ng.config -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 2706116 feb 11 23:02 arm-linux-gnueabihf-dwp -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 51540 feb 11 23:02 arm-linux-gnueabihf-elfedit -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 574264 feb 11 23:02 arm-linux-gnueabihf-g++ lrwxrwxrwx 1 v1sc3rr4k v1sc3rr4k 29 feb 11 23:02 arm-linux-gnueabihf-gcc -> arm-linux-gnueabihf-gcc-4.8.3 -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 571736 feb 11 23:02 arm-linux-gnueabihf-gcc-4.8.3 -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 20748 feb 11 23:02 arm-linux-gnueabihf-gcc-ar -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 20684 feb 11 23:02 arm-linux-gnueabihf-gcc-nm -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 20684 feb 11 23:02 arm-linux-gnueabihf-gcc-ranlib -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 257872 feb 11 23:02 arm-linux-gnueabihf-gcov -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 3631768 feb 11 23:02 arm-linux-gnueabihf-gdb -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 574712 feb 11 23:02 arm-linux-gnueabihf-gfortran -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 681964 feb 11 23:02 arm-linux-gnueabihf-gprof lrwxrwxrwx 1 v1sc3rr4k v1sc3rr4k 26 feb 11 23:02 arm-linux-gnueabihf-ld -> arm-linux-gnueabihf-ld.bfd -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 1064504 feb 11 23:02 arm-linux-gnueabihf-ld.bfd -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 10501 feb 11 23:02 arm-linux-gnueabihf-ldd -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 3755040 feb 11 23:02 arm-linux-gnueabihf-ld.gold -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 629292 feb 11 23:02 arm-linux-gnueabihf-nm -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 769100 feb 11 23:02 arm-linux-gnueabihf-objcopy -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 960268 feb 11 23:02 arm-linux-gnueabihf-objdump -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 417 feb 11 23:02 arm-linux-gnueabihf-pkg-config -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 90444 feb 11 23:02 arm-linux-gnueabihf-pkg-config-real -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 644400 feb 11 23:02 arm-linux-gnueabihf-ranlib -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 431804 feb 11 23:02 arm-linux-gnueabihf-readelf -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 620716 feb 11 23:02 arm-linux-gnueabihf-size -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 620300 feb 11 23:02 arm-linux-gnueabihf-strings -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 769100 feb 11 23:02 arm-linux-gnueabihf-strip v1sc3rr4k@v1sc3rr4k:~/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin$ cd v1sc3rr4k@v1sc3rr4k:~$ ls -l /rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin ls: impossibile accedere a /rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin: File o directory non esistente v1sc3rr4k@v1sc3rr4k:~$ ls -l /home/v1sc3rr4k/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin totale 22540 -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 620076 feb 11 23:02 arm-linux-gnueabihf-addr2line -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 644400 feb 11 23:02 arm-linux-gnueabihf-ar -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 1085080 feb 11 23:02 arm-linux-gnueabihf-as lrwxrwxrwx 1 v1sc3rr4k v1sc3rr4k 23 feb 11 23:02 arm-linux-gnueabihf-c++ -> arm-linux-gnueabihf-g++ -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 618316 feb 11 23:02 arm-linux-gnueabihf-c++filt -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 572984 feb 11 23:02 arm-linux-gnueabihf-cpp -rw-r--r-- 1 v1sc3rr4k v1sc3rr4k 2977 feb 11 23:02 arm-linux-gnueabihf-ct-ng.config -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 2706116 feb 11 23:02 arm-linux-gnueabihf-dwp -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 51540 feb 11 23:02 arm-linux-gnueabihf-elfedit -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 574264 feb 11 23:02 arm-linux-gnueabihf-g++ lrwxrwxrwx 1 v1sc3rr4k v1sc3rr4k 29 feb 11 23:02 arm-linux-gnueabihf-gcc -> arm-linux-gnueabihf-gcc-4.8.3 -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 571736 feb 11 23:02 arm-linux-gnueabihf-gcc-4.8.3 -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 20748 feb 11 23:02 arm-linux-gnueabihf-gcc-ar -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 20684 feb 11 23:02 arm-linux-gnueabihf-gcc-nm -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 20684 feb 11 23:02 arm-linux-gnueabihf-gcc-ranlib -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 257872 feb 11 23:02 arm-linux-gnueabihf-gcov -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 3631768 feb 11 23:02 arm-linux-gnueabihf-gdb -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 574712 feb 11 23:02 arm-linux-gnueabihf-gfortran -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 681964 feb 11 23:02 arm-linux-gnueabihf-gprof lrwxrwxrwx 1 v1sc3rr4k v1sc3rr4k 26 feb 11 23:02 arm-linux-gnueabihf-ld -> arm-linux-gnueabihf-ld.bfd -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 1064504 feb 11 23:02 arm-linux-gnueabihf-ld.bfd -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 10501 feb 11 23:02 arm-linux-gnueabihf-ldd -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 3755040 feb 11 23:02 arm-linux-gnueabihf-ld.gold -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 629292 feb 11 23:02 arm-linux-gnueabihf-nm -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 769100 feb 11 23:02 arm-linux-gnueabihf-objcopy -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 960268 feb 11 23:02 arm-linux-gnueabihf-objdump -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 417 feb 11 23:02 arm-linux-gnueabihf-pkg-config -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 90444 feb 11 23:02 arm-linux-gnueabihf-pkg-config-real -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 644400 feb 11 23:02 arm-linux-gnueabihf-ranlib -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 431804 feb 11 23:02 arm-linux-gnueabihf-readelf -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 620716 feb 11 23:02 arm-linux-gnueabihf-size -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 620300 feb 11 23:02 arm-linux-gnueabihf-strings -rwxr-xr-x 1 v1sc3rr4k v1sc3rr4k 769100 feb 11 23:02 arm-linux-gnueabihf-strip



更新

使用 Eclipse 我可以为 Raspberry 编译。它编译正确并且代码有效。但我有兴趣了解如何在 Ubuntu 上解决这个配置问题。

最佳答案

知道了。这是因为您的路径仅包含编译器的“硬浮点”或“hf”版本:

arm-linux-gnueabi 高频 -gcc

但是您的测试正在尝试运行交叉编译器的非“hf”版本,因此当您尝试检查版本以查看是否安装了编译器时,请注意缺少“hf”。

arm-linux-gnueabi-gcc -v

这是未安装的编译器“软浮点”版本的名称。如果您将检查运行为:
arm-linux-gnueabihf-gcc -v

你应该得到一个有效的答复。这是您应该在控制台中使用的编译器。或者,您也可以选择安装编译器的“软浮点”版本。

关于交叉编译 Ubuntu 树莓派,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28466346/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com