ITA: gcc-mingw-* gcc-3 -mno-cygwin support packages; ITP: mingw-binutils/mingw-gcc-* cross compiler

Charles Wilson cygwin@cwilson.fastmail.fm
Tue Nov 23 23:33:00 GMT 2010


Updated packages are available by pointing setup.exe here:
	http://cygutils.fruitbat.org/ITP/mingw-gcc/
[Chris Sutcliff: see notes section below]

***********************************************************************
DO NOT INSTALL BLINDLY. FOLLOW THESE INSTRUCTIONS INSTEAD!

  1) run setup and upgrade gcc-mingw-* if any are installed
     on your system. Do NOT allow mingw-binutils to be installed.
     Do NOT allow mingw-w32api or mingw-pthreads to be installed.
     Do NOT upgrade mingw-runtime.  Do NOT install the cross
     compiler packages (mingw-gcc-*).  Do NOT upgrade the mingw
     libraries (zlib, bzip2, xz, libgpg-error, libgcrypt).

  2) run setup again, and this time upgrade mingw-runtime, and
     install mingw-binutils and mingw-w32api.  You can also upgrade
     the mingw libraries (mingw-zlib, mingw-bzip2, mingw-xz,
     mingw-libgpg-error, mingw-libgcrypt). Do NOT install the cross
     compiler packages (mingw-gcc-*).

  3) run setup a third time, and now install the mingw-gcc-*
     cross compilers.

See below for explanation
***********************************************************************


------------------  1  ---------------
The first set of packages are revisions (actually, just rearranging the
contents) of the venerable add-on packages that provide -mno-cygwin
support for gcc-3.

= gcc-mingw-ada-20050522-2-src.tar.bz2
= gcc-mingw-ada-20050522-2.tar.bz2
= gcc-mingw-core-20050522-2-src.tar.bz2
= gcc-mingw-core-20050522-2.tar.bz2
= gcc-mingw-g++-20050522-2-src.tar.bz2
= gcc-mingw-g++-20050522-2.tar.bz2
= gcc-mingw-g77-20050522-2-src.tar.bz2
= gcc-mingw-g77-20050522-2.tar.bz2
= gcc-mingw-gdc-20050522-2-src.tar.bz2
= gcc-mingw-gdc-20050522-2.tar.bz2
= gcc-mingw-gpc-20040810-2-src.tar.bz2
= gcc-mingw-gpc-20040810-2.tar.bz2
= gcc-mingw-java-20050522-2-src.tar.bz2
= gcc-mingw-java-20050522-2.tar.bz2
= gcc-mingw-objc-20050522-2-src.tar.bz2
= gcc-mingw-objc-20050522-2.tar.bz2

With the exception of the Pascal package (-gpc-, which was made obsolete
and replaced by an empty package), the main change is in the behavior of
the postinstall script.  In the past, the way these add-on packages
operated was:

1) "install" an (inner) tarball into /etc/postinstall
2) run a postinstall script that created some symbolic links, and
   then unpacked that inner tarball.

Unfortunately, these symbolic links can mess up any coexistance with
(and, indeed, even the standalone operation of) a REAL mingw cross
compiler.  So, those symbolic links have got to go.

   /usr/i686-pc-mingw32/bin
   /usr/i686-pc-mingw32/lib
   /usr/i686-pc-mingw32/include

However, they have to be removed *before* installing any of the actual
cross-compiler elements (like the new mingw-binutils, or the updated
mingw-runtime package, or the new mingw-gcc).  Since we have no facility
for "pre-install" scripts...the best I could figure was the following
procedure:

A) FIRST, upgrade the existing gcc-mingw-* packages.  These all have new
postinstall and preremove scripts that DTRT:

   1) remove all leftover symbolic links from the older packages'
      postinstall scripts
   2) create the correct directory structure
   3) unpack the (reorganized) inner tarballs as appropriate
   4) for mingw-gcc-core, also create some symlinks to elements
      of the (updated) mingw-runtime package.  These will be dangling,
      until mingw-runtime is upgraded.

