This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
setup: gcc-4.5 compatibility
- From: "Yaakov (Cygwin/X)" <yselkowitz at users dot sourceforge dot net>
- To: cygwin-apps <cygwin-apps at cygwin dot com>
- Date: Thu, 15 Jul 2010 16:27:44 -0500
- Subject: setup: gcc-4.5 compatibility
My test case for the mingw toolchain is, of course, setup.exe. I have
uploaded test builds of all mingw-* prereqs here:
ftp://ftp.cygwinports.org/pub/cygwinports/temp/MinGW/
setup-gcc45.patch contains the changes necessary to compile and link
with mingw-gcc-4.5. However, the resulting setup.exe promply SEGVs in
RtlInitUnicodeString@8. The problem is centered around the autoload
code, because if you circumvent autoload and link directly against those
APIs, then the resulting binary works. This can be demonstrated by
applying setup-no-autoload.patch on top of the first patch, then:
make CPPFLAGS=-DSETUP_NO_AUTOLOAD LIBS='-lmingw32 -lntdll -lwininet'
The reason for the crash is beyond me. Hopefully this will be enough
for someone to help figure it out.
Yaakov
DRAFT PATCH: DO NOT COMMIT!!
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.
* doconfigure: Remove usused 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 15 Jul 2010 04:58:07 -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 \
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 15 Jul 2010 04:58:07 -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 15 Jul 2010 04:58:07 -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 15 Jul 2010 04:58:07 -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 15 Jul 2010 04:58:07 -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 15 Jul 2010 04:58:07 -0000
@@ -15,6 +15,7 @@
#include "UserSettings.h"
#include "state.h"
+#include <stdlib.h>
#include <windows.h>
class packagemessage
Index: autoload.c
===================================================================
RCS file: /cvs/cygwin-apps/setup/autoload.c,v
retrieving revision 2.9
diff -u -r2.9 autoload.c
--- autoload.c 17 Mar 2010 17:51:18 -0000 2.9
+++ autoload.c 15 Jul 2010 05:44:34 -0000
@@ -16,6 +16,8 @@
static const char *cvsid = "\n%%% $Id: autoload.c,v 2.9 2010/03/17 17:51:18 corinna Exp $\n";
#endif
+#ifndef SETUP_NO_AUTOLOAD
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -106,3 +108,5 @@
*(int *)(&x-1) = (int)proc-5;
}
+
+#endif /* SETUP_NO_AUTOLOAD */
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 15 Jul 2010 05:44:35 -0000
@@ -14,11 +14,14 @@
#ifndef SETUP_NTDLL_H
#define SETUP_NTDLL_H
+#ifndef SETUP_NO_AUTOLOAD
#define NTOSAPI
+#endif
#include "ddk/ntapi.h"
#include "ddk/ntifs.h"
+#ifndef SETUP_NO_AUTOLOAD
extern "C" {
NTSTATUS DDKAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG,
@@ -35,5 +38,6 @@
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
};
+#endif /* SETUP_NO_AUTOLOAD */
#endif /* SETUP_NTDLL_H */