Re: Fedora and Cross Compiling

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

 



Ralf Corsepius wrote:
On Fri, 2007-06-15 at 08:25 +0100, Andy Green wrote:
Ralf Corsepius wrote:

When cross building you need to pull in a mixture of native (host-arch) and cross (target arch) packages to meet the build dependencies. This is part of where the "fun" is.
Well, I question the "need", but consider this kind of implementation to
be "an option".
It can be necessary though, for example if the package build wants yacc
or bison or whatever to build, with cross building they are going to be
host yacc and bison despite you are building for a different target arch
If I understand you correctly the problem you are referring to is separating "tools being used at build-time on the host" from "tools being used at run-time on the target".
(Classic situation: building inserts hard-coded directories/paths
referring to files on the build-host into target-files)
No the issue I (and Brendan I believe) am talking about is,
"BuildRequires... required where?".  Consider

BuildRequires: yacc libblah-devel
Understood.

rpmbuild should go and confirm that the packages mentioned here are
installed before doing the build.
Hmm, difficult.

The problem is actually a bit worse than that. bison and flex are actually required for the host *and* target. You need the host version for the actual bison/flex executable and you need the target version for the static library both typically include.

I used to be part of Brendan's group. Here's how we solved this problem in the past (they might have changed things since I last looked).

Assume a package that originally has the following line for native compiles:

BuildPrereq: autoconf, bison, flex, libblah-devel, sed

For cross compiles we change it to look like this:

%if "%{_arch}" == %{_build_arch}
BuildPrereq: autoconf, bison, flex, libblah-devel, sed
%else
BuildPrereq: bison, flex, libblah-devel
%endif%

Note that we leave things so that native compiles still work. We then check native dependencies (_arch == _build_arch) against our mock chroot's native rpm database, then check cross dependencies (_arch != _build_arch) against the mock chroot's target rpm database.

Target versions of autoconf and sed aren't needed since nothing links against anything in those packages (those packages are only run natively). The only problem with this scheme is that we end up with an extra native dependency of libblah-devel (which really isn't needed since nothing links against it in the cross compile). But the benefit of unaffected native compiles outweighed the extra dependency.

--
David Smith
dsmith@xxxxxxxxxx
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux