English 中文(简体)
为什么跨过汇编海林海合会的错误?
原标题:Why error in cross compiling Arm Linux GCC?

I m试图使用AppWeb,i写道了一个非常简单的方案,将AppWeb纳入我的申请中,它利用AppWeb图书馆的一个功能。

#include <appweb/appweb.h>
int main(int argc, char** argv)
{
    return maRunWebServer("appweb.conf");
}

I dont know when I compile with gcc (or cc), it compiled successful. But, when I cross compile to Arm architecture, is have been getting error. This is my Makefile:

CC = gcc

LIBS = lib

FLAG = -lappweb -lmpr

TEST_TARGET = embed-appweb
OBJS = embed-appweb

all: clean compile

compile: run
    $(CC) -Wall -L$(LIBS) $(FLAG) -o $(TEST_TARGET) $(OBJS).o

run:
    $(CC) -Wall -L$(LIBS) $(FLAG) -c $(OBJS).c

clean:
    @rm -rf $(TEST_TARGET) $(TEST_TARGET).trc *.o *~
    @echo "Clean complete"

I was replace "CC = gcc" to "CC = arm-linux-gcc" in oder to cross compile. The error in my problem is:

arm-linux-gcc -Wall -Llib -lappweb -lmpr -c embed-appweb.c
embed-appweb.c:1:27: error: appweb/appweb.h: No such file or directory
embed-appweb.c: In function  main :
embed-appweb.c:4: warning: implicit declaration of function  maRunWebServer 
make: *** [run] Error 1

i 确信图书馆“校准网”存在于我的夹“校准”中。

有些人可能告诉我,为什么会错? 并向我提出一些建议?

Thanks,

最佳回答

你们是否知道如何使用-I选择gcc?

你发现的错误是,汇编者(gcc)能够找到你想要列入的档案。

简单的解决办法是将FLAG列入你的马克文:

FLAG = -lappweb -lmpr

纽约总部

FLAG = -lappweb -lmpr -I/path/纽约总部/my/headers

Of course you must change /path/纽约总部/my/headers 纽约总部 the true path where your headers reside.

问题回答

你们必须安装(或具有象征意义的连接),把 app头安装到包括树在内的中。

例如,arm-linux-gcc 我的一个系统指挥

$ which arm-linux-gcc
/home/eldk/usr/bin/arm-linux-gcc

因此,包括<>汇编者用途:

 $ arm-linux-gcc -print-search-dirs
install: /home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/
programs: =/home/eldk/usr/bin/../libexec/gcc/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/bin/../libexec/gcc/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/:/usr/libexec/gcc/arm-linux-gnueabi/4.2.2/:/usr/libexec/gcc/arm-linux-gnueabi/:/home/eldk/usr/libexec/gcc/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/bin/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/bin/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/bin/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/bin/
libraries: =/home/eldk/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/bin/../lib/gcc/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/:/usr/libexec/gcc/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/lib/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/bin/../lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/lib/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/lib/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/../../../../arm-linux-gnueabi/lib/:/home/eldk/usr/../arm/lib/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/../arm/lib/:/home/eldk/usr/../arm/usr/lib/arm-linux-gnueabi/4.2.2/:/home/eldk/usr/../arm/usr/lib/

你有两个关切:

  1. Your include search path (as already pointed by sessyargc.jp and wallyk).
  2. Your library search path.

当你使用<条码>gcc汇编时,它将利用您的电梯组合,在自己的工具链中找到头盔和图书馆。 它将违背“/使用者/未完成”和“/使用者/平衡”等内容。

如在<条码>gcc之前所做的那样,如果你正在编辑<条码>,则将使用<条码>-条码-,在自己的工具链中找到负责人和图书馆。 它可以是任何地方的,取决于您的工具链(即:“/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/. ......> 。

请注意,你有两个不同的工具链,每个系统都有自己的档案。

您不能把为“x86”建造的图书馆连接到ARM的图书馆。 他们是不相容的。

gcc 校准,arm-linux-gcc 连接中链路。

即便是头盔,这只是简单的文字,也可能是一样的,因为不同的处理器对终端式、数据尺寸等都有不同的配置。

<><>>>>>

您在汇编其样本申请之前,必须安装您的“ > 全面填写。

After this, you will end up having a appweb/appweb.h and -lappweb reachable by your toolchain.

Please tell us if you need help on how to cross-compile AppWeb. It must be a README in the sources telling how to do that.





相关问题
gcc -fPIC seems to muck with optimization flags

Following along from this question: how-do-i-check-if-gcc-is-performing-tail-recursion-optimization, I noticed that using gcc with -fPIC seems to destroy this optimization. I am creating a shared ...

Generate assembler code from C file in linux

I would like to know how to generate assembler code from a C program using Unix. I tried the gcc: gcc -c file.c I also used firstly cpp and then try as but I m getting errors. I m trying to build an ...

Getting rid of pre-compiled headers

OK, I have old Metrowerks code for Mac and Windows where the previous developer used pre-compiled headers for every project that this code base builds. How does one get rid of Pre-compiled headers, ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

How to compile for Mac OS X 10.5

I d like to compile my application for version 10.5 and forward. Ever since I upgraded to Snow Leopard and installed the latest XCode, gcc defaults to 10.6. I ve tried -isysroot /Developer/SDKs/...