iOS enabled: Error extracting avian-openjdk

Hi,

I’ve just started experimenting with building for iOS, and ran into a problem with avian-openjdk out of the box.

I’m on OSX 10.11.4 with Xcode 7.3.
I installed the latest SDK, 3.1-pony (3.1-alpha4).
Created a new default project and checked it ran ok.
Went to Project Properties => Application => iOS, checked ‘Enable iOS deployment’ with ‘iOS SDK Version’ 9.3
I get the error below but nothing in the log, even at FINE.

I can see that the avian-openjdk directory is created in "Application Support/jmonkeyplatform/3.1.0-alpha4, but it contains only one file, .zipextversion. If I delete avian-openjdk, then disable and re-enable the iOS build the same thing happens.

Any suggestions or attempts to reproduce would be much appreciated.

I’ll take a look into it.
I actually experienced the Same Issue when adding iOS Support, but I couldn’t reproduce it.
This is because it’s downloaded to Application Support/ which is where I didn’t look into :smiley:

Unfortunately the SDK Code uses Exceptions.printStackTrace() quite often which only prints to STDOUT, so you might see something when running it from Console.

btw: If you want to get rid of pink, just see our “Darkmonkey as SDK Default” Thread on how to change the color scheme.

Thanks very much. I briefly tried building avian myself, but didn’t have much luck. And the pink is fine by me :grinning:

Also, I just reproduced the error while running the jmonkeyplatform.app/Contents/MacOS/jmonkeyplatform binary directly from Terminal. I didn’t get anything on stdout.

So the Issue is that we try to extract avian from nbres:/com/jme3/gde/ios/avian-openjdk-mac.zip which should be located inside nbres:/com/jme3/gde/ios/ios-data.zip it seems.

I’ll take a closer look, maybe it’s downloaded and the download just fails, but fact is that it misses the avian-openjdk-mac.zip

Edit: Yep, building avian isn’t part of the default task so it’s not included currently. I try to have it working, but I’m on 10.9.5.

The way to go is to cd in jme3-ios, call “ant package-avian” and fix the problems :wink:

1 Like

So see here for Instructions on how to get Avian working.

The Problem is that there are still compilation errors, all because of some duplicate definitions either between OS-Headers or openJDK Headers and their Source Files.

I hope running a newer OS fixes this.
If not, I could leave out the openJDK, that way you have limited classes but at least a temporary working Avian.

@normen Did you encounter such problems?

Edit: I tried my best now for the last 6 hours but I can’t get it to work :cry: :chimpanzee_cry:

1 Like

The iOS module project has an ANT target for building avian.

Yes I know, package-avian, but I get dozens of build errors like e.g.

     [exec] build/ios-arm-interpret-openjdk-src/openjdk/ZipFile.c:82:25: error: conflicting types for 'Java_java_util_zip_ZipFile_open'
     [exec] JNIEXPORT jlong JNICALL Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name, jint mode, jlong lastModified)
     [exec]                         ^
     [exec] build/ios-arm-interpret-openjdk-src/openjdk/java_util_zip_ZipFile.h:69:25: note: previous declaration is here
     [exec] JNIEXPORT jlong JNICALL Java_java_util_zip_ZipFile_open
     [exec]                         ^
     [exec] 1 error generated.
     [exec] make[1]: *** [build/ios-arm-interpret-openjdk-src/openjdk/share/native/java/util/zip/ZipFile-openjdk.o] Error 1

And even before that I had some conflict with an JDK Method being called the same as something already defined as a macro in the includes

Then you’re using either the wrong JDK, the wrong JDK sources or the wrong combination of JDK and sources.

Could someone update avian in the alpha release? The error extracting avian is still a problem.

Hey,
We couldn’t fix it so far.
Actually part of it is that I don’t run the latest OSX but in general it’s buggy…

Why don’t you try to build it yourself?
The Instructions are linked above and for the correct download, I suggest:

wget https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-macosx-x86_64-image.zip
unzip openjdk-1.7.0-u80-unofficial-macosx-x86_64-image.zip
hg clone http://hg.openjdk.java.net/jdk7u/jdk7u
cd jdk7u
bash get_source.sh
cd jdk/
hg checkout jdk7u80-b32
cd ../hotspot/
hg checkout jdk7u80-b32
cd ../..
git clone git@github.com:readytalk/avian
git clone git@github.com:readytalk/hello-ios