DO NOT ALLOW setup.exe to install mingw-binutils yet, even though
setup.exe will whine about it.  Nor mingw-w32api or mingw-runtime, or
any of the mingw libraries (zlib, bzip2, xz, libgpg-error, libgcrypt)

B) THEN, upgrade mingw-runtime and install mingw-w32api, mingw-binutils,
and mingw-pthreads.  You can also allow setup.exe to upgrade mingw-zlib,
mingw-bzip2, mingw-xz, mingw-libgpg-error, and mingw-libgcrypt.

C) FINALLY, install the cross compiler files mingw-gcc-core and
mingw-gcc-$lang.

Note that this ugliness only arises because of the weird way *existing*
installations of gcc-3/gcc-mingw-* packages are installed.  On a virgin
system (or one that doesn't have gcc-3/gcc-mingw-* installed) none of
this is necessary.

So far I have only tested that 'gcc-3 -mno-cygwin' and 'g++-3
-mno-cygwin' work properly.   It is a Known Issue(tm) that in this new
configuration, 'gcc-3 -mno-cygwin -nostdlib/-nostdinc' will break.  If
this is important to you, then add
   -spec /usr/lib/gcc/i686-pc-mingw32/3.4.4/orig.spec
or...start using the mingw-gcc-4.5.0 cross compiler instead.



------------------  2  ---------------
The second group of packages are the libraries associated with the new
cross compiler. This includes:

a) NEW: a separate mingw-w32api that installs into the cross-compiler's
   sysroot (rather than the exising w32api package that remains in
   /usr/{lib,include}/w32api for use by cygwin's own compiler).

b) UPDATE: a new revision of the existing mingw-runtime package.  Again,
   this one installs into the cross compiler's sysroot, rather than
   going into /usr/{lib,include}/mingw as the older one did. Unlike
   w32api, there is no need to keep a second copy of these files under
   /usr/{lib,include} any longer.

c) NEW: mingw-pthreads, a version of Pthreads-W32 installed into the \
   cross compiler's sysroot.  It is used by libgomp (gcc's OpenMP
   library).

d) UPDATE: updated versions of the various setup.exe libraries,
   recompiled to install into the cross compiler's sysroot:
     mingw-zlib           mingw-zlib1           mingw-zlib-devel
     mingw-bzip2          mingw-libbz2_1        mingw-libbz2-devel
     mingw-xz             mingw-liblzma1        mingw-liblzma-devel
     mingw-libgpg-error   mingw-libgpg-error0   mingw-libgpg-error-devel
     mingw-libgcrypt      mingw-libgcrypt11     mingw-libgcrypt-devel

= mingw-w32api-3.15-1-src.tar.bz2
= mingw-w32api-3.15-1.tar.bz2
= mingw-runtime-3.18-2-src.tar.bz2
= mingw-runtime-3.18-2.tar.bz2
= mingw-pthreads-20100619-1-src.tar.bz2
= mingw-pthreads-20100619-1.tar.bz2

= mingw-zlib-1.2.5-4-src.tar.bz2
= mingw-zlib-1.2.5-4.tar.bz2
= mingw-zlib-devel-1.2.5-4.tar.bz2
= mingw-zlib1-1.2.5-4.tar.bz2

= mingw-bzip2-1.0.5-12-src.tar.bz2
= mingw-bzip2-1.0.5-12.tar.bz2
= mingw-libbz2-devel-1.0.5-12.tar.bz2
= mingw-libbz2_1-1.0.5-12.tar.bz2

= mingw-liblzma-devel-4.999.9beta-13.tar.bz2
= mingw-liblzma1-4.999.9beta-13.tar.bz2
= mingw-xz-4.999.9beta-13-src.tar.bz2
= mingw-xz-4.999.9beta-13.tar.bz2

= mingw-libgpg-error-1.8-2-src.tar.bz2
= mingw-libgpg-error-1.8-2.tar.bz2
= mingw-libgpg-error-devel-1.8-2.tar.bz2
= mingw-libgpg-error0-1.8-2.tar.bz2

