diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 6fa22bf359..9bcfa88afd 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -314,7 +314,7 @@ Java_java_io_File_toCanonicalPath(JNIEnv* /*e*/, jclass, jstring path) } extern "C" JNIEXPORT jstring JNICALL -Java_java_io_File_toAbsolutePath(JNIEnv* e, jclass, jstring path) +Java_java_io_File_toAbsolutePath(JNIEnv* e UNUSED, jclass, jstring path) { #ifdef PLATFORM_WINDOWS // todo diff --git a/classpath/java-lang.cpp b/classpath/java-lang.cpp index 8b78a2ec4e..a46b5a93e5 100644 --- a/classpath/java-lang.cpp +++ b/classpath/java-lang.cpp @@ -413,8 +413,8 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass, execvp(argv[0], argv); // Error if here - char c = errno; - ssize_t rv UNUSED = write(msg[1], &c, 1); + int val = errno; + ssize_t rv UNUSED = write(msg[1], &val, sizeof(val)); exit(127); } break; @@ -427,12 +427,13 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass, safeClose(err[1]); safeClose(msg[1]); - char c; - int r = read(msg[0], &c, 1); + int val; + int r = read(msg[0], &val, sizeof(val)); if(r == -1) { throwNewErrno(e, "java/io/IOException"); return; } else if(r) { + errno = val; throwNewErrno(e, "java/io/IOException"); return; } diff --git a/classpath/java/lang/Runtime.java b/classpath/java/lang/Runtime.java index 30dc0b6612..a24f850bf3 100644 --- a/classpath/java/lang/Runtime.java +++ b/classpath/java/lang/Runtime.java @@ -103,7 +103,8 @@ public class Runtime { if (exception[0] != null) { if (exception[0] instanceof IOException) { - throw new IOException(exception[0]); + String message = "Failed to run \"" + command[0] + "\": " + exception[0].getMessage(); + throw new IOException(message); } else { throw new RuntimeException(exception[0]); } diff --git a/makefile b/makefile index 852cb6a816..a3a6519c2b 100755 --- a/makefile +++ b/makefile @@ -240,7 +240,7 @@ endif ifeq ($(arch),arm) asm = arm pointer-size = 4 - ifneq ($(platform),darwin) + ifneq ($(build-platform),darwin) cflags += -marm -Wno-psabi endif @@ -262,10 +262,17 @@ ifeq ($(arch),arm) endif endif + ifeq ($(platform),linux) cflags += -DTARGET_PLATFORM_LINUX endif +ifeq ($(build-platform),darwin) + build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src) + cflags += -I/System/Library/Frameworks/JavaVM.framework/Headers/ + build-lflags += -framework CoreFoundation +endif + ifeq ($(platform),darwin) cflags += -DTARGET_PLATFORM_DARWIN @@ -284,10 +291,6 @@ ifeq ($(platform),darwin) sysroot = /opt/mac/SDKs/MacOSX${OSX_SDK_SYSROOT}.sdk cflags = -I$(sysroot)/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers/ \ $(common-cflags) -fPIC -fvisibility=hidden -I$(src) - else - build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src) - cflags += -I/System/Library/Frameworks/JavaVM.framework/Headers/ - build-lflags += -framework CoreFoundation endif version-script-flag = @@ -565,6 +568,9 @@ else -DAVIAN_CLASSPATH=\"[classpathJar]\" endif +cflags += $(extra-cflags) +lflags += $(extra-lflags) + driver-source = $(src)/main.cpp driver-object = $(build)/main.o driver-dynamic-objects = \