Mailinglist Archive: opensuse-buildservice (162 mails)

< Previous Next >
[opensuse-buildservice] [RFC] transparent cross compiliation support for OBS
Hi,

we currently plan to enable OBS with an additional cross-compilation feature.
Which is referred in the "Build Service Concept CrossDevelopment" [1] as Type 3:
"[...] the build system is modified so original source and binary packages can
be build and used in a repository ".

So instead of using QEMU to emulate a different architecture completely, we
want to make use of cross-compilation using the host toolchain.

Later: for executing tests or other "target"-binaries during the
%build/%install/%check there will be still the need to use QEMU - which
would be then a mix of Type 3 and Type 4.


We have not started yet any coding, just have done some rough concepts
and wanted to make our planned effort public to involve the community in
the design, to make sure everyone is happy with that effort and useful not
only for us.


Goal: transparent cross compilation
====================================

The idea of "transparent cross compilation" to get the same spec file
working for one architecture also building for an architecture which needs to
get
cross-compiled, but without using QEMU for compilation.

To get this working the idea is to use common packaging macros like
%configure to apply the right parameters if the build is a "transparent
cross-compile" build. One alternative would be to make heavy use of rpm
conditionals on your own if you are not happy with using pre-defined
macros like %configure.



inside obs-build
================


We briefly checked some cross-compile helper tools/frameworks and efforts
like scratchbox or this project [2]:


Several tools available to "fake" a native build environment through
emulation and replace core components (like the compiler) through native
binaries to speed up the build. The idea in [2] instead tries to inject
relevant modifications into rpmbuild to cause rpm to do a "traditional" real
cross build.



Later one comes quite close to what we could thing have could be done
inside obs-build to perform the transparent cross-compilation:

- perform a regular host (e.g. x86) build environment including
preinstall/install
- including the required toolchain to perform cross-compilation (and later for
type 3-4 mix: qemu and binfmt register scripts)
- setup a separated target root ("sysroot") - e.g.
/opt/cross/%_target_platform/sysroot
* create new separated RPM database for target platform
* use the sysroot as rpm root
- install buildrequires of the target repo inside the sysroot
* packages like gcc, gcc-c++, ... needs to be substitued so those get
installed
in the host environment (not in the target environment)
- define/redefine additionally requird rpm macros for the cross-compile build
- run rpmbuild with buildroot, root, target, ... parameter inside the sysroot
* inside: lots of details which need to be defined later
* host toolchain get used where possible
- move build results from the target sysroot to the "right" location so they
can be picked up extractbuild (if VM worker)



obs-build would have to be changed to handle additional to the host
repository (to setup the changeroot/VM worker) an additional repository for
the target buildrequires.


Is this approach inside obs-build reasonable for transparent cross-
compilation support?
Looking forward to your feedback.


[1]
http://en.opensuse.org/openSUSE:Build_Service_Concept_CrossDevelopment#Types_of_crossbuild
[2] http://wiki.qt-project.org/QtonPi/Contribute#Cross-build_tools


Best Regards,
Daniel

--
Daniel Gollub
Linux Consultant & Developer
Tel.: +49-160 47 73 970
Mail: gollub@xxxxxxxxxxxxx

B1 Systems GmbH
Osterfeldstra├če 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
< Previous Next >
Follow Ups