Cross-compilers.

David Woodhouse dwmw2 at infradead.org
Mon Sep 18 08:56:56 UTC 2006


On Mon, 2006-09-18 at 10:23 +0200, Ralf Corsepius wrote:
> Well, I'd estimate 90% of all lib* packages do work OTB.

Either things have got a _lot_ better since I was doing this, or you've
been a lot luckier than I was.

> It's the packages' authors who ship broken configurations, because they
> hard-code stupid things like run-time checks or hard-coding
> compiler/system features (byte-order, type-sizes etc.).

Yes. Autotools seems to encourage this behaviour, rather than just
encouraging people to write sane portable code in the first place.

For example, why do runtime checks for word-size when you can just use
explicitly sized C99 types if you actually care? But autotools makes it
easy... and suddenly your package no longer compiles.

Maybe autotools wouldn't be so bad if it was made much harder to do
stupid things.

> > > Few packages do support mixed native/cross compilation and even less do
> > > support multi-target configurations.
> > > 
> > > > Packages in _general_ won't cross-compile.
> > > Yes, because many packagers don't test it and because rpm doesn't
> > > support it.
> > 
> > I've spent a lot of time attempting to cross-build the distribution.
> > RPM actually handles it just fine -- the problems were mostly caused by
> > the (possibly incorrect) use of autotools in the package itself.
> 
> Well, this is NOT my experience.
> 
> RPM doesn't even get the target/host/build-tuple right for native noarch
> building.

You mean in %configure? I don't recall it screwing that up, but again I
haven't tried this recently. If it broke, file a bug. I suspect it's a
problem with redhat-rpm-config instead of rpm itself.

> Building cross-compilers (Note: These are native apps!) is PITA, because
> RPM doesn't handle foreign binaries correctly (stripping, debug info
> etc. all are treated as <native>-elf).

I have a vague recollection of overriding %strip. But binutils-multi
would also help with this.

> Cross building (rpmbuild --target= ...) isn't even close to be be
> functional, because rpm screws up various target/host/build platforms
> setting (e.g. %rpmopt), and doesn't properly distinguish between
> target/host/build and contain many hard-coded redhat specifics (We are
> cross building cross-toolchain rpms to mingw, cygwin and solaris).

I haven't looked at cross-building to non-Linux RPMs. I can well believe
that it's more problematic, but certainly I've had reasonable success
with cross-building _Linux_ RPMs. As I said, the majority of failures I
saw were with autotools being used to do the wrong thing. Not really
with RPM itself.

-- 
dwmw2




More information about the fedora-devel-list mailing list