Skip to main content

Proposed patches for MinGW build of phoneME

2 replies [Last post]
greg80303
Offline
Joined: 2008-07-03
Points: 0

I am compiling the phoneME VM (CDC, PBP) on a Windows XP PC using Cygwin and cross-compiling to MinGW. I have a couple of proposed patches to help build the system against the MinGW w32 APIs. I couldn't find an option to add attachments to this post, so the patches are provided inline.

1) src/share/basis/native/image/jpeg/lib/jmorecfg.h

The w32 header basetsd.h already defines 'INT32' to be 'int'. The current code attempts to redefine INT32 to 'long'.

******* BEGIN PATCH *********

--- jmorecfg.h.orig 2009-04-05 10:34:29.343750000 -0600
+++ jmorecfg.h 2009-04-05 10:35:04.906250000 -0600
@@ -186,7 +186,7 @@
/* INT32 must hold at least signed 32-bit values. */

#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
-#ifndef _LP64
+#if !defined(_LP64) && !defined(__MINGW32__)
typedef long INT32;
#else
typedef int INT32;

******* END PATCH *********

2) src/share/javavm/runtim/jvm.c

The definitions of JVM_DesiredAssertionStatus and JVM_AssertionStatusDirectives conflict with their declarations in src/share/javavm/jdk-export/jvm.h

******* BEGIN PATCH *********

--- jvm.c.orig 2009-04-05 10:45:13.890625000 -0600
+++ jvm.c 2009-04-05 10:45:36.171875000 -0600
@@ -642,7 +642,7 @@
#ifndef CDC_10
/* Assertion support. */

-jboolean
+JNIEXPORT jboolean JNICALL
JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls)
{
CVMExecEnv* ee = CVMjniEnv2ExecEnv(env);
@@ -666,7 +666,7 @@

/* Return a new AssertionStatusDirectives object with the fields filled in with
command-line assertion arguments (i.e., -ea, -da). */
-jobject
+JNIEXPORT jobject JNICALL
JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused)
{
CVMExecEnv* ee = CVMjniEnv2ExecEnv(env);

******* END PATCH *********

Of course, if any of you can recommend better or more elegant alternatives to either of these patches I would be happy to test them out!

G

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cjplummer
Offline
Joined: 2006-10-16
Points: 0

I've submitted a bug, but can't say when someone will have time to commit a fix.

I think the jvm.c changes look fine. I'm not so sure about the jmorecfg.h change. Is there another macro that can be used that is not MinGW specific.

greg80303
Offline
Joined: 2008-07-03
Points: 0

The basetsd.h file is a standard Type Size Definition include file found in many of Microsoft's SDKs.

If you do not like the __MINGW32__ macro, we could always use the _BASETSD_H inclusion protection macro found in the basetsd.h file that is part of the MinGW w32 API installation. After looking at my copy of Visual Studio 2005, there are 2 installed SDKs (PocketPC2003 and Smartphone2003) that also have this file. However, it looks like Microsoft defines the inclusion protection macro as _BASETSD_H_ (trailing underscore). After some extensive online searches these are the only 2 variations of this macro I could find. Therefore, we could change the patch to look like this:

******* BEGIN PATCH *********

--- jmorecfg.h.orig 2009-04-05 10:34:29.343750000 -0600
+++ jmorecfg.h 2009-04-05 10:35:04.906250000 -0600
@@ -186,7 +186,7 @@
/* INT32 must hold at least signed 32-bit values. */

#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
-#ifndef _LP64
+#if !defined(_LP64) && !defined(_BASETSD_H_) && !defined(_BASETSD_H)
typedef long INT32;
#else
typedef int INT32;

******* END PATCH *********