= mingw-libgcrypt-1.4.5-3-src.tar.bz2
= mingw-libgcrypt-1.4.5-3.tar.bz2
= mingw-libgcrypt-devel-1.4.5-3.tar.bz2
= mingw-libgcrypt11-1.4.5-3.tar.bz2


------------------  3  ---------------
The third group of packages is the actual cross compiler toolchain. This
includes:

= mingw-binutils-2.20.51-1-src.tar.bz2
= mingw-binutils-2.20.51-1.tar.bz2

= mingw-gcc-4.5.1-1-src.tar.bz2
= mingw-gcc-core-4.5.1-1.tar.bz2
= mingw-gcc-fortran-4.5.1-1.tar.bz2
= mingw-gcc-g++-4.5.1-1.tar.bz2
= mingw-gcc-objc-4.5.1-1.tar.bz2

These tools are configure as cross-compilers with sysroot support -- the
gcc configuration CYGCONF_ARGS are:
        --disable-multilib
        --disable-win32-registry
        --enable-languages=c,c++,fortran,objc,obj-c++
        --enable-fully-dynamic-strings
        --enable-libgomp
        --disable-sjlj-exceptions
        --enable-libstdcxx-debug
        --enable-version-specific-runtime-libs
        --with-dwarf2
        --disable-werror
        --enable-lto

Once a native cygwin gcc-4.5.1 (or perhaps 4.5.0) with ada support is
made official, I'll update mingw-gcc to also include ada (you need a
native ada compiler of a similar version in order to build an ada cross
compiler).

When MinGW.org offers a 4.5.x compiler with java support, I'll update
this cross compiler to do so as well.



------------------  NOTES  ---------------
With these new packages installed, I was able to build setup.exe from
current CVS without issue -- by default, the existing bootstrap.sh
script now uses the cross compiler automatically if
	i686-pc-mingw32-g++
is installed.

With only the gcc-mingw- "add ons" for gcc-3 installed (plus its
pre-requisites: mingw-binutils, mingw-w32api, mingw-runtime, AND
mingw-gcc-core which provides i686-pc-mingw32-gcc but NOT
i686-pc-mingw32-g++), I was able to build setup.exe using gcc-3
-mno-cygwin -- but I had to pass
   CPPFLAGS=-I/usr/i686-pc-mingw32/sys-root/mingw/include
   LDFLAGS=-L/usr/i686-pc-mingw32/sys-root/mingw/lib
as commandline arguments to bootstrap.sh.  The attached patch does this
automatically.


Chris Sutcliff:  I don't intend to adopt your mingw-runtime package, but
I needed to provide a sys-root compatible version. I assume that once
the new cross compiler "goes live" you'll continue building
mingw-runtime packages, only now they'll be built using the cross
compiler and installed into the sysroot as a matter of course.

Also, I'm willing to "own" the mingw-w32api package (which is
distinguished from the ongoing "regular" w32api package) -- or you can
adopt mingw-w32api and provide both versions hereafter.  It's up to you.


Finally: official rollout.

I don't know how we can ease the pain of the three step (or, at minimum,
two step) install process, given the wacky things the EXISTING
gcc-mingw- packages have already done to the file system tree.  One
possibility is to ONLY release the updated gcc-mingw- addons (with
judicious modifications of their requires: lines) and let people install
those.  Say, for about a month.

During this month, gcc-3 -mno-cygwin would be broken on their systems.
Complainers can be told to THEN add the ITP URL above to their setup.exe
configuration, and then they can install the "missing" bits.  This way,
we are ENSURED that they have already installed the gcc-mingw packages
-- and can be SURE that the symlinks problem is "fixed" on their machine.



Then, after the month has passed, go ahead and move the other packages
over to sourceware.  People who "blindly upgrade" after than will bork
their system (it's fixable, but awkward) -- but MOST people will have
already upgraded their gcc-mingw (and probably didn't even notice), so
they'll be fine.

And, of course, anybody who installs from scratch will always be fine.

Comments?

--
Chuck



More information about the Cygwin-apps mailing list