googlevr / gvr-unity-sdk

Google VR SDK for Unity
http://developers.google.com/vr/unity/
Other
2.71k stars 1.09k forks source link

Problems Compiling with IL2CPP #42

Closed nosmirck closed 9 years ago

nosmirck commented 9 years ago

SOLVED TL;DR: If you are having compilation errors with XCode saying that one library "is not 8-byte aligned for architecture arm64" just upgrade your XCode to the latest version (as of this date it is v6.4)

Hi, I've been trying to compile my App for iOS, since a few weeks now iOS is forcing everyone to upload the new apps and updates with 64bit support, so, Unity has a new way to compile for iOS called IL2CPP. If you want support for both 32 and 64 bits, you must check "Universal".

The thing is that I am Using Unity 4.6.6f1 (pro) with the latest cardboard plugin. If I compile with Mono 2.x it works like a charm, everything work perfectly, even on iPad 2, it renders smaller to fit the cardboard. I can even run the app with iOS 7.1. I tried to upload to the appstore and apple rejected immediately the submission because it didn't have 64bits support.

Then I just went to the player settings, compiled with IL2CPP Universal, disabled the striping level (just in case) and went to Xcode to test. The result: 1 error and I can't find ANYTHING about it ANYWHERE. Google shows 0 results. I don't really know if this is related to Unity only (something they have done wrong) if I'm missing something (maybe some Xcode stuff I didn't do correctly) or related to the plugin... anyways, if anyone here can help me solve this I'll gladly appreciate it.

More info:

ld: 64-bit LDR/STR not 8-byte aligned: from l005 (0x100D1D540) to l036@0x00001304 (0x100ED4774) in 'l005' from /Users/nosmirck/Desktop/build/Libraries/libplatform.a(RotateToLandscapeViewController.o) for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thanks in advance guys!

Best Regards,

Luis.

lesmo commented 9 years ago

So... I've had a similar issue with libPhone.a so maybe you could try this: check that libplatform.a is in fact in the project's linked frameworks and libraries. If it's already there, remove it and add it back again.

El sáb., jun. 27, 2015 1:25 AM, Luis Pulido notifications@github.com escribió:

Hi, I've been trying to compile my App for iOS, since a few weeks now iOS is forcing everyone to upload the new apps and updates with 64bit support, so, Unity has a new way to compile for iOS called IL2CPP. If you want support for both 32 and 64 bits, you must check "Universal".

The thing is that I am Using Unity 4.6.6f1 (pro) with the latest cardboard plugin. If I compile with Mono 2.x it works like a charm, everything work perfectly, even on iPad 2, it renders smaller to fit the cardboard. I can even run the app with iOS 7.1. I tried to upload to the appstore and apple rejected immediately the submission because it didn't have 64bits support.

Then I just went to the player settings, compiled with IL2CPP Universal, disabled the striping level (just in case) and went to Xcode to test. The result: 1 error and I can't find ANYTHING about it ANYWHERE. Google shows 0 results. I don't really know if this is related to Unity only (something they have done wrong) if I'm missing something (maybe some Xcode stuff I didn't do correctly) or related to the plugin... anyways, if anyone here can help me solve this I'll gladly appreciate it.

More info:

  • I followed the steps just like the instructions said (added CoreText, libc++, added resources.bundle)
  • The project doesn't have any other plugins (except only for one to reproduce videos, "mobile movie texture" latest version)
  • The error is this:

ld: 64-bit LDR/STR not 8-byte aligned: from l005 (0x100D1D540) to l036@0x00001304 (0x100ED4774) in 'l005' from /Users/nosmirck/Desktop/build/Libraries/libplatform.a(RotateToLandscapeViewController.o) for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thanks in advance guys!

Best Regards,

Luis.

— Reply to this email directly or view it on GitHub https://github.com/googlesamples/cardboard-unity/issues/42.

nosmirck commented 9 years ago

Hi lesmo, thanks for the help, I just tried what you said, same problem appears, same error, same library...

The libplatform.a was in fact in the linked libraries, I removed as you suggested and added it again, compiled and the same error came again.

What else can I do?

nosmirck commented 9 years ago

UPDATE: I moved the whole project to Unity 5, I had to fix some issues (skybox missing) and again compiled under the same settings as before (IL2CPP, Universal, no striping) opened in Xcode and tried to compile, the first error that came up was that it couldn't find the LibraryPlugin folder, I checked the libraries paths and there was a backslash "\" between Libary and Plugin (I don't know why) but I just changed it to a forward slash "/" and that error is gone.

Now, trying to compile again and after all the almost 400 files where compiled, it failed on linking, saying that libbase.a has not 8-byte aligned for architecture arm64.

This is the error:

