ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] Using host's programs when building packages


From: Stuart Hughes
Subject: Re: [Ltib] Using host's programs when building packages
Date: Thu, 03 Apr 2008 08:44:12 +0100

Hi Phillipe,

The real issue here is whether the package you're building is cross
compiler aware, it looks like it is not.

In cases like this, as you said, you'll need to do something to work
around this.  What you need to do depends on the package.

If ../gobject/generate-constants is only used for creating constants.py
but is not actually going into the package payload for the target, then
the "right thing" to do is to build 'generate-constants' using the build
machine's gcc.  If the package is cross compiler aware it may have an
option you can pass to either configure or make to control this.  Often
this is passing  HOSTCC="$BUILDCC" to make.  If not, then you can either
manually run the commands from the specfile to locally create a build
machine based version of this.

If generate-constants is also needed as part of the package for the
target, then you'll have to build it twice, once of the build machine
(as above) and then let it build normally for the target.

BTW: in LTIB if you ever need to completely disable spoofing, you can do
this by setting:
    export PATH=$UNSPOOF_PATH
you can switch back using:
    export PATH=$SPOOF_PATH

Generally speaking though it's better to use the environment variable
"$BUILDCC" to refer to the build machine's gcc.

Regards, Stuart

On Wed, 2008-04-02 at 18:39 +0200, Philippe Normand wrote:
> Hi again!
> 
> I'm now building PyGobject. During the build a program is compiled and
> executed to generate a Python file:
> 
> gcc -g -O2 -Wall -fno-strict-aliasing -std=c9x -o generate-constants
> generate_constants-generate-constants.o   
> arm-none-linux-gnueabi-gcc
> -B /home/phil/mx31/ltib-imx31ads-20071008/rootfs/usr/lib//
> -idirafter /home/phil/mx31/ltib-imx31ads-20071008/rootfs/usr/include
> -iwithprefix include
> -Wl,-rpath-link,/home/phil/mx31/ltib-imx31ads-20071008/rootfs/lib:/home/phil/mx31/ltib-imx31ads-20071008/rootfs/usr/lib
>  -O2 -fsigned-char -msoft-float -g -O2 -Wall -fno-strict-aliasing -std=c9x -o 
> generate-constants generate_constants-generate-constants.o
> rm -f constants.py
> cp ./constants.py.in constants.py
> chmod 644 constants.py
> ../gobject/generate-constants >> constants.py
> /bin/sh: ../gobject/generate-constants: cannot execute binary file
> make[2]: *** [constants.py] Error 126
> make[2]: Leaving directory
> `/home/phil/mx31/ltib-imx31ads-20071008/rpm/BUILD/pygobject-2.14.1/gobject'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory
> `/home/phil/mx31/ltib-imx31ads-20071008/rpm/BUILD/pygobject-2.14.1'
> make: *** [all] Error 2
> error: Bad exit status
> from /home/phil/mx31/ltib-imx31ads-20071008/tmp/rpm-tmp.55427 (%build)
> 
> 
> Problem is that the program is compiled by the gcc for arm, so it can't
> run on my build machine. Is there a way to avoid the spoofing stuff so
> that /usr/bin/gcc is not spoofed for a specific step of the build?
> 
> One solution could be to manually compile the program to execute for the
> build machine, generate the python file (constants.py), keep it in a
> corner and during the real build, somehow copy it at the right place...
> But I find that a bit too painful :/
> 
> Here is the spec file I wrote:
> 
> %define pfx /opt/freescale/rootfs/%{_target_cpu}
> 
> Summary         : GObject python bindings
> Name            : pygobject
> Version         : 2.14.1
> Release         : 1
> License         : LGPL
> Vendor          : Freescale
> Packager        : Philippe Normand
> Group           : Development/Languages
> Source          : %{name}-%{version}.tar.gz
> BuildRoot       : %{_tmppath}/%{name}
> Prefix          : %{pfx}
> 
> %Description
> %{summary}
> 
> %Prep
> %setup 
> 
> %Build
> #python2.4 setup.py build --build-base=%{_build}
> PYTHON=python2.4 ./configure --prefix=%{_prefix} --host=$CFGHOST
> --build=%{_build}
> make
> 
> %Install
> rm -rf $RPM_BUILD_ROOT
> make install DESTDIR=$RPM_BUILD_ROOT/%{pfx}
> #python2.4 setup.py install --root=$RPM_BUILD_ROOT/%{pfx}
> 
> %Clean
> rm -rf $RPM_BUILD_ROOT
> #python2.4 setup.py clean
> 
> %Files
> %defattr(-,root,root)
> %{pfx}/*
> 
> 
> Philippe
> 
> 
> 
> _______________________________________________
> LTIB home page: http://bitshrine.org
> 
> Ltib mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/ltib





reply via email to

[Prev in Thread] Current Thread [Next in Thread]