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

Re: Cross compiling rpm packages

Johann Gunnar Oskarsson wrote:

fray@mvista.com a écrit:

Johann Gunnar Oskarsson wrote:

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.

The --target=<name> rarely maps when doing this type of cross compilation to what you want. In your first email you explained the difficulties you had with that. Specifically we only use _target to pick the proper macros to use and that is 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.

Thats the point. If your configure don't match the expected tool names.. then you have to do it yourself. Besides, it's a very good safely messure to set them manually.

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 :(

The built in RPM macros are not designed for this. That is why I strongly recommend you create your own custom macros to solve the problems you are experiencing.

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?

I've never seen a configure script that was "smart enough" to pick the "right" compiler based on the passed in --target or --host. In my experience if you try to do that you will have errors. Set them manually, it's much safer and much more "repeatable".


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