简体   繁体   English

尝试交叉编译httpry的问题

[英]Issue trying to cross-compile httpry

I'm trying to cross-compile httpry . 我正在尝试交叉编译httpry I have already cross-compiled libpcap, but for some reason when I try to compile httpry it doesn't seem to be able to find the libpcap library. 我已经交叉编译了libpcap,但是由于某种原因,当我尝试编译httpry时,似乎无法找到libpcap库。

I've had to modify the Makefile for httpry in order to attempt cross-compilation: 为了尝试交叉编译,我不得不为httpry修改Makefile:

CC              = /usr/bin/arm-linux-gnueabi-gcc
CCFLAGS         = -Wall -O3 -funroll-loops -I/home/josh/workbench/libpcap-1.8.1
DEBUGFLAGS      = -Wall -g -DDEBUG -I/home/josh/workbench/libpcap-1.8.1

When I try compilation I get the following error: 当我尝试编译时,出现以下错误:

josh@LAPTOP-D3KEQ9EM:~/workbench/httpry-0.1.8$ make
/usr/bin/arm-linux-gnueabi-gcc -Wall -O3 -funroll-loops -I/home/josh/workbench/libpcap-1.8.1 -o httpry httpry.c format.c methods.c utility.c rate.c -lpcap -lm -pthread
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lpcap
collect2: error: ld returned 1 exit status
make: *** [httpry] Error 1

So it certainly seem that LD isn't finding the library. 因此,LD似乎没有找到该库。 Out of curiosity, I tried 出于好奇,我尝试了

josh@LAPTOP-D3KEQ9EM:~/workbench/httpry-0.1.8$ ld -L/home/josh/workbench/libpcap-1.8.1 -lpcap
ld: skipping incompatible /home/josh/workbench/libpcap-1.8.1/libpcap.so when searching for -lpcap
ld: skipping incompatible /home/josh/workbench/libpcap-1.8.1/libpcap.a when searching for -lpcap
ld: cannot find -lpcap

Seems like the LD I have on PATH gives the same error, and it's caused because libpcap is cross-compiled for a different architecture to my current architecture. 好像我在PATH上的LD给出了相同的错误,这是由于libpcap是针对与当前体系结构不同的体系结构交叉编译而引起的。 But my cross-complication GCC doesn't use the PATH LD, it uses its own version, and when I try that I get the following 但是我的交叉复杂化GCC不使用PATH LD,而是使用自己的版本,当我尝试这样做时,我得到以下信息

josh@LAPTOP-D3KEQ9EM:~/workbench/httpry-0.1.8$ /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld -L/home/josh/workbench/libpcap-1.8.1 -lpcap
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 00000000000081e4

That's kinda weird, right? 有点奇怪吧? It seems like when I run ld it's able to find the library without any issues, but when GCC runs it for some reason it's not. 看起来当我运行ld时,它能够找到该库而没有任何问题,但是当GCC由于某种原因运行时,它就没有。

Am I missing something obvious? 我是否缺少明显的东西? Is there a way I can find out what arguments gcc is calling ld with? 有没有办法找出gcc调用ld的参数? I tried using -v or -### but I wasn't able to find anything useful in the output. 我尝试使用-v或-###,但是在输出中找不到任何有用的东西。

Thanks, 谢谢,

Josh 玩笑

Seems like LD wasn't looking in the right directory. 似乎LD不在正确的目录中。 I thought -I would make sure it did, but it turns out -L was necessary too: 我以为-我会确保做到这一点,但事实证明-L也是必要的:

CC              = /usr/bin/arm-linux-gnueabi-gcc
CCFLAGS         = -Wall -O3 -funroll-loops -I/home/josh/workbench/libpcap-1.8.1 -L/home/josh/workbench/libpcap-1.8.1
DEBUGFLAGS      = -Wall -g -DDEBUG -I/home/josh/workbench/libpcap-1.8.1 -L/home/josh/workbench/libpcap-1.8.1

I'm not entirely sure why this is the case and I'd apprecate an explanation. 我不太确定为什么会这样,请解释一下。 -I has always been enough for me in the past. -过去我对我一直足够。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM