LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   cross compiling libJudy (https://www.linuxquestions.org/questions/linux-software-2/cross-compiling-libjudy-608455/)

fastTalker 12-21-2007 07:25 PM

cross compiling libJudy
 
I am attempting to cross compile libJudy for the avr32 processor

i am using the following to configure the makefile:
Code:

./configure --host=avr32-linux --prefix=/usr/avr32-linux --build=i686-pc-linux-gnu
configure completes successfully, but when i attempt to make i get the following error:
Code:

# make
make  all-recursive
make[1]: Entering directory `/tmp/Judy-1.0.4'
Making all in src
make[2]: Entering directory `/tmp/Judy-1.0.4/src'
Making all in .
make[3]: Entering directory `/tmp/Judy-1.0.4/src'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/tmp/Judy-1.0.4/src'
Making all in JudyCommon
make[3]: Entering directory `/tmp/Judy-1.0.4/src/JudyCommon'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/tmp/Judy-1.0.4/src/JudyCommon'
Making all in JudyL
make[3]: Entering directory `/tmp/Judy-1.0.4/src/JudyL'
avr32-linux-gcc -I. -I.. -I../JudyCommon/  -DJUDYL  -UJU_64BIT -g -O2 -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
/bin/sh: ./JudyLTablesGen: cannot execute binary file
make[3]: *** [JudyLTables.c] Error 126
make[3]: Leaving directory `/tmp/Judy-1.0.4/src/JudyL'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/Judy-1.0.4/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/Judy-1.0.4'
make: *** [all] Error 2

it is compiling JudyLTablesGen for the avr32 and then trying to execute it on the build system (i686). this obviously will not work and kind of defeats the point of cross compiling.

Is this a flaw in the makefile or am i running configure incorrectly?

fastTalker 12-21-2007 08:58 PM

Quote:

Originally Posted by fastTalker (Post 2998509)
it is compiling JudyLTablesGen for the avr32 and then trying to execute it on the build system (i686). this obviously will not work and kind of defeats the point of cross compiling.

Is this a flaw in the makefile or am i running configure incorrectly?

it might be the makefile. JudyLTablesGen appears to only be generating other c files for compilation. (i think. i haven't looked too closely at it. it could be doing more.)

but anyway, i changed the following line in the makefile from:
Code:

$(CC) $(INCLUDES) $(AM_CFLAGS) -UJU_64BIT -g -O2 -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
to:
Code:

gcc $(INCLUDES) $(AM_CFLAGS) -UJU_64BIT -g -O2 -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
CC is set to the avr32 compiler (the host compiler), not the build compiler (i686).

I also changed the same thing in one of the other Makefiles that had the same problem with Judy1TablesGen.

make and make install completed successfully and the program that is using libJudy successfully linked against the library. unfortunately, i do not actually have the processor with me to test it on. :( So it may have only appeared to fix it. i will post when i found out for sure (in case someone else ever runs across this same problem.)

dwhitney67 12-22-2007 09:58 PM

I have no experience with libJudy, much less ever heard of it, and my knowledge with cross-compiling is also not that proficient.

However, if you are trying to cross-compile source code to work on a difference architecture than your host's i686, then you will need the appropriate cross-compiler... and in your case, one for the avr32 processor.

It seems that you have this cross-compiler, therefore I think the issue you are having is with the Makefile. It should not attempt to run the cross-compiled application on your i686. It won't work.

If you compile with the host's gcc compiler, then the application will not run on the avr32.

Cross-compiling is a tricky "game", in which you need to ensure that you have the proper C (and if necessary C++) libraries for the target system, including header files.

fastTalker 12-24-2007 03:51 PM

Thanks for the reply.

Quote:

Originally Posted by dwhitney67 (Post 2999346)
It seems that you have this cross-compiler, therefore I think the issue you are having is with the Makefile. It should not attempt to run the cross-compiled application on your i686. It won't work.

If you compile with the host's gcc compiler, then the application will not run on the avr32.

Cross-compiling is a tricky "game", in which you need to ensure that you have the proper C (and if necessary C++) libraries for the target system, including header files.

I've cross-compiled the pcap library for the avr32 and compiled programs against it so I know the cross compiler works.

The more I looked at it the more it seemed that it is the Makefile.

I really wanted to insure that i am using the correct options with the configure script.

thanks.


All times are GMT -5. The time now is 01:48 AM.