ld: 64-bit LDR/STR not 8-byte aligned: from __ZNSt3__118condition_variable8wait_forIxNS_5ratioILl1ELl1000000000EEEEENS_9cv_statusERNS_11unique_lockINS_5mutexEEERKNS_6chrono8durationIT_T0_EE (0x100602620) to l007@0x00000F04 (0x10127B944) in '__ZNSt3__118condition_variable8wait_forIxNS_5ratioILl1ELl1000000000EEEEENS_9cv_statusERNS_11unique_lockINS_5mutexEEERKNS_6chrono8durationIT_T0_EE' from /Users/nosmirck/Desktop/iosbuildu5/Libraries/Plugins/iOS/libbase.a(task_loop.o) for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

So I tried what @lesmo suggested (removing and adding the library) but it didn't work, the same error appeared.

I'd really like to receive an answer from the developers of this plugin, maybe something is missing and I can't figure it out.

Thanks in advance for any help you could bring.

smdol commented 9 years ago

I am able to build and run an IL2CPP Universal version of the SDK's demo scene, starting from a fresh project and importing the SDK. This worked in both Unity 4.6.4 and 5.1.0. I left most of the settings like stripping and Mono level.

Could you try this step, and see if you get the same results? (Either I missed something you did or there is some other issue at work here.)

nosmirck commented 9 years ago

Well, I forgot to mention I did this all from PC (windows 7) Unity 5.1.1p1. I mentioned I'm using a plugin (aside from cardboard) that is mobile movie texture, latest version, but the issues are always with random libraries from the cardboard. I'm going to try now installing Unity on the Mac (I didn't before because I have no space on hard drive, but I just got an external drive to do this) I'll report back when I try this.

Anyways I did what you said just when I moved the project to Unity 5. I removed and deleted everything related to cardboard and mobile movie texture and reimported from scratch both plugins.

The project has nothing else, strange thing is that it is showing me the same linking error I got the first time (when I was using 4.6.6) but with a different library now on 5.1.1.

I'll let you know how it went.

smdol commented 9 years ago

OK. I recommend trying with a new blank project for the "nothing but cardboard" experiment. Trying to scrub stuff out of a Unity project is tricky because all kinds of changes lurk in various places. Then if that works, add in the other plugin to this new project and try again.

nosmirck commented 9 years ago

@smdol Ok, I just tried "nothing but cardboard" and I got the same error with the same library (libbase.a(task_loop.o) linker error).

So I guess the error is because I'm compiling from windows and copying the result folder to my mac...

I'm going to try compiling the whole project on the mac directly. I'll update in a few hours.

nosmirck commented 9 years ago

I just compiled the whole project from the mac on Unity 4.6.3 (the one I have installed for now, 5 is downloading) and I got the same error with libplatform.a.

I created a new project from scratch on the mac with Unity 4.6.3, added only cardboard (v0.5) and tried to compile with the example (treasure) and I got the same error with the same library (libplatform.a).

So, I guess there is something wrong with the compiled libraries for iOS arm64 or I'm doing something wrong...

smdol commented 9 years ago

When you created your nothing-but-cardboard project, what build settings did you change? I'll try the same. Also, did you unpack the unity package on the Mac, or copy the files from Windows? Make sure to try unpacking on the Mac. (Let's get Windows completely out of the equation.)

nosmirck commented 9 years ago

UPDATE:

Still failing.

What I've done so far:

1) Moved the project to my Mac, installed Unity 5.1.1f1 and opened there (I had a Unity5 backup before moving to 4.6.6) 1.a) Simply I built the project, opened in XCode, tried to build = same error with libbase.a 1.b) Deleted the Plugin folder from the Unity Project and imported the plugins again (re-downloaded from here and the other from Asset Store), Built, opened in XCode, build, = same error with libbase.a

2) Created a new project from scratch, added ONLY cardboard plugin, added the demoscene to the build 2.a) Built, opened in XCode, build = same error with libbase.a 2.b) Deleted everything (empty project) created a new scene, added a cube, built, opened in XCode, build, success.

My configuration:

How I am building from Unity5 (Mac OS X 10.10.2):

How I am building from XCode:

So, I still don't think there is a problem with cardboard plugin, I'm currently upgrading my Xcode to 6.4 to see if this solves my problem, still, I'd like you to check this out, please use the same .unitypackage we are all using from the releases tab.

I'll come back here with updates when I upgrade XCode.

nosmirck commented 9 years ago

Ok, after upgrading XCode to 6.4, even the first build from windows worked just fine... I want to close this thread now that the issue is solved, but you should mention in the instructions that it requires XCode 6.4 because it doesn't say anywhere that it needs to be built from an specific version of XCode. Thanks anyways for the help!! you are doing a great job!