This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setup: gcc-4.5 compatibility


On Thu, 2010-07-22 at 22:50 -0400, Charles Wilson wrote:
> As noted here:
> http://cygwin.com/ml/cygwin-apps/2010-07/msg00175.html
> 
> I was able to build setup.exe using i686-pc-mingw32-gcc and only
> setup-gcc45.patch (that is, without setup-no-autoload.patch) and it worked.
> 
> The key difference, I think, is that all of the
> mingw-{zlib,bzip2,xz,gpg-error,gcrypt} packages, and setup itself were
> compiled with -mms-bitfields.

No, that's not it, I was able to get crashes -mms-bitfields as well.
Besides, it doesn't make sense that autoload.c would work any better
with or without -mms-bitfields, as long as it is compatible with the
rest of the mingw stack.  That's not to say that we shouldn't build
mingw-* with -mms-bitfields, but that's tangential to this issue.

The problem is with optimization in autoload.c.  By default, configure
sets C[XX]FLAGS='-g -O2', and autoload.c is not compatible with that.  I
even tried -O1 and setup.exe didn't work, but it does work with -O0
(even just for autoload.c).

I have attached the output of i686-pc-mingw-gcc -S with -O0, -O1, and
-O2; hopefully someone who understands this can propose a fix for
autoload.c (or gcc, depending on where the bug is).  In the meantime,
the attached patch for CVS HEAD simply disables optimization for
autoload.c only, allowing setup.exe to work even with a default
configure (tested with my i686-pc-mingw32-gcc 4.5.20100715).


Yaakov

Attachment: autoload-O0.s
Description: Text document

Attachment: autoload-O1.s
Description: Text document

Attachment: autoload-O2.s
Description: Text document

2010-07-23  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>

	Fix compatibility with GCC 4.5.
	* Makefile.am (setup_LDFLAGS): Pass -static to compiler instead of
	linker so that libgcc is statically linked as well.
	(autoload.o): Disable optimization.
	* doconfigure: Remove unused PATH manipulation.
	Change CC and CXX to $target-prefixed names.
	* localdir.cc (browse_cb): Fix "jump to case label crosses
	initialization" error.
	* mklink2.cc (sfli): Fix "non-local variable uses anonymous type"
	warning.
	* ntdll.h: Fix "redeclared without dllimport attribute: previous
	dllimport ignored" warnings.
	* package_message.h (display): Fix "'exit' was not declared in this
	scope" error.

Index: Makefile.am
===================================================================
RCS file: /cvs/cygwin-apps/setup/Makefile.am,v
retrieving revision 2.81
diff -u -r2.81 Makefile.am
--- Makefile.am	8 Apr 2010 15:50:38 -0000	2.81
+++ Makefile.am	23 Jul 2010 17:01:14 -0000
@@ -117,7 +117,7 @@
 	libinilex.a \
 	-Linst/lib -lgetopt++ -lgcrypt -lgpg-error \
 	-lshlwapi -lcomctl32 -lole32 -lwsock32 -lnetapi32 -luuid -llzma -lbz2 -lz 
-setup_LDFLAGS = -mwindows -Wl,-static -static-libtool-libs
+setup_LDFLAGS = -mwindows -Wc,-static -static-libtool-libs
 setup_SOURCES = \
 	AntiVirus.cc \
 	AntiVirus.h \
@@ -284,6 +284,9 @@
 	libmd5-rfc/md5.c \
 	libmd5-rfc/md5.h
 
+# autoload code does not optimize well
+autoload.o: CFLAGS += -O0
+
 VER := $(shell sed -ne 's/^\$$Revi[s]ion: *\([^ ]*\) *$$.*/\1/p' \
                $(srcdir)/ChangeLog)
 