make sure to also apply the Pull Request on Avian (update to iOS 9.2 SDK and define sysroot for iOS by dicej · Pull Request #480 · ReadyTalk/avian · GitHub)

Hi, I can’t get it to compile.

I’m not 100 percent sure I’ve got the folders correctly downloaded.

This is my project properties pointing to the folders I downloaded with your help.

avian compile locations

avian.jdk.path=/Users/ant/Documents/codeimport/openjdk-1.7.0-u80-unofficial-macosx-x86_64-image/
avian.jdk.src.path=/Users/ant/Documents/codeimport/jdk7u/jdk/
avian.src.path=/Users/ant/Documents/codeimport/avian/
hello-ios.src.path=/Users/ant/Documents/codeimport/hello-ios/

This is the error I get when running the avian package build script.
sources.check:
sources.error:
package-avian:
removing build directories
makefile:819: *** “couldn’t find SDK”. Stop.
/Users/ant/Desktop/installs/sdk-master/jme3-ios/build.xml:58: exec returned: 2
BUILD FAILED (total time: 1 second)

Any ideas? Please help.

This sounds like you’re missing the iPhone SDKs (Installing XCode and downloading them)

No it’s not that because it works fine with 3.0.10

I’ve tried with Xcode 6.4 which compiles SDK 8.4 and works ok.

I’ve currently got Xcode 7.3 which only runs on El Capitan and that SDK is 9.3 which also works on 3.0.10.

I’ve tried using 3.0.10 to download and extract Avian and then copy the Avian folder in place for 3.1 and it complains that the JmeAppHarness file is the wrong version.

I guess, that’s because JmeAppHarness wasn’t ported to 3.1…

Obviously IGLESShaderRenderer doesn’t exist any more. You could replace it with GLRenderer and rename onFrame() to postFrame()… but I ran into a dead end… (for alpha1) giving up…

I see what you mean, but even if I did manage to get Avian to update with the PACKAGE AVIAN build script that would mean the JmeAppHarness would still be the unported/old one so are we saying that it wouldn’t work anyway?

I tried it with alpha1… and couldn’t get it running… I guess, it’s very likely that for alpha4 wouldn’t run, too, until you see some updates in the ios repository…

Nevertheless please try it…

Hi, I did manage to make a bit of progress.

The ‘Unable to insert branch island’ error is because the boot image created is over the maximum size. I guess you knew that.

One thing you should try is by supplying the lzma= argument to the MAKE. You should use version 920.

When I try to add LZMA into the build.xml it complains because there is no specified target. When it comes to creating targets for the ANT build I’m a bit lost so if you can do that then I believe the images will be compressed during the build so should bring it under the maximum.

Also, the existing PACKAGE-AVIAN doesn’t use pro guard until after the images have been created and just before creating the ZIP file. The problem as you know it doesn’t get that far because it can’t create the ARM image at all. There is a switch ‘use-proguard’ in MAKE but again I’m not able to implement that in the build.xml.

I did manage to build the images by using the ANDROID libraries which I know is not going to work, but it at least let me create the AVIAN-OPENJDK-MAC.zip and add it in.

Then I discovered that if you build then it fails because JMEAPPHARNESS.class is now build using JDK 1.8 level. Therefore it complains that the version of the class is 52 which v1.8 and should be 51.

I added -source=1.7 and target=1.7 in the specific part that builds the native java classes and that worked. The reason this is a problem is because 3.1 is compiling with JDK 1.8 and the JAVAC parameters are not pulled from the properties file (only for native compile).

Then I discovered that the IOS.PROPERTIES needs to be re-done to match the new JAR files.

One more point is that the HELLO.IOS project that the IOS project is based on has been completely re-written due too many depreciations in XCODE so that will need to be re-integrated too.

That’s all I’ve got for now but if someone is able to implement the LZMA option into the ant build then it’s a good start.

Well my approach was much simpler:
I used Avian from jME 3.0 installation and I could patch and compile my project.
BTW That was jME 3.1-alpha-1.

The patch was:
JmeAppHarness.java: replace IGLESShaderRenderer with GLRenderer, replace onFrame() with postFrame()

But as I suspected that just makes it compilable. The app crashes with:

Thread 1Queue : com.apple.main-thread (serial)
#0  0x0024eb10 in com/jme3/renderer/opengl/GLRenderer.loadExtensions()Ljava/util/HashSet; ()
#1  0x0024f6b8 in com/jme3/renderer/opengl/GLRenderer.loadCapabilitiesCommon()V ()
#2  0x00252058 in com/jme3/renderer/opengl/GLRenderer.loadCapabilities()V ()
#3  0x002521e8 in com/jme3/renderer/opengl/GLRenderer.initialize()V ()
#4  0x002bdcbc in com/jme3/system/ios/IGLESContext.create(Z)V ()
#5  0x0017a4c4 in com/jme3/app/Application.start(Lcom/jme3/system/JmeContext$Type;Z)V ()
#6  0x0017a170 in com/jme3/app/Application.start()V ()
#7  0x0017d8cc in com/jme3/app/SimpleApplication.start()V ()
#8  0x0067a558 in JmeAppHarness.<init>(J)V ()

So my guess was that someone of the core team has to look at it. IIRC I posted the stacktrace above already somewhere and I was told that @Kostyantyn could fix it.
That was almost one year ago. But now I’m glad, that there are already two of us. :grin:

So you aren’t forgotten, I tried my best and could at least work around a few bugs with the awesome help of the avian team.

There seems to be a bug though in XCode 6’s clang which prevents me from supplying avian’s i386 architecture. This is only relevant for the iOS Simulator though, so you simply have to build for x86_64 when you want the Simulator.

Anyway after now having fixed all of this which I will commit in the following few days.
If you have such a problem then run it in Debug on the iOS Simulator, it’d show you:

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
→ This is a classical NPE in LoadExtensions(HashSet).
I don’t know why we can’t catch that Exception, probably because it’s in the contructor.

5 Likes

So due to Github Limitations and since it’s not 100% tested, you currently need the following to try out iOS Support:

  1. Checkout the latest version of the SDK
  2. Execute build_engine.sh
  3. Execute jme3-ios/build_avian.sh (or download from here)
  4. Execute ./gradlew buildSdk && ant run
  5. In the SDK have your Project and select iOS Deployment Options
  6. Click Clean and Build and wait
  7. Open the freshly created XCode Project and launch it

When XCode complains about some Unsatisfied Link because of i386, then select “Only build active architecture” or something in the Project Properties. It’s somehow a bug in my XCode at least.

Enjoy!

6 Likes