Why error in cross compiling Arm Linux GCC?

Up vote 2 down vote favorite share g+ share fb share tw.

I'm trying to use AppWeb, and I wrote a very simple program to embed AppWeb into my application, it's using a function in AppWeb library. #include int main(int argc, char** argv) { return maRunWebServer("appweb. Conf"); } I don't 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 and i'm sure that the library "libappweb.

So" was exist in my folder "lib" Someone may tell me, why it got error? And give me some advice? Thanks, gcc arm cross-compiling embedded-linux toolchain link|improve this question edited Jan 16 at 8:43 asked Jan 16 at 8:32TidusLe113.

– Basile Starynkevitch Jan 16 at 8:34 Error in question: No error provided. – leppie Jan 16 at 8:36 ah, im sorry about that :D I added my error into my post ^^ – TidusLe Jan 16 at 8:41.

The error you are getting is due to the fact that the compiler (gcc) can find the files you wanted to include. Simplest solution would be to change the FLAG in your Makefile: FLAG = -lappweb -lmpr to FLAG = -lappweb -lmpr -I/path/to/my/headers Of course you must change /path/to/my/headers to the true path where your headers reside.

Thanks for your answer, I solved my problem :) – TidusLe Jan 17 at 4:51.

You have to install (or symbolically link) the appweb header into the arm-linux-gcc include tree. For example, the arm-linux-gcc command for one of my systems is $ which arm-linux-gcc /home/eldk/usr/bin/arm-linux-gcc So the include files that compiler uses are: $ 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.

You have two concerns: Your include search path (as already pointed by sessyargc. Jp and wallyk). Your library search path.

When you compile using gcc, it will use your gcc configurations to find out headers and libraries inside its own toolchain. It will default to something like "/usr/include" and "/usr/lib". When you are compiling with arm-linux-gcc, as done before by gcc, it will use your arm-linux-gcc configurations to find out headers and libraries inside its own toolchain.

It can be anywhere, depending on your toolchain (i.e. "/home/eldk/usr/lib/gcc/arm-linux-gnueabi/4.2.2/..." for wallyk's). Note that you have two different toolchains, and each one has its own files.

You cannot link a library built for "x86" into an ARM binary. They are incompatible! Gcc links gcc libs, arm-linux-gcc links arm-linux-gcc libs.

Even the headers, that only plain text, can't be the same, as different processors can have different configurations for endiannes, data sizes, etc. SO You must install your AppWeb cross-compiled for ARM before getting to compile your sample application. 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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions