从intel到arm交叉编译库 [英] Cross Compiling a library from intel to arm

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

问题描述

我正在使用来自 http://dicom.offis.de/dcmtk的开源C ++库DCMTK .php.en
我已经使用VC ++ IDE,MacOS Xcode,Mac iOS模拟器在Windows上成功编译了该库。
但是我不能在iOS设备上编译该库,因为它是基于ARM的体系结构。
DCMTK库在Intel架构上可以很好地编译。

I am using open source C++ library DCMTK from http://dicom.offis.de/dcmtk.php.en. I have successfully compiled this library on Windows using VC++ IDE, MacOS Xcode, Mac iOS simulator. But I am not able to compile this library on iOS device as it is ARM based architecture. DCMTK library compiled very well on Intel architecture.

现在我的问题陈述是:-

Now my problem statement is :-

我需要交叉编译ARM体系结构上的DCMTK C ++库汇编。
我正在使用Ubuntu 64位计算机进行交叉编译。
我已经从 http://www.gnuarm.com/ 安装了GNU ARM工具链中的二进制文件
我正在使用GCC工具链4.0 binutils-2.16.1,gcc-4.0.2-c-c ++,newlib-1.14.0,insight-6.4,TAR BZ2 [65.5MB]二进制文件(适用于ARM的Ubuntu 64位计算机)

I need to compile this DCMTK C++ library on ARM architecture by cross compilation. I am using Ubuntu 64 bit machine for cross compilation. I have installed binaries from GNU ARM tool chain from http://www.gnuarm.com/ I am using GCC toolchain 4.0 binutils-2.16.1, gcc-4.0.2-c-c++, newlib-1.14.0, insight-6.4, TAR BZ2 [65.5MB] binaries for Ubuntu 64 bit machine for ARM cross compilation.

在Ubuntu上安装这些二进制文件后,我已将PATH环境变量设置为
PATH = $ PATH / gnu_arm / bin

After Installing these binaries on Ubuntu I have set PATH environment variable to PATH=$PATH/gnu_arm/bin

为配置DCMTK C ++库,我在shell上运行了以下命令

For configuring the DCMTK C++ library I have run the following command on shell

它会正确创建一个make文件。现在,我试图使用make命令来编译代码,但是遇到了很多编译错误,例如:-
1)我试图编译我的第一个相关的C ++库,即ofstd。
DIR *,struct dirent,opendir(),closedir()调用出错。
它包括这些调用,但在此头文件中没有找到上述调用的任何定义。

It creates a make file properly. Now I am trying to compile the code by using make command, but facing so many compilation errors like :- 1) I tried to compile my first dependent C++ library that is ofstd. I got error for DIR*, struct dirent, opendir(), closedir() calls. It includes for these calls, but I did not found any definitions for the above calls in this header file.

2)当我编译另一个日志库时,出现以下错误,例如
错误:在此范围内未声明nthos
错误:在此范围内未声明ntohl
错误:在此范围内未声明htons
错误:在此范围内未声明htonl。
这些调用是网络调用,没有在GNU ARM工具的任何头文件中定义。

2) When I compile another library oflog I got the following errors like error: nthos was not declared in this scope error: ntohl was not declared in this scope error: htons was not declared in this scope error: htonl was not declared in this scope. These calls are networking calls and are not defined in any of the header file from GNU ARM tool.

我尝试下载ARM二进制文件的源并提取tar文件,然后尝试将丢失的头文件复制到Ubuntu上已安装的GNU ARM。
对于某些文件,在对复制的头文件进行更改后便会进行编译,而对于某些文件,则再次出现编译错误。由于缺少一些标准头文件,因此DCMTK库下存在的每个文件都会出现编译错误循环。

I tried to download the sources of ARM binaries and extracted the tar files and try to copy missing header files to installed GNU ARM on Ubuntu. For some files it compiles after doing changes to copied header files, and for some again it gives compilation errors.. There is a loop of compilation errors for every file present under DCMTK library as some of the standard header files are missing.

请建议在Ubuntu 64位计算机上是否还有其他工具可用于ARM交叉编译。
或除此以外的任何其他好的解决方案。

Please suggest if there is any other tool chain available for ARM cross compilation on Ubuntu 64 bit machine. Or any other good solution apart from this.

谢谢!!!
Amit

Thanks!!! Amit

推荐答案

在进行交叉编译时,存在很多问题。交叉编译有三个主要标志。 -host,-target和-build。 -host flash是将在其上运行生成的二进制文件的计算机。 -build flash是您要在其中进行编译的系统。 -target标志用于构建将在交叉编译中使用的库。因此,如果您要构建自己的gcc工具链。因此,在您的情况下,您将不会设置目标标记,因为我们没有构建工具链。 -host标志将是arm-elf。而-build标志将是amd64。

There are many areas for problems when it comes to cross compiling. There are three main flags for cross compiling. -host , -target, and -build. The -host flash is the machine in which the resulting binaries will run on. The -build flash is the system in which you will be compiling on. The -target flag is for building libraries that will be used in cross compiling. So if you were to build your own gcc tool chain. So in your case you won't set the target flag as we're not building a tool chain. the -host flag will be arm-elf. And the -build flag will be amd64.

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

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