无法为 ARM 交叉编译 Mono [英] Cannot cross-compile Mono for ARM

查看:38
本文介绍了无法为 ARM 交叉编译 Mono的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的三天里,我一直在尝试使用我的 Win7 32 位机器上的虚拟 Ubuntu (12.04) 和 CodeSourcery Sourcery 为 TechNexion Blizzard 板(运行未知版本的 Angstrom)交叉编译 Mono 2.11.4G++ ARM 工具链,但很少/没有成功.我已经学习了网络上的每个教程,但它不起作用.

For the last three days I've been trying to cross-compile Mono 2.11.4 for the TechNexion Blizzard board (running an unknown version of Angstrom) using a virtual Ubuntu (12.04) on my Win7 32 bit machine and CodeSourcery Sourcery G++ ARM toolchain, but with little/no success. I've followed every tutorial on the web but it just doesn't work.

CodeSourcery Sourcery G++ 工具链和 Scratchbox2(从最新的 git 源代码编译)已安装并运行.Scratchbox2 设置它使用

CodeSourcery Sourcery G++ toolchain and Scratchbox2 (compiled from the latest git sources) are installed and working. Scratchbox2 set it up using

sb2-init armv7 /home/dev/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gcc

在正确的目录 (~/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc) 中.

while in the correct directory (~/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc).

我可以编译一个简单的Hello world"(cpp),在板上编译并运行它.在 Ubuntu 中:

I can compile a simple 'Hello world' (cpp), compile and run it on the board. In Ubuntu:

file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

我下载了 Mono 2.11.4 的源代码并遵循了说明之一.第一部分(在本机上)运行良好,没有错误.但是,当我运行第二部分(为 ARM 编译)时,./configure 按预期工作但随后 make 失败,../lib/mini[some_file] 与 arm 输出不兼容".这些文件上的文件表明它们确实是 Intel 80386 可执行文件,但我不知道为什么.

I the downloaded the source for Mono 2.11.4 and followed one of the instructions. The first part (on the native machine) works well, no errors. However, when I run the second part (compiling for ARM) ./configure works as expected but then make fails with "../lib/mini[some_file] is incompatible with arm output". A file on these files says that they are indeed Intel 80386 executables, but I don't know why.

所以下一步是运行 ma​​ke clean 并重复这些步骤,但它仍然产生相同的结果.

So the next step was to run a make clean and repeat the steps, but it still produced the same result.

然后我尝试在 sb2 中./configurema​​ke 整个事情,它起初似乎工作.但是后来出现了一些错误,构建中断了:

I then tried to ./configure and make the whole thing inside sb2 instead and it seemed to work at first. But then some errors popped up the build broke:

./.libs/libmini.a(libmini_la-mini-arm.o): In function `mono_arch_init':
/home/dev/source/host-mono/mono-2.11.4/mono/mini/mini-arm.c:689: undefined reference to `debugger_agent_single_step_from_context'
/home/dev/source/host-mono/mono-2.11.4/mono/mini/mini-arm.c:689: undefined reference to `debugger_agent_breakpoint_from_context'
/home/dev/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-ld: .libs/libmono-2.0.so.1.0.0: hidden symbol `debugger_agent_single_step_from_context' isn't defined
/home/dev/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-ld: final link failed: Nonrepresentable section on output

关于我做错了什么的任何想法,或者关于我可能错过的教程的任何提示?

Any ideas on what I'm doing wrong, or any tips on tutorials I might have missed?

//安德斯

推荐答案

在交叉编译时,你需要非常小心你编译的头文件和库,否则你会发现自己在运行时遇到奇怪的和违反直觉的崩溃与库的二进制不兼容.话虽如此,Linux ARM 发行版在二进制兼容性方面非常安全 - 通常以牺牲性能为代价.

You need to be very careful which headers and libraries you compile against when cross-compiling or you can find yourself with bizarre and counter-intuitive crashes at runtime caused by binary incompatibilities against libraries. In saying this, Linux ARM distros play very safe with binary compatibility - usually at the expense of performance.

很可能您正在针对开发主机头文件和库进行构建 - 因此架构不匹配.

It's quite possible that you're building against your development hosts headers and libraries - hence the architecture mismatch.

您可能会发现预先构建的 opkg 映像可以正常工作.Angstrom 为您提供预构建包.它可能就像从 Angstrom 软件包存储库进行网络安装一样简单.

You might just find that pre-built opkg images just work. Angstrom provides pre-built packages for you. It might be as simple as network-installing from Angstrom package repository.

如果您发现确实需要从源代码构建,那么解决问题的一个简单方法是获取 Angstrom 的构建环境并使用它构建单声道.解决此问题的最简单方法是从 Angtrom 在线图像构建器.幸运的是,您的董事会存在一个.

If you find you do need to build from source, one simple solution to your problem would be to get the build environment for Angstrom and use it to build mono. The easiest way of going about this is to get a pre-built image (and development image) from the Angtrom online image builder. With any luck one exists for your board.

这篇关于无法为 ARM 交叉编译 Mono的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