【发布时间】:2015-08-06 07:16:14
【问题描述】:
我正在尝试编译一个严重依赖 libcurl 和 pcap 的自定义包,在我的机器上它工作得很好,但是当我尝试使用工具链编译它时,我得到了这个错误:
$ /home/kavastudios/sites/proC/SDK/OpenWrt-Toolchain-ar71xx-for-mips_34kc-gcc-4.8-linaro_uClibc-0.9.33.2/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc airhog.c -o airhogfull -lpcap -lcurl
mips-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
In file included from /usr/include/curl/curl.h:35:0,
from airhog.c:16:
/usr/include/curl/curlrules.h:142:3: error: size of array '__curl_rule_01__' is negative
__curl_rule_01__
^
/usr/include/curl/curlrules.h:152:3: error: size of array '__curl_rule_02__' is negative
__curl_rule_02__
^
如果我编译它使用 curl 删除所有代码(只留下 pcap)我得到这个错误:
cannot find -lpcap
collect2: error: ld returned 1 exit status
在阅读了很多帖子之后,我的猜测是我需要交叉编译 pcap 和 curl,然后在尝试编译我的脚本时引用它们,但我完全不知道该怎么做。
如果你能给我一个线索,我真的很感激:
正确设置暂存目录(我一直在尝试使用 PATH/STAGING_DIR 变量但没有成功)
如何编译 curl/pcap 库(在编译我的脚本时使用,而不是让这些库替换我机器中使用的库)
在编译我的脚本时我应该包括哪些标志或命令。
我使用的是 Ubuntu 14.04
谢谢。
【问题讨论】:
标签: c cross-compiling libcurl libpcap openwrt