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

Re: Cross compiling rpm packages


fray@mvista.com a écrit:

Johann Gunnar Oskarsson wrote:

Let me be a little more specific. What I'm trying to do is to cross build a package that is my own. I have successfully set up a cross compiler and it cross compiles beautilfully with './configure --host=mipsEEel-linux'.

When I try to cross build with rpm there are a few problems:
1a) For some reason rpmbuild is braindamaged as it changes '--target mipsEEel-linux' into 'mipseeel-linux' and I have no tool called 'mipseeel-linux-gcc'. (This is probably some macro stuff that can hopefully be changed)

You need to learn to use all of the features of autoconf/configure/rpm. Specifically you need target specific macros. Your target specific macros need a way to tell your system WHAT the compiler, linker, assembler, etc are on your system..

Why, as the configure script has already figured it out? If I can pass a usable %{_target} macro to it.

1b) I have set up an alias so './configure --host=ee' works. EE is short for the Emotion Engine. But rpmbuild is still braindamaged as it now appends '-linux' to the 'ee' and again I have no tool called 'ee-linux-gcc'. I have 'ee-gcc'. (This is hopefully another macro that can be changed)

YOU need to set CC=, AS=, LD=, etc.. Easiest way is based on target macros.

No I don't as the configure script does that for me. What I need to do is to tell rpm not to append '-linux' to the target 'ee'. How do I do that? Or tell it not to put 'mipsEEel' into small caps? How do I do that? T.i. %{_target} becomes 'mipseeel', which is not what I want, having case sensitive filesystem.

2) I'm not really sure how to deal with target specifications inside the spec file. There seem to be no docs describing how to deal with cross builds in them. And downloading a whole distro to find examples that I may or may not be able to use is not my idea of something helpful. But this is something I can probably figure out as soon as problem 1a) or 1b) is solved.

Examples are as helpful as I'll be able to get.. it took my company almost 2 full years to figure out how to do this efficiently.. it's definatly not something I can describe in 10 minutes.. If you can look at examples you should be able to figure it out. This is NOT a trivial exercise.. The "easy" way is to setup simple macros based on the target type.. and then use those simple macros to provide configure with appropriate overrides.

Granted, but I have to solve 1a) og 1b) first, so far I've had no specific answer as to that. Which I don't think is very difficult, I just don't know much about rpm macros yet :(

3) How to I automarically create rpm packages for two (or more) different platforms when I build a package. There has to be someone that uses some technique to build i386 and i686 packages (for example) with the same build instruction?

My understanding is that you can only build one target type at a time.. os if you want both i386 and i686 you will need to perform the build twice.

Of course I can only build one target at a time, but I want to set it up so that when I build the rpm packages all platforms get builtt (i686 and mipsEEel), sequentially. I realize I may have to set up a shell script to do this, but it would be nice if rpm figured it out by itself :)

4) And finally, I need to know if and how I can tell wheter I'm doing a cross compile (for the EE for example) or building on the target in question.

You need good macros to help you. What we do is have a "host type" macro and a "target type" macro and see if they are equal. If they are we're local.. if they're not it's cross.. In reality of our 200+ packages we probably only use that check 2 or 3 times.. It really shouldn't be necessary.

This really isn't such a problem as the configure script is smart enaugh, not to cross compile when I specify '--host=i686-pc-linux-gnu' (I mean try to cross compile for the local system, e.g. calling i686-pc-linux-gcc or something.) Can you be a little more specific about which package is a nice example?



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