On Tuesday 03 February 2009 19:55:36, Vincent R. wrote:
> 2) I made a patch for mingw to use static crt, it will be consistent with
> future cegcc-4.4
> and with mingw-w64. Now I need people to test it and if it works fine we
> could apply it to
> current svn.

Sorry, but I don't like this patch --- it's a hack.  In fact, if you browse
cegcc's history, you'll see that we used to do more of these dummy files, but
I really prefer to avoid them.

The issue you're tripping on, is that:

 - The crtbegin.o and crtend.o files are part of libgcc.
 - building mingw invokes the compiler/linker to build a fully
   linked executable, hence it needs crtbegin.o and crtend.o.
 - after gcc 4.1, the way that libgcc is built was changed.  Invoking
   "make all-gcc" doesn't build it anymore.  End result, the build script
   isn't building the target libgcc on the bootstrap gcc step.

To solve this, we need to build the target libgcc before building
mingw.  But, there's a cyclic dependency here.  To build the target
libgcc, we need mingw and w32api's headers, but we don't install them
until we've built mingw...

So, to fix this, I've added a new Makefile rule that just
installs mingw's headers (already checked in), and tweaked the
build script like this (notice the components build order change):

Index: build-mingw32ce.sh
===================================================================
--- build-mingw32ce.sh  (revisão 1225)
+++ build-mingw32ce.sh  (cópia de trabalho)
@@ -14,11 +14,11 @@ export BUILD_DIR=`pwd`
 
 ac_default_prefix="/opt/mingw32ce"
 
-gcc_src=gcc
+gcc_src=gcc-trunk
 
 # The list of components, in build order.  There's a build_FOO
 # function for each of these components
-COMPONENTS=( binutils bootstrap_gcc mingw w32api gcc profile dlls docs )
+COMPONENTS=( binutils mingw_headers w32api bootstrap_gcc mingw gcc profile 
docs )
 COMPONENTS_NUM=${#COMPONENTS[*]}
 
 # Build comma separated list of components, for user display.
@@ -211,8 +211,8 @@ build_bootstrap_gcc()
        --without-newlib               \
        --enable-checking
     
-    make ${PARALLELISM} all-gcc
-    make install-gcc
+    make ${PARALLELISM} all-gcc all-target-libgcc
+    make install-gcc install-target-libgcc
 
     cd ${BUILD_DIR}
 }
@@ -232,6 +232,21 @@ build_w32api()
     cd ${BUILD_DIR}
 }
 
+build_mingw_headers()
+{
+    mkdir -p mingw-headers
+    cd mingw-headers
+    ${BASE_DIRECTORY}/mingw/configure \
+       --build=${BUILD}              \
+       --host=${TARGET}              \
+       --target=${TARGET}            \
+       --prefix=${PREFIX}
+
+    make install-headers
+
+    cd ${BUILD_DIR}
+}
+
 build_mingw()
 {
     mkdir -p mingw


Next step, clean up a bit the gcc patch, and see if anything
built with it runs at least.


>   
> cegcc-mingw-static.diff
>   Index: mingw/Makefile.in
> ===================================================================
> --- mingw/Makefile.in   (révision 1210)
> +++ mingw/Makefile.in   (copie de travail)
> @@ -177,7 +177,7 @@
>         TARFLAGS="$(TARFLAGS)" \
>         TARFILEEXT="$(TARFILEEXT)"
>  
> -CRT0S = CRT_noglob.o crtmt.o crtst.o
> +CRT0S = crtbegin.o crtend.o CRT_noglob.o crtmt.o crtst.o
>  ifneq (,$(findstring mingw32ce,$(host_alias)))
>  CRT0S += crt3.o dllcrt3.o
>  else
> @@ -258,12 +258,16 @@
>         $(AR) rc $@ _libm_dummy.o
>         $(RANLIB) $@
>  
> -libmingwthrd.a: crtmt.o mingwthrd.def
> -       $(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(THREAD_DLL_NAME) \
> -         --def mingwthrd.def --output-lib $@
> -       $(AR) $(ARFLAGS) $@ crtmt.o
> +libmingwthrd.a: dummy_mingwthrd.o
> +       $(AR) rc $@ dummy_mingwthrd.o
>         $(RANLIB) $@
>  
> +#libmingwthrd.a: crtmt.o mingwthrd.def
> +#      $(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(THREAD_DLL_NAME) \
> +#        --def mingwthrd.def --output-lib $@
> +#      $(AR) $(ARFLAGS) $@ crtmt.o
> +#      $(RANLIB) $@
> +
>  # Using dllwrap would be so much easier, but Cygnus top-level configure
>  # Makefile.in etc don't pass the right variables yet.
>  xx_$(THREAD_DLL_NAME) xx_mingwthrd.def: mthr.o mthr_init.o
> @@ -514,6 +518,8 @@
>  crt1.o: crt1.c init.c
>  crt2.o: crt1.c init.c
>  crt3.o: crt3.c
> +crtbegin.o: crtbegin.c
> +crtend.o: crtend.c
>  crtmt.o: crtmt.c
>  crtst.o: crtst.c
>  ctype_old.o: ctype_old.c
> @@ -521,6 +527,7 @@
>  dllcrt2.o: dllcrt1.c
>  dllcrt3.o: dllcrt1.c
>  dllmain.o: dllmain.c
> +dummy_mingwthrd.o: dummy_mingwthrd.c
>  main.o: main.c
>  winmain_ce.o: winmain_ce.c
>  oldnames.o: oldnames.c
> Index: mingw/dummy_mingwthrd.c
> ===================================================================
> Index: mingw/crtend.c
> ===================================================================
> --- mingw/crtend.c      (révision 0)
> +++ mingw/crtend.c      (révision 0)
> @@ -0,0 +1,6 @@
> +/**
> + * This file has no copyright assigned and is placed in the Public Domain.
> + * This file is part of the w64 mingw-runtime package.
> + * No warranty is given; refer to the file DISCLAIMER within this package.
> + */
> +
> Index: mingw/crtbegin.c
> ===================================================================
> --- mingw/crtbegin.c    (révision 0)
> +++ mingw/crtbegin.c    (révision 0)
> @@ -0,0 +1,6 @@
> +/**
> + * This file has no copyright assigned and is placed in the Public Domain.
> + * This file is part of the w64 mingw-runtime package.
> + * No warranty is given; refer to the file DISCLAIMER within this package.
> + */
> +
>   
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Cegcc-devel mailing list
> Cegcc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cegcc-devel



-- 
Pedro Alves

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to