Index: doconfigure
===================================================================
RCS file: /cvs/cygwin-apps/setup/doconfigure,v
retrieving revision 2.2
diff -u -r2.2 doconfigure
--- doconfigure	30 Mar 2010 23:55:15 -0000	2.2
+++ doconfigure	23 Jul 2010 17:01:14 -0000
@@ -9,19 +9,11 @@
   ( cd "$DIR" && ./bootstrap.sh )
 fi
 
-# If $build == cygwin, set PATH so that correct (mingw)
-# version of gpg-error-config and libgcrypt-config are
-# used.  Otherwise: assume cross-compiler users are
-# sophisticated enough to do this manually.
-case `uname -s` in
-*CYGWIN* ) export PATH="/usr/lib/mingw:${PATH}" ;;
-esac
-
 # Configure
 cmd="\"$DIR/configure\""
 cmd=$cmd' -C --disable-shared --enable-maintainer-mode'
 cmd=$cmd' --host=i686-pc-mingw32 --build=i686-pc-cygwin'
-cmd=$cmd' CC="gcc-3 -mno-cygwin" CXX="g++-3 -mno-cygwin"'
+cmd=$cmd' CC=i686-pc-mingw32-gcc CXX=i686-pc-mingw32-g++'
 
 for i in "$@"; do
   case $i in
Index: localdir.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/localdir.cc,v
retrieving revision 2.36
diff -u -r2.36 localdir.cc
--- localdir.cc	2 Feb 2010 17:28:10 -0000	2.36
+++ localdir.cc	23 Jul 2010 17:01:14 -0000
@@ -152,12 +152,14 @@
 	SendMessage (h, BFFM_SETSELECTION, TRUE, (LPARAM) local_dir.c_str());
       break;
     case BFFM_SELCHANGED:
-      // Make a note of each new dir we successfully select, so that
-      // we know where to create the new directory if an invalid name
-      // is entered in the text box.
-      LPITEMIDLIST pidl = reinterpret_cast<LPITEMIDLIST>(lp);
-      SHGetPathFromIDList (pidl, dirname);
-      break;
+      {
+        // Make a note of each new dir we successfully select, so that
+        // we know where to create the new directory if an invalid name
+        // is entered in the text box.
+        LPITEMIDLIST pidl = reinterpret_cast<LPITEMIDLIST>(lp);
+        SHGetPathFromIDList (pidl, dirname);
+        break;
+      }
     case BFFM_VALIDATEFAILED:
       // See if user wants to create a dir in the last successfully-selected.
       CHAR tempname[MAX_PATH];
Index: mklink2.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/mklink2.cc,v
retrieving revision 2.11
diff -u -r2.11 mklink2.cc
--- mklink2.cc	18 Dec 2009 11:59:54 -0000	2.11
+++ mklink2.cc	23 Jul 2010 17:01:14 -0000
@@ -111,7 +111,7 @@
 			: mkcygsymlink_9x (from, to);
 }
 
-struct {
+static struct {
   FILE_LINK_INFORMATION fli;
   WCHAR namebuf[32768];
 } sfli;
Index: ntdll.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/ntdll.h,v
retrieving revision 2.2
diff -u -r2.2 ntdll.h
--- ntdll.h	13 May 2009 11:28:34 -0000	2.2
+++ ntdll.h	23 Jul 2010 17:01:14 -0000
@@ -14,6 +14,8 @@
 #ifndef SETUP_NTDLL_H
 #define SETUP_NTDLL_H
 
+#define NTOSAPI
+
 #include "ddk/ntapi.h"
 #include "ddk/ntifs.h"
 
Index: package_message.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_message.h,v
retrieving revision 1.2
diff -u -r1.2 package_message.h
--- package_message.h	22 Dec 2009 16:19:51 -0000	1.2
+++ package_message.h	23 Jul 2010 17:01:14 -0000
@@ -15,6 +15,7 @@
 
 #include "UserSettings.h"
 #include "state.h"
+#include <stdlib.h>
 #include <windows.h>
 
 class packagemessage

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]