Web lists-archives.com

Re: [Mingw-users] arguments utilised for gcc downloads




... snip ...
>The below of course does not relate to MinGW32, but I'm 
>neither informed what FLAGS and configure arguments 
>generally are for MinGW32 gcc versions. 
>Could someone send me what these might be?

Read all of this, its long ...

Download the  the MinGW gcc-5.3.0 source code from Sourceforge
 MinGW section. When you untar it, you will get a source code  tree
 which has an addition:  a directory named "arch", which contains
a subdirectory named mingw32 which contains the answers to your
question, in the file gcc-5.3.0-mingw32.pkgspec. The other files are
patches to the  upstream gcc source code which are needed in
order to successfully compile.  

Actually getting the compilation to work on a Windows platform
will be a bit of a chore - the build instructions as documented by the
main gcc project will not work.  (Keith Marshall, who built and
packaged the MinGW gcc does a cross build on a Linux system)

Keith uses a build tool for his cross builds which provides a
much easier build than is possible with the upstram gcc
build instructions.  Unfortunately, it does not yet completely
work in the MinGW environment that you must use (msys).

The basic build process is this:

1. Apply patches.
2. Execute the configuration  needed for gcc to be compiled
for the mingw environment.
3. Compile the source code.
4. Install it to a staging directory.
5. Construct tha final product tar files that can be unpacked into
a running mingw installation.

Keith's build system, mingw-pkg, will only do the first two steps
on Windows.

Where to get mingw-pkg and instructions for installing it have
been discussed recently on this list - you should go back and find
and read those messages if you want to simplify the first two
build steps.

The third step is a "make install" in nice environments like Linux.
There is no such luck in Windows. I extracted a hack which solves
that problem from a makefile used in a now-abandoned build
system used in an earlier mingw gcc release.

Here is the build directory stucture that I use
I create a directory named "workspace".  It is easiest to do this
in your msys home directory, but it can go anywhere.
I create under it the directories "src" and "build/gcc-5.3.0-mingw32"

Put the Mingw source tarball in src and untar it there.
Note that you should use the MinGW installer to make
sure that you have the prerequisite libraries like gmp, mpfr, etc.
installed. Otherwise, follow gcc installation instructions
and unpack them into the gcc source tree.

Then make the gcc-5.3.0-mingw32 directory your
current directory.  Note that you are now two levels below
the workspace directory.

Now, do the patch step (1). If you have mingw-pkg, do this:

mingw-pkg SRCDIR=../../src/gcc-5.3.0 patch 2>&1 | tee ../../mingw-pkg-patch.log

Otherwise, do  a manual application of the patches.

Now the configure step. (2)

mingw-pkg SRCDIR=../../src/gcc-5.3.0 configure 2>&1 | tee ../../mingw-pkg-configure.log

Otherwise, as above, do the configure manually.

To do the compilation step (3), then you must use the hack.
It consists of three parts:

A. Hack a .o file from mingw into the  into the building directory:

mkdir gcc
cp -a /mingw/lib/crt2.o gcc/

B. Issue a series of export commands. There are nine of them:
export GCC_EXEC_PREFIX=/mingw/lib/gcc/
export LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export LDFLAGS_FOR_TARGET="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export LDFLAGS_FOR_BUILD="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export STAGE1_LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export POSTSTAGE1_LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export BOOT_LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export TOOLS_LIBS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
export SYSLIBS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"

C. Issue the actual make command that does the compilation (3). 
This is a really long command line. I'm going to break it into pieces to 
make it easier to read.

make  LDFLAGS_FOR_TARGET="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
 LDFLAGS_FOR_BUILD="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib" 
 STAGE1_LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib" 
 POSTSTAGE1_LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib" 
 BOOT_LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib" 
 TOOLS_LIBS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib" 
 SYSLIBS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
  LDFLAGS="--verbose -L/mingw/mingw32/lib -B/mingw/mingw32/lib"
 2>&1 | tee ../../manual-compile.log

You can see that there is a lot of duplication of the export commands here.
 All of this was needed to get gcc 4.8.1 to build. It may be possible to leave
some of this out for more recent versions, but I have not yet done the
 time-consuming experiments needed to know.

Now comes  the staging installation. (4). 
Do not do a simple-minded "make install".
Some hackery must be done  Do something like

make DESTDIR=someconvenientststagingdirectory install

Then you go into the staging directory and fix problems.
The main one is that most of the executables have "mingw32-"
prefixed onto their names, and these need to be renamed,
so that mingw32-whatever.exe becomes whatever.exe.
Some files are supposed to have this, and do they get a
double dose. These are mingw32-mingw32-whatever.exe"
Rename these as mingw32-whatever.exe.

The best way to identify problems is to download all of
the mingw32 binary manual installation tarballs and 
compare them file-by-file with the staging installation.
I made a directory listing of the whole lot and used it
 as a base to add notes about what installed correctly 
and what didn't. There were only a few other failures.
The vast majority of files installed correctly.

Do note, however: You may not want to do this with
the 5.3.0 version that Keith has released as source code.
I have done all of this with gcc 6.3.0,  the latest upstream
release, and the only problem in it is the executables
in the bin directory still have the mingw- prefix. All of the
other filename glitches and disappearances  have 
vanished. To do this you will need to do several more 
patches in step (1). Let me know and I will post them to 
this list.

>P.S. I'm not clear what the HTML policy ...
... snip ...

Never do HTML. The most experienced people on this
list (and most others) use Unix or Linux e-mail clients 
that completely freak out on HTML mail, and they will
 ignore such postings. I'm stuck with Microsoft Outlook
at work, which is where I am writing this, and although I
can turn off HTML, and I have done so for this message,
it is still not very good for this list.

I am going to get a new e-mail address and a better
mail client for future posting to this list and others, and 
I recommend that you do something similar.

Also, never top-post. Put your answers below the
questions, as I have done. A good mail client
will mark the question lines with a > prefix automatically.
This is proper Unix/Linux email structure. Do that
manually in bad clients like Outlook. Keep the lines
short.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe