<tfoot id='snTSu'></tfoot>
      <i id='snTSu'><tr id='snTSu'><dt id='snTSu'><q id='snTSu'><span id='snTSu'><b id='snTSu'><form id='snTSu'><ins id='snTSu'></ins><ul id='snTSu'></ul><sub id='snTSu'></sub></form><legend id='snTSu'></legend><bdo id='snTSu'><pre id='snTSu'><center id='snTSu'></center></pre></bdo></b><th id='snTSu'></th></span></q></dt></tr></i><div id='snTSu'><tfoot id='snTSu'></tfoot><dl id='snTSu'><fieldset id='snTSu'></fieldset></dl></div>
      1. <small id='snTSu'></small><noframes id='snTSu'>

          <bdo id='snTSu'></bdo><ul id='snTSu'></ul>
        <legend id='snTSu'><style id='snTSu'><dir id='snTSu'><q id='snTSu'></q></dir></style></legend>
      2. 树莓派的交叉编译

        时间:2023-12-03

            <tbody id='4F1Qa'></tbody>

          <tfoot id='4F1Qa'></tfoot>

        1. <i id='4F1Qa'><tr id='4F1Qa'><dt id='4F1Qa'><q id='4F1Qa'><span id='4F1Qa'><b id='4F1Qa'><form id='4F1Qa'><ins id='4F1Qa'></ins><ul id='4F1Qa'></ul><sub id='4F1Qa'></sub></form><legend id='4F1Qa'></legend><bdo id='4F1Qa'><pre id='4F1Qa'><center id='4F1Qa'></center></pre></bdo></b><th id='4F1Qa'></th></span></q></dt></tr></i><div id='4F1Qa'><tfoot id='4F1Qa'></tfoot><dl id='4F1Qa'><fieldset id='4F1Qa'></fieldset></dl></div>

          <small id='4F1Qa'></small><noframes id='4F1Qa'>

              <bdo id='4F1Qa'></bdo><ul id='4F1Qa'></ul>
              <legend id='4F1Qa'><style id='4F1Qa'><dir id='4F1Qa'><q id='4F1Qa'></q></dir></style></legend>

                  本文介绍了树莓派的交叉编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用 RaspBerry Pi 和我的电脑,我试图交叉编译一个用 C++ 编写的简单 helloWorld.我正在使用适用于 linux 的 Code Sourcery 工具链进行编译.

                  With a RaspBerry Pi and from my computer, I'm trying to cross-compile a simple helloWorld written in C++. I'm using Code Sourcery toolchain for linux to compile.

                  当通过 TFTP 将 helloWorld 二进制文件复制到 raspBerry 并使用 chmod 授予它执行权限时,出现下一个错误:

                  When copy the helloWorld binary to raspBerry by TFTP and give it execution permissions with chmod, the next error appears:

                  非法指令"

                  如果在二进制文件上创建一个文件",我会得到:raspberry:ELF 32 位 LSB 可执行文件,ARM,版本 1 (SYSV),静态链接,剥离"

                  If make a 'file' over binary I get: "raspberry: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped"

                  这是因为我在链接时使用了-static -static-libstdc++".

                  This is because I used "-static -static-libstdc++" when linking.

                  如果我不使用静态链接,错误是:分段错误"

                  If I don't use static linking, the error is: "Segmentation fault"

                  代码:

                  /*
                   * main.cpp
                   *
                   *  Created on: 26/06/2012
                   *      Author: ccortiz
                   */
                  
                  #include <iostream>
                  using namespace std;
                  
                  int main(void){
                  
                      cout << "Hello Cross Compilling for ARM!" << endl << flush;
                      return 0;
                  }
                  

                  我怎样才能以正确的方式编译和运行我的程序?谢谢.

                  How could I compile and run my program in a right way? Thanks.

                  推荐答案

                  你得到 Segmentation fault 错误的原因是不同的 ABI.运行 Raspbian 时的 Raspberry Pi 使用 linux-arm-gnueabihf ABI,它假定硬件支持 hardfp 和 VFP(这在 ARMv6 环境中很少见),因此需要一些额外的 GCC 和 EGLIBC 补丁(这些补丁可以是在 Raspbian 存储库中找到).

                  The reason why are you getting Segmentation fault error is different ABI. Raspberry Pi when running Raspbian is using linux-arm-gnueabihf ABI which assumes hardfp and VFP support in hardware (which is rare in ARMv6 environment) so requires some additional patches for GCC and EGLIBC (these patches can be found in Raspbian repository).

                  您的 Code Sourcery 跨工具链很可能没有这些补丁,因此它使用另一个 ABI (linux-arm-gnueabi) 因此在运行时崩溃(静态链接有效,因为内核 ABI 没有取决于hardfp/softfp).

                  Your Code Sourcery cross-toolchain most likely does not have these patches, so it's using another ABI (linux-arm-gnueabi) hence the crash at runtime (static linking works because kernel ABI does not depend on hardfp/softfp).

                  您可能收到 Illegal Instruction 错误的另一个可能原因是为 ARMv7 和 Raspberry Pi 配置的 Code Sourcery 交叉工具链是 ARMv6.但在这种情况下,静态和动态链接都会产生相同的错误.

                  Another possible reason why you may be getting Illegal Instruction error is Code Sourcery cross-toolchain configured for ARMv7 and Raspberry Pi is ARMv6. But in this case both static and dynamic linking will yield the same error.

                  这是如何在 Windows 中构建 Raspberry Pi 交叉编译器的分步指南,hardfp/softfp ABI 版本.生成的交叉编译器支持 C++ 并且不依赖于 cygwin 运行时库 (cygwin1.dll).

                  Here is a step-by-step guide how to build Raspberry Pi cross compiler in Windows, both hardfp/softfp ABI versions. Resulting cross-compiler supports C++ and does not depend on cygwin runtime library (cygwin1.dll).

                  这篇关于树莓派的交叉编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:构建 OpenCV 时出现 CMake 错误 - CMakeLists 不匹配 下一篇:Bluez 的 C/C++ BLE 读/写示例

                  相关文章

                1. <tfoot id='i131w'></tfoot><legend id='i131w'><style id='i131w'><dir id='i131w'><q id='i131w'></q></dir></style></legend>
                  <i id='i131w'><tr id='i131w'><dt id='i131w'><q id='i131w'><span id='i131w'><b id='i131w'><form id='i131w'><ins id='i131w'></ins><ul id='i131w'></ul><sub id='i131w'></sub></form><legend id='i131w'></legend><bdo id='i131w'><pre id='i131w'><center id='i131w'></center></pre></bdo></b><th id='i131w'></th></span></q></dt></tr></i><div id='i131w'><tfoot id='i131w'></tfoot><dl id='i131w'><fieldset id='i131w'></fieldset></dl></div>

                      <bdo id='i131w'></bdo><ul id='i131w'></ul>

                    1. <small id='i131w'></small><noframes id='i131w'>