Failed and successful native builds of gcc 5.3.0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Failed and successful native builds of gcc 5.3.0

David Gressett-5

In my investigations to discover why mingw-pkg fails
to compile gcc 5.3.0 in a native build with msys,
I used   sh -vx to determine the actual command line
passed to make by mingw-pkg when doing the
compile stage of the build, and found that it was indeed
just "make" with no arguments.

my next step was to extract the exact make command
line that was used in the successful build that used Earnie's
gcc 4.8.1  build system. The relevant portion of his
makefile looked like this:

LDFLAGS = --verbose -L/mingw/$(HOST)/lib -B/mingw/$(HOST)/lib
COMPILE = mkdir -p bld/gcc; cp -a /mingw/lib/crt2.o bld/gcc/; cd bld && \
  export GCC_EXEC_PREFIX=/mingw/lib/gcc/; \
  export LDFLAGS="$(LDFLAGS)"; \
  export LDFLAGS_FOR_TARGET="$(LDFLAGS)"; \
  export LDFLAGS_FOR_BUILD="$(LDFLAGS)"; \
  export STAGE1_LDFLAGS="$(LDFLAGS)"; \
  export POSTSTAGE1_LDFLAGS="$(LDFLAGS)"; \
  export BOOT_LDFLAGS="$(LDFLAGS)"; \
  export TOOLS_LIBS="$(LDFLAGS)"; \
  export SYSLIBS="$(LDFLAGS)"; \
  /bin/make \
  LDFLAGS_FOR_TARGET="$(LDFLAGS)" \
  LDFLAGS_FOR_BUILD="$(LDFLAGS)" \
  STAGE1_LDFLAGS="$(LDFLAGS)" \
  POSTSTAGE1_LDFLAGS="$(LDFLAGS)" \
  BOOT_LDFLAGS="$(LDFLAGS)" \
  TOOLS_LIBS="$(LDFLAGS)" \
  SYSLIBS="$(LDFLAGS)" \
  LDFLAGS="$(LDFLAGS)"

I lifted this into my Windows text editor and expanded
all of the $ definitions to construct the actual command
lines. I then used mingw-pkg to do the first steps of a
new build starting from scratch. I did the patch and
configure steps with mingw-pkg. I then copied, pasted,
and executed each of my reconstructed command lines.

The result was a successful compile step. It did strike me
as interesting that Earnie's command lines did the various
flags definitions as both exported environment variables
and command line arguments to make, and that he
prefaced the make with a bit of work to copy crt2.o from
the /mingw/lib directory into a place in the bld directory
tree. I do not at this point know how much, if any, of
this structure can be eliminated; experiments are slow,
as the build runs for about 5 hours on my build computer.

It is not clear to me why this works - the offending
libcrt2.o is not located in the directory specified by
LDFLAGS and is not copied  into the build directory tree.

In any case, it does appear to me  that mingw-pkg needs
to do some things for a native build with msys that it
does not need to do in a cross-build environment on a
Linux host.

After completing the successful build, I then looked to see
what mingw-pkg would do as the equivalent of Earnie's
make stage.  mingw-pkg --help was not helpful; it is
obviously an incomplete work in progress. A search of the
source code turned up something  similar to the
structure of the compilation:

# Action "install": install the application into the target directory
# specified at configuration time, or a staging directory specified by
# $INSTALLDIR, at installation time.

An attempt to do

mingw-pkg INSTALLDIR=... install

didn't work well - the INSTALLDIR was ignored and the results
went into the mingw directories but did not overwrite all of the
existing gcc 5.3.0 files. I renamed the mingw directory and
did a fresh install from scratch so that I could investigate the
details of the failure later.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-dvlpr mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Failed and successful native builds of gcc 5.3.0

Earnie Boyd
On 1/25/2017 5:13 PM, David Gressett wrote:

> The result was a successful compile step. It did strike me
> as interesting that Earnie's command lines did the various
> flags definitions as both exported environment variables
> and command line arguments to make, and that he

I think I was copying someone else but I don't remember who.

> prefaced the make with a bit of work to copy crt2.o from
> the /mingw/lib directory into a place in the bld directory
> tree. I do not at this point know how much, if any, of

IIRC I did this because xgcc was refusing to find it otherwise.

--
Earnie

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-dvlpr mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr
Loading...