热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

交叉编译libcurl用于arm-linux-gnueabi-gcc-Crosscompilelibcurlforarm-linux-gnueabi-gcc

Ihavebeentryingtocrosscompilelibcurl7.35.0fromubuntueclipseforarm-linux-gnueabi-gcc++.

I have been trying to cross compile libcurl 7.35.0 from ubuntu eclipse for arm-linux-gnueabi-gcc++. I have included -lcurl optons in GCC++ linker. when I am trying to compile the code in G++ compiler for the below code everything is going well and no error was there after building.

我一直在尝试从ubuntu eclipse交叉编译libcurl 7.35.0以获得arm-linux-gnueabi-gcc+。我在GCC+ linker中包含了-lcurl optons。当我试图用g++编译下面代码的代码时,一切都进行得很顺利,构建之后没有错误。

#include 
#include 
using namespace std;

int main()
{
     return
}

But when I am trying to cross compile using arm-linux-gnueabi-gcc++ but trying to Build this produces compilation errors:

但是,当我尝试使用arm-linux-gnueabi-gcc++ ++进行交叉编译时,尝试构建它会产生编译错误:

/usr/include/curl/curlrules.h:143:41: error: size of array ‘curl_rule_01’ is negative /usr/include/curl/curlrules.h:153:53: error: size of array ‘curl_rule_02’ is negative

/usr/include/curl/curlrules.h:143:41: error: array ' curl_rule_01 '的大小为负/usr/ include/curlrules .h:153:53:错误:数组的大小curl_rule_02是负数。

Kindly help me to guide how to cross compile libcurl for ARM.

请帮助我指导如何交叉编译libcurl。

1 个解决方案

#1


3  

I remember back when I had to cross-compile curl... what a day! What curl is doing is fairly odd, but yet clever.

我记得当我要交叉编译curl时……多糟糕的一天!curl正在做的事情相当奇怪,但却很聪明。

if you look at that line you see this:

如果你看这条线,你会看到:

typedef char
  __curl_rule_01__
    [CurlchkszEQ(long, CURL_SIZEOF_LONG)];

and if you look at CurlchkszEQ, you get

如果你看CurlchkszEQ,你会得到

#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1

So this routine is enforcing that sizeof(long) == CURL_SIZEOF_LONG, if it does not, it will put a negative number in that array initializer and cause the build to fail.

这个例程执行sizeof(long) == CURL_SIZEOF_LONG,如果没有,它会在数组初始化器中输入一个负数,导致构建失败。

Here's the deal, CURL_SIZEOF_LONG is defined in curlbuild.h, and it is defined to 8... on an x86_64 machine. That is, in /usr/include/curl/curlbuild.h it is set to 8. You don't care about x86_64 though! You're compiling for arm... a 32-bit architecture where sizeof(long) == 4, not 8 and CURL_SIZEOF_LONG is improperly set to 8! So it appears your compiler is picking up on the system wide, x86_64 curl header files at /usr/include/... rather than the headers for the cross compiler! (for example mine are in /opt/cross/arm-unknown-linux-gnueabi/include/..., but yours probably are not).

这里的问题是,CURL_SIZEOF_LONG在curlbuild中定义。h,定义为8…在一个x86_64机器。也就是说,在/usr/include/curl/curlbuild.h它被设为8。但是你不关心x86_64 !你编译的手臂……一个32位的架构,其中sizeof(long) = 4,而不是8和CURL_SIZEOF_LONG被错误地设置为8!因此,您的编译器似乎正在系统范围内获取x86_64 curl头文件(/usr/ include/…)。而不是交叉编译器的头文件!(例如我的是in /opt/cross/arm-unknown-linux-gnueabi/include/…),但你的可能不是)。

So when compiling the compiler resovles that sizeof(long) == 4 != CURL_SIZEOF_LONG and properly crashes. The way to fix the problem is simple in theory, just change your configuration in your compiler to use the cross-compiler includes. In Eclipse, I am not sure how to do it, though I am sure it is possible.

因此,当编译器编译时,sizeof(long) == 4 != CURL_SIZEOF_LONG并正确地崩溃。解决这个问题的方法在理论上很简单,只需更改编译器中的配置以使用交叉编译器include。在Eclipse中,我不确定如何实现它,尽管我确信这是可能的。

You might find it easier just to build curl from the terminal like so:

你可能会发现从终端构建旋度更简单:

curl $ ./configure --host=arm-linux-gnueabi --prefix=/path/to/your/arm-linux-gnueabi/arm-linux-gnueabi
... configure stuff ...
curl $ make && make install

推荐阅读
  • 在Kubernetes上部署JupyterHub的步骤和实验依赖
    本文介绍了在Kubernetes上部署JupyterHub的步骤和实验所需的依赖,包括安装Docker和K8s,使用kubeadm进行安装,以及更新下载的镜像等。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
  • 使用eclipse创建一个Java项目的步骤
    本文介绍了使用eclipse创建一个Java项目的步骤,包括启动eclipse、选择New Project命令、在对话框中输入项目名称等。同时还介绍了Java Settings对话框中的一些选项,以及如何修改Java程序的输出目录。 ... [详细]
  • 开发笔记:spring boot项目打成war包部署到服务器的步骤与注意事项
    本文介绍了将spring boot项目打成war包并部署到服务器的步骤与注意事项。通过本文的学习,读者可以了解到如何将spring boot项目打包成war包,并成功地部署到服务器上。 ... [详细]
  • 本文介绍了在Ubuntu 11.10 x64环境下安装Android开发环境的步骤,并提供了解决常见问题的方法。其中包括安装Eclipse的ADT插件、解决缺少GEF插件的问题以及解决无法找到'userdata.img'文件的问题。此外,还提供了相关插件和系统镜像的下载链接。 ... [详细]
  • android ... [详细]
  • 如何使用Xcode7软件添加NTL库并运行C++程序。一、首先安装NTL库1、进入“ATourofNTL:ObtainingandInstallingNTLfor ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 本文介绍了C++中省略号类型和参数个数不确定函数参数的使用方法,并提供了一个范例。通过宏定义的方式,可以方便地处理不定参数的情况。文章中给出了具体的代码实现,并对代码进行了解释和说明。这对于需要处理不定参数的情况的程序员来说,是一个很有用的参考资料。 ... [详细]
  • Maven构建Hadoop,
    Maven构建Hadoop工程阅读目录序Maven安装构建示例下载系列索引 序  上一篇,我们编写了第一个MapReduce,并且成功的运行了Job,Hadoop1.x是通过ant ... [详细]
  • 装饰模式(Deocrator)     动态地给一个对象添加一些额外的职责,就增加功能来说,装饰模式比生成子类更为灵活。    所谓装饰,就是一些对象给主题 ... [详细]
  • 美国制造工程协会(AmericanSocietyofManufacturingEngineers,ASME)机器视觉分会和美国机器人工业协会(RoboticIndustriesAs ... [详细]
  • 调用百度ocr的API,python简易版本
    https:www.jianshu.compe10dc43c38d01.注册百度云注册账号https:cloud.baidu.com?fromconsole管理应用https:co ... [详细]
  • Averysimpleproblem.ItrytorunaverysimpledemotocreatedanddisplayaWindowFramefromEc ... [详细]
author-avatar
跑车世界Y
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有