1

I have already created the amhello-1.0.tar.gz using this tutorial click to open

now am trying to make cross compiling but error occurs. i am following this tutorial click to open

after entering make command error occurs

hp@ubuntu:~/amhello-1.0$ make
make  all-recursive
make[1]: Entering directory `/home/hp/amhello-1.0'
Making all in src
make[2]: Entering directory `/home/hp/amhello-1.0/src'
i586-mingw32msvc-gcc  -g -O2   -o hello.exe main.o  
main.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make[2]: *** [hello.exe] Error 1
make[2]: Leaving directory `/home/hp/amhello-1.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/hp/amhello-1.0'
make: *** [all] Error 2
0

It looks like you are re-using the same build directory for the cross-compile that you used for the original native build. The 'make' program doesn't know that you've changed toolchains, and doesn't consider the object file (main.o) to be out of date - so it doesn't try to recompile it, it just jumps straight to the link step - which fails because it's trying to link a native ELF object with foreign (mingw) libraries.

Try executing a make clean or rm src/*.o before the make to force full recompilation.

| improve this answer | |
  • i spent 3 days to figure out how to cross-compile and atlast after lots and lots of searching on google i found a tutorial but then got stuck on this error. thanks alot :) – osama Dec 29 '13 at 3:30
  • i want to ask one more thing . can i do the same procedure for gtk+2 c codes???? – osama Dec 29 '13 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.