RaspBerry Pi的交叉编译 [英] Cross-Compiling for RaspBerry Pi
问题描述
使用RaspBerry Pi和从我的电脑,我试图交叉编译一个简单的helloWorld用C ++编写。
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.
推荐答案
此页面深入介绍如何为Raspberry Pi设置交叉编译环境。祝你好运!
This page tells you in depth how to set up a cross-compiling environment for your Raspberry Pi. Good luck!
这篇关于RaspBerry Pi的交叉编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!