[Clfs-support] How do I keep configure scripts from looking at my BUILD system when cross compiling?

Joe Ciccone jciccone at gmail.com
Thu Nov 13 15:39:51 PST 2008


Jon Dufresne wrote:
> Hi,
>
> I am trying to configure programs for a cross compile. I've been
> following the cross-lfs as a guide to get me on my way but I diverge
> from it when I want a more custom setup. One aspect of my project that
> I would like to keep is to have all development files on the build
> system only. In the end I want the target system to only have binaries
> that were compiled by the build system's cross compiler using gcc's
> sysroot.
>
> One issue I am having is that during the autotools configure stage of
> most packages, the configure script will make judgments based on my
> build system's environment rather than my target system's environment.
> For example, I am trying to compile directfb-1.0.0 which uses gnu
> autotools and I see the following during configure.
>
> ./configure --build=${HOST} --host=${TARGET} 	--prefix=/usr
> ...
> ...
> checking for sdl-config... /usr/bin/sdl-config
>
>
> Now, I know I haven't installed SDL on my target system and I know I
> have SDL on my build system, and I can see the sdl-config file that
> configure picks up. So now the configure script is making decisions
> based on my build system rather than my target system.
>
> Any idea how to resolve this?
>
>   
Actually Yes, I wrote a program about 2 years ago to tackle this.
http://cross-lfs.org/~jciccone/sysroot_warpper.c

Compile it with the following command:
gcc sysroot_wrapper.c -o $CLFS/cross-tools/bin/sysroot_wrapper

You use it much the same way as the multiarch_wrapper in multilib.

Using sdl-config as an example and assuming $CLFS is set.

ln -sfv ${CLFS}/usr/bin/sdl-config
${CLFS}/cross-tools/bin/sdl-config.sysroot
ln -sfv sysroot_wrapper ${CLFS}/cross-tools/bin/sdl-config

Then whenever you execute cross-tools/bin/sdl-config it will execute the
real sdl-config and fix the output.

There are two things you have todo with pkg-config. Compile a native
version with
--prefix=${CLFS}/cross-tools
--with-pc-path="${CLFS}/usr/lib/pkgconfig:${CLFS}/usr/share/pkgconfig"

Then link it to the sysroot wrapper almost the same way as sdl-config.
ln -sfv ${CLFS}/cross-tools/bin/pkg-config{,.sysroot}
ln -sfv sysroot_wrapper ${CLFS}/cross-tools/bin/pkg-config

If I get the chance this weekend I'll retrofit the sysroot book with a
updated toolchain and add some extra pages that go into building xorg as
well as some other packages.

I hope this helps.

Joe



More information about the Clfs-support mailing list