Richard W.M. Jones | 7 Oct 15:32
Favicon

How to package code compiled with 'gcc -m32'?

I've got a nasty program I'm trying to package for Fedora.  To cut a
very long story short, this C/C++ mixed program started out on Windows
and makes lots of 32 bit assumptions.  So it's compiled with 'gcc -m32'.

Expressing the build requirements so it can build on a 64 bit platform
is proving troublesome.  (It builds fine on i386).

First problem is that it uses <gnu/stubs.h> which includes
<gnu/stubs-[WORDSIZE].h> (ie. <gnu/stubs-32.h>).  That file isn't in
glibc-devel.x86_64, but only in glibc-devel.i386.

I've expressed that with a file dependency which breaks Fedora
packaging guidelines:

  BuildRequires:  /usr/include/gnu/stubs-32.h

The second and much larger problem is that the code uses wxGTK-devel,
and (because it's being compiled with gcc -m32) it has to have the 32
bit version.

This should work (on x86-64 at least, not ppc64):

  BuildRequires:  wxGTK-devel.i386

but in fact even with the latest version of rpmbuild in Rawhide it
doesn't work.  So I have to write:

  BuildRequires:  wxGTK-devel

which doesn't express the dependency correctly, or:
(Continue reading)

Orion Poplawski | 7 Oct 16:35
Favicon

Re: How to package code compiled with 'gcc -m32'?

Richard W.M. Jones wrote:
> I've expressed that with a file dependency which breaks Fedora
> packaging guidelines:
> 
>   BuildRequires:  /usr/include/gnu/stubs-32.h

Don't know about guidelines, but:

mknbi/mknbi.spec:BuildRequires: /usr/include/gnu/stubs-32.h
nbd/nbd.spec:BuildRequires:  /usr/include/gnu/stubs-32.h
syslinux/syslinux.spec:BuildRequires: /usr/include/gnu/stubs-32.h
xenner/xenner.spec:BuildRequires: /usr/include/gnu/stubs-32.h
xen/xen.spec:BuildRequires: /usr/include/gnu/stubs-32.h

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion <at> cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Toshio Kuratomi | 7 Oct 17:12

Re: How to package code compiled with 'gcc -m32'?

Orion Poplawski wrote:
> Richard W.M. Jones wrote:
>> I've expressed that with a file dependency which breaks Fedora
>> packaging guidelines:
>>
>>   BuildRequires:  /usr/include/gnu/stubs-32.h
> 
Note: The particular Guideline is a SHOULD rather than MUST.  It also
applies to Requires, rather than BuildRequires, although that might not
be so obvious.  The intention as stated in the Guideline is to save
end-user time by allowing the depsolver to skip downloading of the large
filelists metadata file.

-Toshio

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
Paul Howarth | 7 Oct 17:23
Favicon

Re: How to package code compiled with 'gcc -m32'?

Toshio Kuratomi wrote:
> Orion Poplawski wrote:
>> Richard W.M. Jones wrote:
>>> I've expressed that with a file dependency which breaks Fedora
>>> packaging guidelines:
>>>
>>>   BuildRequires:  /usr/include/gnu/stubs-32.h
> Note: The particular Guideline is a SHOULD rather than MUST.  It also
> applies to Requires, rather than BuildRequires, although that might not
> be so obvious.  The intention as stated in the Guideline is to save
> end-user time by allowing the depsolver to skip downloading of the large
> filelists metadata file.

I also had the impression (I may be wrong) that this applied more to 
runtime dependencies than build-time dependencies, for which downloading 
of the file lists is less of an issue.

Paul.

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Toshio Kuratomi | 7 Oct 17:52

Re: How to package code compiled with 'gcc -m32'?

Paul Howarth wrote:
> Toshio Kuratomi wrote:
>> Orion Poplawski wrote:
>>> Richard W.M. Jones wrote:
>>>> I've expressed that with a file dependency which breaks Fedora
>>>> packaging guidelines:
>>>>
>>>>   BuildRequires:  /usr/include/gnu/stubs-32.h
>> Note: The particular Guideline is a SHOULD rather than MUST.  It also
>> applies to Requires, rather than BuildRequires, although that might not
>> be so obvious.  The intention as stated in the Guideline is to save
>> end-user time by allowing the depsolver to skip downloading of the large
>> filelists metadata file.
> 
> I also had the impression (I may be wrong) that this applied more to
> runtime dependencies than build-time dependencies, for which downloading
> of the file lists is less of an issue.
> 
You are correct.

-Toshio

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
Jeremy Katz | 7 Oct 17:12
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Tue, 2008-10-07 at 14:35 +0100, Richard W.M. Jones wrote:
> I've got a nasty program I'm trying to package for Fedora.  To cut a
> very long story short, this C/C++ mixed program started out on Windows
> and makes lots of 32 bit assumptions.  So it's compiled with 'gcc -m32'.
> 
> Expressing the build requirements so it can build on a 64 bit platform
> is proving troublesome.  (It builds fine on i386).

In general, for these situations the right answer is to ExcludeArch and
file the appropriate tracking bugs rather than trying to do 32-bit
builds on a 64-bit arch.  The latter is only done in a few special cases
(bootloaders mainly) which don't have any external deps

Jeremy

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Richard W.M. Jones | 7 Oct 18:56
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Tue, Oct 07, 2008 at 11:12:09AM -0400, Jeremy Katz wrote:
> On Tue, 2008-10-07 at 14:35 +0100, Richard W.M. Jones wrote:
> > I've got a nasty program I'm trying to package for Fedora.  To cut a
> > very long story short, this C/C++ mixed program started out on Windows
> > and makes lots of 32 bit assumptions.  So it's compiled with 'gcc -m32'.
> > 
> > Expressing the build requirements so it can build on a 64 bit platform
> > is proving troublesome.  (It builds fine on i386).
> 
> In general, for these situations the right answer is to ExcludeArch and
> file the appropriate tracking bugs rather than trying to do 32-bit
> builds on a 64-bit arch.  The latter is only done in a few special cases
> (bootloaders mainly) which don't have any external deps

The issues is actually weirder / more complicated than I thought.
(But hey, Windows software, what do you expect :-)

It turns out that it's not just built for 32 bit because of the
general hideousness of the code, but because it builds Windows 32 bit
plugins.  Somehow -- and I've no idea how it does this -- the Windows
plugins get loaded into the native Fedora binary at runtime.  Even
though the main binary is Fedora native, it still has to be built as
32 bit to achieve this minor miracle.

The package is NSIS, in case you were wondering ...

http://hg.et.redhat.com/misc/fedora-mingw--devel/?cmd=manifest;manifest=d9257c5046c7e63b8c00d01528031f14cf6fc319;path=/nsis/

http://www.annexia.org/tmp/mingw/fedora-9/x86_64/RPMS/mingw32-nsis-2.39-3.fc9.x86_64.rpm

(Continue reading)

Jesse Keating | 7 Oct 18:58
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Tue, 2008-10-07 at 17:56 +0100, Richard W.M. Jones wrote:
> I guess if we ExcludeArch we'll still be OK because x86-64 users will
> be able to install and use the i386 version?

Not without having to hardcode this package as "multilib" to make it
show up in the x86_64 repo.  This is something we really really really
don't like doing, as hardcoded crud like this tends to break over time.

-- 
Jesse Keating
Fedora -- Freedom² is a feature!
identi.ca: http://identi.ca/jkeating
--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
Andrew Haley | 7 Oct 19:01
Favicon

Re: How to package code compiled with 'gcc -m32'?

Richard W.M. Jones wrote:
> On Tue, Oct 07, 2008 at 11:12:09AM -0400, Jeremy Katz wrote:
>> On Tue, 2008-10-07 at 14:35 +0100, Richard W.M. Jones wrote:
>>> I've got a nasty program I'm trying to package for Fedora.  To cut a
>>> very long story short, this C/C++ mixed program started out on Windows
>>> and makes lots of 32 bit assumptions.  So it's compiled with 'gcc -m32'.
>>>
>>> Expressing the build requirements so it can build on a 64 bit platform
>>> is proving troublesome.  (It builds fine on i386).
>> In general, for these situations the right answer is to ExcludeArch and
>> file the appropriate tracking bugs rather than trying to do 32-bit
>> builds on a 64-bit arch.  The latter is only done in a few special cases
>> (bootloaders mainly) which don't have any external deps
> 
> The issues is actually weirder / more complicated than I thought.
> (But hey, Windows software, what do you expect :-)
> 
> It turns out that it's not just built for 32 bit because of the
> general hideousness of the code, but because it builds Windows 32 bit
> plugins.  Somehow -- and I've no idea how it does this -- the Windows
> plugins get loaded into the native Fedora binary at runtime.  Even
> though the main binary is Fedora native, it still has to be built as
> 32 bit to achieve this minor miracle.
> 
> The package is NSIS, in case you were wondering ...
> 
> http://hg.et.redhat.com/misc/fedora-mingw--devel/?cmd=manifest;manifest=d9257c5046c7e63b8c00d01528031f14cf6fc319;path=/nsis/
> 
> http://www.annexia.org/tmp/mingw/fedora-9/x86_64/RPMS/mingw32-nsis-2.39-3.fc9.x86_64.rpm
> 
(Continue reading)

Richard W.M. Jones | 7 Oct 20:46
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Tue, Oct 07, 2008 at 06:01:35PM +0100, Andrew Haley wrote:
> Weirder still.  How does zlib get built anyway?

>From source using the MinGW cross-compiler.

  http://fedoraproject.org/wiki/MinGW

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

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Kevin Kofler | 7 Oct 19:40
Favicon

Re: How to package code compiled with 'gcc -m32'?

Richard W.M. Jones <rjones <at> redhat.com> writes:
> It turns out that [NSIS is] not just built for 32 bit because of the
> general hideousness of the code, but because it builds Windows 32 bit
> plugins.  Somehow -- and I've no idea how it does this -- the Windows
> plugins get loaded into the native Fedora binary at runtime.

Those plugins don't actually get loaded into the Fedora binary. They get packed 
into the generated installer image.

> Even though the main binary is Fedora native, it still has to be built as
> 32 bit to achieve this minor miracle.

The Debian folks worked hard on making NSIS build as a true 64-bit binary, not 
with -m32, and as far as I know their patches got merged upstream already.

The W32 plugins need to be built with the MinGW cross-compiler of course, not 
the native compiler, so they aren't affected by this problem at all.

I can have a try at making a proper x86_64 package with the plugins actually 
built from source. What I know is that my hack (packaging the binary plugins 
from the prebuilt ZIP and rebuilding makensis from source as 64-bit) worked.

What's clear is that 32-bit binaries on a 64-bit system are not a solution, you 
have to be very special like WINE to get away with this (and even WINE is not 
built with -m32, it's simply copied from the i386 repo by a multilib whitelist 
entry; fake x86_64 packages with 32-bit stuff in it are a bad idea), NSIS has 
really no valid reason to use 32-bit binaries.

        Kevin Kofler

(Continue reading)

Richard W.M. Jones | 7 Oct 20:51
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Tue, Oct 07, 2008 at 05:40:15PM +0000, Kevin Kofler wrote:
> Richard W.M. Jones <rjones <at> redhat.com> writes:
> > It turns out that [NSIS is] not just built for 32 bit because of the
> > general hideousness of the code, but because it builds Windows 32 bit
> > plugins.  Somehow -- and I've no idea how it does this -- the Windows
> > plugins get loaded into the native Fedora binary at runtime.
> 
> Those plugins don't actually get loaded into the Fedora binary. They get packed 
> into the generated installer image.

Aha ... I'm glad someone knows what's going on here (not me :-)

I thought that the Stubs were copied into the output binary, but the
Plugins got loaded into the executable, but I seem to be wrong about
that.

> > Even though the main binary is Fedora native, it still has to be built as
> > 32 bit to achieve this minor miracle.
>
> The Debian folks worked hard on making NSIS build as a true 64-bit
> binary, not with -m32, and as far as I know their patches got merged
> upstream already.  The W32 plugins need to be built with the MinGW
> cross-compiler of course, not the native compiler, so they aren't
> affected by this problem at all.

I'm actually using Debian's patch, but I rebased them against 2.39.
Debian is on 2.19 for reasons I can't determine, but 2.19 doesn't
build on Fedora (it looked like a gcc error, but I didn't examine it
in great detail, because the newer version builds fine).

(Continue reading)

Richard W.M. Jones | 7 Oct 20:56
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Tue, Oct 07, 2008 at 07:51:27PM +0100, Richard W.M. Jones wrote:
> Please, and if you can supply patches against our repository, 

http://hg.et.redhat.com/misc/fedora-mingw--devel

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 68 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Kevin Kofler | 8 Oct 11:36
Favicon

Re: How to package code compiled with 'gcc -m32'?

Richard W.M. Jones <rjones <at> redhat.com> writes:
> I'm actually using Debian's patch, but I rebased them against 2.39.
> Debian is on 2.19 for reasons I can't determine, but 2.19 doesn't
> build on Fedora (it looked like a gcc error, but I didn't examine it
> in great detail, because the newer version builds fine).

Hmmm, I've looked at the Debian experimental package (which is 2.39 - stable 
works mostly like RHEL, with even stricter policies about version upgrades; 
unstable and experimental are where all their development happens), but they 
now switched to building with -m32 like upstream. :-(

The patch you used, on the other hand, is outdated, it was for a version before 
upstream added the -m32, so it doesn't remove the -m32.

Try the 64bit-fixes patch in:
http://repo.calcforge.org/fedora/9/SRPMS/nsis-2.34-1.src.rpm
I also have a patch there to use the RPM_OPT_FLAGS, which is also important, 
but might need fixing to not try to pass the RPM_OPT_FLAGS to the plugin 
builds. (As I said, I haven't tried actually building the plugins yet.)

        Kevin Kofler

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Richard W.M. Jones | 8 Oct 15:37
Favicon

Re: How to package code compiled with 'gcc -m32'?

On Wed, Oct 08, 2008 at 09:36:44AM +0000, Kevin Kofler wrote:
> Try the 64bit-fixes patch in:
> http://repo.calcforge.org/fedora/9/SRPMS/nsis-2.34-1.src.rpm

That patch builds a 64 bit makensis, which is definitely an
improvement.  However something still wants to link with the 32 bit
wxGTK-devel.i386 library and include <gnu/stubs-32.h>.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 68 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Kevin Kofler | 8 Oct 17:12
Favicon

Re: How to package code compiled with 'gcc -m32'?

Richard W.M. Jones <rjones <at> redhat.com> writes:
> That patch builds a 64 bit makensis, which is definitely an
> improvement.  However something still wants to link with the 32 bit
> wxGTK-devel.i386 library and include <gnu/stubs-32.h>.

That's the menu stuff. I haven't tried building that one yet (it's disabled in 
that SRPM - it's not essential to be able to use NSIS). Presumably there's also 
a -m32 switch somewhere there which also has to be patched out? There may also 
be 64-bit safety issues, I can help you with those. (I have some experience 
with that sort of stuff, I had my own 64-bit patchset for NSIS originally, but 
Debian eventually fixed the same stuff too so I used theirs, I was also the one 
who fixed z88dk for 64-bit architectures.) The gist of it is to build on x86_64 
with as many GCC warnings as possible and fix everything GCC complains about, 
usually those are all the offending places, only rarely there is some stuff 
which has to be noticed by hand (during runtime testing).

        Kevin Kofler

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Kevin Kofler | 11 Oct 15:08
Favicon

Re: How to package code compiled with 'gcc -m32'?

Richard W.M. Jones <rjones <at> redhat.com> writes:
> That patch builds a 64 bit makensis, which is definitely an
> improvement.  However something still wants to link with the 32 bit
> wxGTK-devel.i386 library and include <gnu/stubs-32.h>.

I fixed that, and I also disabled the wxGTK menu app because it doesn't appear 
to work on non-Window$. Disabling the menu also avoids having to drag in wxGTK 
into something which is otherwise a plain command-line tool.

I sent you updated SRPMs in private mail, can you please merge my changes? (In 
addition to the fixes, I'd also really like the Obsoletes/Provides for nsis and 
nsis-data to go in.)

        Kevin Kofler

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list

Thomas Moschny | 7 Oct 17:49

Re: How to package code compiled with 'gcc -m32'?

2008/10/7 Richard W.M. Jones <rjones <at> redhat.com>:
> I've got a nasty program I'm trying to package for Fedora.  To cut a
> very long story short, this C/C++ mixed program started out on Windows
> and makes lots of 32 bit assumptions.  So it's compiled with 'gcc -m32'.
> [...]
> The second and much larger problem is that the code uses wxGTK-devel,
> and (because it's being compiled with gcc -m32) it has to have the 32
> bit version.

Beware - the buildsystems on koji are strictly non-multilib (as
opposed to mock, the standard fedora cfg files of which once made it
non-multilib, but don't anymore).

So, even if you manage to massage the buildreqs so it builds fine
locally, it will never build on koji.

> Any ideas?  I'm sure others must have hit this problem before ...

Yes, learned that yesterday when trying to build an app that includes
a ix86-only binary.

- Thomas

--

-- 
fedora-devel-list mailing list
fedora-devel-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list


Gmane