Re: [Rpm-maint] Problems using RPM to build cross-compiled (MinGW/Windows) packages

2008-08-11 Thread Ralf Corsepius
On Mon, 2008-08-04 at 14:58 +0100, Richard W.M. Jones wrote:
 On Mon, Aug 04, 2008 at 07:56:31AM -0500, Mark Hatle wrote:
  You will want to probably define _strip as true or provide a custom  
  __os_install_post.  This is a necessity if you are creating a cross  
  compiler with binaries for another architecture.
 
 I maybe should have said that I'm aware of the workarounds used to
 modify __os_install_post and was just wondering if we could get
 something in base RPM instead, but ...
Well, IMO the only applicable approach is to tighten the paths rpm's
scripts are searching (or to add some parameter to them).

  For packages compiled to run on a different target the right approach is  
  to provide a macro file that will be autoloaded by rpm using  
  --target=i686-mingw32.  In this file you can specify all of the things  
  that a target package uses to compile, strip, etc.
 
 ... I didn't know you could do this, and it looks like a better
 approach to try.
This won't help.

rpm's --target causes rpm to build rpms for a different rpm-platform (in
your case: rpms which are supposed to be installed on mingw).

Your problem however is rpm (and __os_install_post, STRIP etc.) not
being able to distinguish and mistreating host and target binaries when
building rpms (in your case: linux-rpms containing mingw binaries). 

This is not related to rpm's --target at all. rpm's target is something
completely different than configure's --build/--host/--target.

Ralf

 

___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] Problems using RPM to build cross-compiled (MinGW/Windows) packages

2008-08-04 Thread Hans de Goede

Richard W.M. Jones wrote:

Hi, I hope this is the right place to raise these issues.

We've recently been trying to build MinGW (a Windows cross-compiler)
plus MinGW packages for Fedora.  This kinda works, but there are
some problems because RPM itself doesn't understand cross-compilation,
or maybe we're just not using RPM right.

The problems we've seen so far:

(1) The default __os_install_post script does a lot of stuff which is
not just irrelevant, but in fact dangerous.  In particular it runs
Linux 'strip' on Windows binaries which corrupts them.  What we'd want
it to do is to run the Windows-aware 'i686-pc-mingw32-strip' (from
mingw-binutils) on Windows binaries/libraries instead.

(2) The default RPM_OPT_FLAGS are wrong in several respects for
cross-compiling.  One big problem is that they include '-m32' or
'-m64' depending on the host architecture (I think).  Our target
architecture is always 32 bit, so using -m64 is always wrong for us.
Also, defaults like -fstack-protector don't work properly on Windows.

(3) Auto-dependency generation doesn't work at all, so we end up with
manual 'Requires:' in the spec files.  I'm not even sure if there is a
naming convention for Windows library deps.

(4) Running configure in a subdirectory is common (ie. mkdir build; cd
build; ../configure).  This doesn't easily let me use %configure
although in the end I found a really gross hack which worked.



I think it would be a good idea for you to take a look at the arm-gp2x-foo 
cross-compile packages which contain workarounds (and nothing more) for all of 
the above.


Regards,

Hans
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] Problems using RPM to build cross-compiled (MinGW/Windows) packages

2008-08-04 Thread Mark Hatle

Richard W.M. Jones wrote:

Hi, I hope this is the right place to raise these issues.

We've recently been trying to build MinGW (a Windows cross-compiler)
plus MinGW packages for Fedora.  This kinda works, but there are
some problems because RPM itself doesn't understand cross-compilation,
or maybe we're just not using RPM right.

The problems we've seen so far:

(1) The default __os_install_post script does a lot of stuff which is
not just irrelevant, but in fact dangerous.  In particular it runs
Linux 'strip' on Windows binaries which corrupts them.  What we'd want
it to do is to run the Windows-aware 'i686-pc-mingw32-strip' (from
mingw-binutils) on Windows binaries/libraries instead.


You will want to probably define _strip as true or provide a custom 
__os_install_post.  This is a necessity if you are creating a cross 
compiler with binaries for another architecture.


For packages compiled to run on a different target the right approach is 
to provide a macro file that will be autoloaded by rpm using 
--target=i686-mingw32.  In this file you can specify all of the things 
that a target package uses to compile, strip, etc.



(2) The default RPM_OPT_FLAGS are wrong in several respects for
cross-compiling.  One big problem is that they include '-m32' or
'-m64' depending on the host architecture (I think).  Our target
architecture is always 32 bit, so using -m64 is always wrong for us.
Also, defaults like -fstack-protector don't work properly on Windows.


Simply don't use the RPM_OPT_FLAGS, or use the --target= approach above.


(3) Auto-dependency generation doesn't work at all, so we end up with
manual 'Requires:' in the spec files.  I'm not even sure if there is a
naming convention for Windows library deps.


Since RPM doesn't have knowledge of anything but ELF, you will need to 
provide a custom dependency generation script (tie it into the above 
target macro file), or add AutoReqProv: no, and manually specify all of 
your dependencies.



(4) Running configure in a subdirectory is common (ie. mkdir build; cd
build; ../configure).  This doesn't easily let me use %configure
although in the end I found a really gross hack which worked.


Don't use %configure then.  Nothing forces you to use it, it's just 
there for convenience.  It's not going to work in all circumstances.


(All of the packages I've worked on for the last 8 years or so have been 
cross compiled.. usually linux - linux but the approaches are the same 
no matter what the target.)


--Mark


If you want to see some of our work, including example specfiles, then
take a look at (or 'hg clone'):
  http://hg.et.redhat.com/misc/fedora-mingw--devel/
Please read the README file first since it explains the order in which
you have to build the packages.

Rich.



___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] Problems using RPM to build cross-compiled (MinGW/Windows) packages

2008-08-04 Thread Richard W.M. Jones
On Mon, Aug 04, 2008 at 07:56:31AM -0500, Mark Hatle wrote:
 You will want to probably define _strip as true or provide a custom  
 __os_install_post.  This is a necessity if you are creating a cross  
 compiler with binaries for another architecture.

I maybe should have said that I'm aware of the workarounds used to
modify __os_install_post and was just wondering if we could get
something in base RPM instead, but ...

 For packages compiled to run on a different target the right approach is  
 to provide a macro file that will be autoloaded by rpm using  
 --target=i686-mingw32.  In this file you can specify all of the things  
 that a target package uses to compile, strip, etc.

... I didn't know you could do this, and it looks like a better
approach to try.

Thanks everyone,

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint