Closed tarotanaka0 closed 9 years ago
Can you provide build instructions? Did you use the new avian-pack project, or the old (manual) android build instructions? OS and compiler versions you used would also be helpful.
I tried getting avian-pack compiling for iOS, but I'm seeing some unrelated build issues. (EDIT: filed here: https://github.com/bigfatbrowncat/avian-pack/issues/2)
I'm using avian-pack project tree with manual build steps. (OS X 10.10.3, Xcode 6.3.2, iOS SDK 8.3, iPhone6, iOS 8.3)
hello.patch :
--- hello-ios/src/Hello.java
+++ hello-ios/src/Hello.java
@@ -9,6 +9,10 @@ public class Hello {
this.peer = peer;
InputStream in = getClass().getResourceAsStream("/hello.properties");
+ for (int j = 0; j < 1000; j++) {
+ System.err.println(j);
+ byte[] b = new byte[1024 * 1024];
+ }
try {
Properties props = new Properties();
props.load(in);
--- hello-ios/hello/hello.xcodeproj/project.pbxproj
+++ hello-ios/hello/hello.xcodeproj/project.pbxproj
@@ -289,6 +289,12 @@
GCC_PREFIX_HEADER = "hello/hello-Prefix.pch";
INFOPLIST_FILE = "hello/hello-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ OTHER_LDFLAGS = (
+ "-filelist",
+ ../build/libhello.list,
+ "-lz",
+ "-lc++",
+ );
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -302,6 +308,12 @@
GCC_PREFIX_HEADER = "hello/hello-Prefix.pch";
INFOPLIST_FILE = "hello/hello-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ OTHER_LDFLAGS = (
+ "-filelist",
+ ../build/libhello.list,
+ "-lz",
+ "-lc++",
+ );
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
--- hello-ios/makefile
+++ hello-ios/makefile
@@ -31,7 +31,9 @@ developer-dir := $(shell if test -d /Developer/Platforms/$(target).platform/Deve
sdk-dir = $(developer-dir)/Platforms/$(target).platform/Developer/SDKs
ios-version := $(shell \
- if test -d $(sdk-dir)/$(target)8.2.sdk; then echo 8.2; \
+ if test -d $(sdk-dir)/$(target)8.4.sdk; then echo 8.4; \
+ elif test -d $(sdk-dir)/$(target)8.3.sdk; then echo 8.3; \
+ elif test -d $(sdk-dir)/$(target)8.2.sdk; then echo 8.2; \
elif test -d $(sdk-dir)/$(target)8.1.sdk; then echo 8.1; \
elif test -d $(sdk-dir)/$(target)8.0.sdk; then echo 8.0; \
elif test -d $(sdk-dir)/$(target)7.1.sdk; then echo 7.1; \
--- android/external/conscrypt/src/main/native/org_conscrypt_NativeCrypto.cpp
+++ android/external/conscrypt/src/main/native/org_conscrypt_NativeCrypto.cpp
@@ -349,7 +349,7 @@ typedef UniquePtr<STACK_OF(GENERAL_NAME), sk_GENERAL_NAME_Delete> Unique_sk_GENE
* without triggering a warning by not using the result of release().
*/
#define OWNERSHIP_TRANSFERRED(obj) \
- do { typeof (obj.release()) _dummy __attribute__((unused)) = obj.release(); } while(0)
+ do { __typeof__ (obj.release()) _dummy __attribute__((unused)) = obj.release(); } while(0)
/**
* Frees the SSL error state.
--- android/system/core/include/utils/Compat.h
+++ android/system/core/include/utils/Compat.h
@@ -55,7 +55,7 @@ static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset)
#ifndef TEMP_FAILURE_RETRY
/* Used to retry syscalls that can return EINTR. */
#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
+ __typeof__ (exp) _rc; \
do { \
_rc = (exp); \
} while (_rc == -1 && errno == EINTR); \
--- android/libnativehelper/include/nativehelper/JNIHelp.h
+++ android/libnativehelper/include/nativehelper/JNIHelp.h
@@ -182,7 +182,7 @@ inline void jniLogException(JNIEnv* env, int priority, const char* tag, jthrowab
#ifndef TEMP_FAILURE_RETRY
/* Used to retry syscalls that can return EINTR. */
#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
+ __typeof__ (exp) _rc; \
do { \
_rc = (exp); \
} while (_rc == -1 && errno == EINTR); \
Instruction :
git clone https://github.com/bigfatbrowncat/avian-pack.git
cd avian-pack
make git-refresh
(cd avian && git checkout cp_fix2)
git clone https://github.com/ReadyTalk/hello-ios.git
patch -p0 < ../hello.patch
cp android/external/fdlibm/makefile.in android/external/fdlibm/Makefile.in
(cd android/openssl-upstream && \
(for x in ../external/openssl/patches/*.patch; \
do patch -p1 < $x; \
done))
mkdir -p icu4c_host
(cd icu4c_host/ && ../android/external/icu4c/configure && make -j8)
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
export ARCH=armv7
(cd android/external/icu4c/ && \
CFLAGS="-fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
CXXFLAGS="-fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
CPPFLAGS="-arch ${ARCH} -isysroot ${SDKROOT} -I$(pwd)/tools/tzcode" \
./configure --host=${ARCH}-apple-darwin \
--enable-static --disable-shared -with-cross-build=$(pwd)/../../../icu4c_host/ && \
make -j8)
(cd android/external/expat/ && \
CFLAGS="-fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
CXXFLAGS="-fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
CPPFLAGS="-arch ${ARCH} -isysroot ${SDKROOT}" \
./configure --host=${ARCH}-apple-darwin --enable-static --disable-shared && \
make)
(cd android/external/fdlibm/ && \
CFLAGS="-fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
CXXFLAGS="-fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
CPPFLAGS="-arch ${ARCH} -isysroot ${SDKROOT}" \
bash configure --host=${ARCH}-apple-darwin --enable-static --disable-shared && \
make)
(cd android/openssl-upstream/ && \
CC="gcc -fPIC -arch ${ARCH} -pipe -isysroot ${SDKROOT} -miphoneos-version-min=7.0" \
./Configure BSD-generic32 && \
make)
With new shell :
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/
(cd hello-ios && make arch=arm android=$(pwd)/../android run-proguard=false)
Open hello-ios/hello/hello.xcodeproj with Xcode and Run, you will see EXC_BAD_ACCESS.
I don't have access to a real iOS device, but I just now managed to reproduce this in the simulator. I had to work around an assertion error to get that far, though; here's the patch I used:
diff --git a/luni/src/main/java/java/lang/System.java b/luni/src/main/java/java/lang/System.java
index 6cc77e6..0a50db6 100644
--- a/luni/src/main/java/java/lang/System.java
+++ b/luni/src/main/java/java/lang/System.java
@@ -759,7 +759,9 @@ public final class System {
p.put("user.home", passwd.pw_dir);
p.put("user.name", passwd.pw_name);
} catch (ErrnoException exception) {
- throw new AssertionError(exception);
+ p.put("user.home", "/tmp");
+ p.put("user.name", "unknown");
+ //throw new AssertionError(exception);
}
StructUtsname info = Libcore.os.uname();
I'll see if I can debug it from here.
I've confirmed the fix on iOS device. Thank you.
GC crashes after calling Class#getResourceAsStream() on ios-arm-bootimage-android build. (Does not happen with avian classpath)
Test code: (modifying hello-ios)
Backtrace (when j==18):