Cross-compiling with 4.1 ?

Christophe Vu-Brugier cvubrugier at lacie.com
Wed Oct 9 01:34:58 MDT 2013


Dear Andrew Bartlett,

On Wed, 09 Oct 2013 16:10:50 +1300, Andrew Bartlett wrote :
> On Mon, 2013-09-02 at 11:19 +0200, Christophe Vu-Brugier wrote:
>
> [snip]
>
> > Two months ago, I tried to cross compile samba 4.0.7 and it did not
> > work. I looked a little bit why Samba 4 did not cross-compile but did
> > not manage to make it build fully. Here is what I saw:
> > 
> >  * some programs are built for the target whereas they are expected to
> >    be built for the host. This is the case for some heimdal binaries.
> 
> Exactly which binaries are wrong, and are there examples of others that
> are right that we could use as an example to fix this?

Some binaries are built with use_hostcc=True, for instance in
source4/heimdal_build. These binaries are "asn1_compile" and
"compile_et". Unfortunately, setting use_hostcc to True does nothing
because the logic to use the host compiler is missing from Samba's
buildtools.

 
> >  * in buildtools/wafadmin/Tools/python.py, I think that the
> >    PYTHONXCPREFIX variable should be used if the user defines it. This
> >    is necessary in order to build python packages for the target.
> > 
> > There are probably other errors occuring when cross-compiling Samba 4.
> > The errors I mention are just the first that I encountered.
> > 
> > 
> > > I know there are several
> > > OEMs who absolutely depend on this to
> > > create working file server builds.
> > 
> > My employer (LaCie) is such an OEM. We are sticking with Samba 3.6
> > because of the cross-compilation issues of Samba 4.0.
> > 
> > I am a bit busy at the moment, but I will try to cross-compile the
> > latest version of Samba, look more deeply at the errors and come up with
> > patches. I think the first step is to open a bug report.
> 
> Did you get anywhere with patches?

Not really, I have some ugly patches that allow me to pass the
configure step, but the build is still failing. However, I have
gathered more information about what prevents Samba 4.1 from being
cross compiled.

1/ Python. Samba is looking for the system python libraries and
   headers. We need to add a way to specify an alternative python
   path to a cross-compiled version of python.
   For that, we can get inspiration from distutils-cross

   https://bitbucket.org/lambacck/distutilscross/src

2/ C includes. The build passes -I/usr/include -I/usr/local/include to
   gcc. However, passing host system headers is wrong when
   cross-compiling. Moreover, I think there is no need to do that
   because if you are building for the host, the compiler looks for
   headers in /usr/include and /usr/local/include (see `cpp -v`).

3/ Host tools that are built for the target which I mentioned above.

Best regards,

-- 
Christophe Vu-Brugier


More information about the samba-technical mailing list