LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   cross compilation (https://www.linuxquestions.org/questions/programming-9/cross-compilation-509331/)

NeoMagic 12-11-2006 05:00 AM

cross compilation
 
hi all

Most of us r aware of the "./configure" while building some apps from soure. While configure is running i observed that it buidls a 'sample code'
with the configuration found and tries to run it succesfully, before it goes for further configuration.

The problem is , if we r cross compiling, it may run the target code on the host(i686) and complains -"cannot run test program while crosscompiling".

I started off with - "./configure --host=arm-linux" and stuck here. By the way the package iam compiling is gstreamer.


Thanks & Regards,
Neo

gnashley 12-11-2006 06:38 AM

Usually there's an option in configure for --disable-gtktest or similar which will disable compiling of test programms. Try ./configure --help to see what's available.

NeoMagic 12-11-2006 11:04 PM

its a generic problem
 
no, iam not talking of compilation of test programs of gstreamer.
configure generates a temparory file to check everything is ok with its assumptions. The stated problem is a generic one for any package which uses './configure' for build.

gnashley 12-12-2006 02:22 AM

That's exactly what I mean, except it's not a generic autoconf feature. But many packages include such options for disabling tests.
If you would do as I suggested you'll see that the gstreamer sources have 2 of them --disable-tests and --disable-failing-tests ( an obvious clue that your problem is a common one). I mentioned --disbale-gtktest because it is very commonly seen in gtk-based apps. --disable-tests is also seen a lot, but it is not a standard autoconf thing.
'arm-linux' may not be the correct syntax for the host system. You may need to help configure by specifying the target as well.

NeoMagic 12-12-2006 11:31 PM

configure: error: cannot run test program while cross compiling
 
i tried those disable flags. but still iget :
configure: error: cannot run test program while cross compiling

Iam pasting my complete log here for reference :

./configure --host=arm-linux --disable-tests --disable-failing-tests --disable-gtktest
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking target system type... arm-unknown-linux-gnu
configure: configuring gstreamer for release
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for arm-linux-strip... arm-linux-strip
checking for arm-linux-gcc... arm-linux-gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gcc accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of arm-linux-gcc... gcc3
checking for strerror in -lcposix... no
checking for ld used by GCC... /home/bayyavs/tools-2.4.25/arm-linux-uclibc/bin/ld
checking if the linker (/home/bayyavs/tools-2.4.25/arm-linux-uclibc/bin/ld) is GNU ld... yes
checking for /home/bayyavs/tools-2.4.25/arm-linux-uclibc/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /home/bayyavs/tools-2.4.25/bin/arm-linux-nm -B
checking whether ln -s works... yes
checking how to recognise dependant libraries... file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )
checking command to parse /home/bayyavs/tools-2.4.25/bin/arm-linux-nm -B output... ok
checking how to run the C preprocessor... arm-linux-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for arm-linux-file... no
checking for file... /usr/bin/file
checking for arm-linux-ranlib... arm-linux-ranlib
checking for arm-linux-strip... (cached) arm-linux-strip
checking for objdir... .libs
checking for arm-linux-gcc option to produce PIC... -fPIC
checking if arm-linux-gcc PIC flag -fPIC works... yes
checking if arm-linux-gcc static flag -static works... yes
checking if arm-linux-gcc supports -c -o file.o... yes
checking if arm-linux-gcc supports -c -o file.lo... yes
checking if arm-linux-gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/home/bayyavs/tools-2.4.25/arm-linux-uclibc/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether -lc should be explicitly linked in... no
creating libtool
checking for arm-linux-gcc option to accept ANSI C... none needed
checking for compiler flavour... configure: error: cannot run test program while cross compiling


So as u see from last line, i still cant stop it from testing.

gnashley 12-13-2006 02:19 AM

You may have to modify the configure.ac or configure.in file and delete the check which is causing problems. Cross compiling with autoconf is pretty tricky and usually needs some tweaking of the config files or makefiles to work.


All times are GMT -5. The time now is 11:54 PM.