[4.0.5.0/UE4.10/VS2015] NDK error when building to Android

Options
So I've debugged everything that arose from upgrading to the 4.0.5.0 SDKs. One last error, it seems. But it's a weird one. Here's the section of the UE4 output log when I was building that did the thing:

Performing 2 actions (4 in parallel) [1/2] clang++.exe PhotonLBClient.cpp [armv7-es2] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Assertion failed! Program: C:\NVPACK\android-ndk-r10e\toolchains\llvm-3.6\prebuilt\windows-x86_64\bin\clang++.exe File: /s/ndk-toolchain/src/llvm-3.6/llvm/lib/Transforms/Utils/ValueMapper.cpp, Line 368 Expression: Node->isResolved() && "Unexpected unresolved node" clang++.exe: error: clang frontend command failed with exit code 3 (use -v to see invocation) clang version 3.6 Target: armv7-none-linux-androideabi Thread model: posix clang++.exe: note: diagnostic msg: PLEASE submit a bug report to http://source.android.com/source/report-bugs.html and include the crash backtrace, preprocessed source, and associated run script. clang++.exe: note: diagnostic msg: ********************

Apparently there's some conflict with Photon and the Android NDK UE4.10 is using? Idk. This issue does not arise with a fresh UE4.10 c++ project, so it would seem it has something to do with Photon. I'm using the -cpp-static_debug_android_armeabi_no-rtti.a libs for Android, if that means anything to you. I also made the appropriate edits to some Photon files according to the readme in the demo project.

Like I said, everything else is debugged. This is the only error. Curiously, this error did not seem to show up so early when I was experiencing other Photon-related bugs. Maybe that's because there's no bugs and now it can focus on this crap?

I also saw someone mention this same error here: https://code.google.com/p/android/issues/detail?id=184758&q=component%3DTools%20label%3AReportedBy-User&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

But it's not for a UE4 project.

So close to having everything work! It's always the last bug that's the weirdest...

Comments

  • DG Gage
    DG Gage
    edited January 2016
    Options
    Here's something interesting: One of the last "debugs" I did was actually read the demo readme, which told me to:



    4. Modify the Photon headers to fix an RTTI detection issue that would otherwise appear when compiling with UE4:

    Photon/Common-cpp/inc/Helpers/TypeName.h
    -#if defined _CPPRTTI || defined __GXX_RTTI || (__GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 3 || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 2))))
    +#if defined _CPPRTTI || defined __GXX_RTTI 


    I don't remember that NDK error happening before I made that change, so I changed it back. Naturally, I got some TYPENAME/rtti errors when building to Android, just like before.

    But I did NOT receive the NDK error when reverting this.

    So that should narrow this problem down quite a bit.
  • DG Gage
    Options
    Help me Kaiserludi Kenobi.

    You're my only hope.
  • DG Gage
    DG Gage
    edited January 2016
    Options
    Victory approaches.
  • Kaiserludi
    Kaiserludi admin
    edited January 2016
    Options
    Hi @DG Gage.

    Yes, this is indeed a weird one, but fortunately its a known issue that I have tracked down last month already :)

    This crash is neither caused by a bug in Photon nor in Unreal Engine nor in your code, but by a bug inside the clang compiler that is used by the NDK as you can read in your link:

    Verified that this is an old 3.6 NDK clang/llvm bug.
    It should be fixed in a newer 3.6 and latest 3.8, and will be in the new NDK.
    As you can see, this bug is supposed to be fixed since about some time in September-December 2015. Unfortunately Google has not released any new version of their NDK since the r10e release back in May 2015. Fortunately r10e is the first NDK which uses version 3.6 of clang. Older versions of clang like 3.4 do not have this bug, so that earlier NDK versions like r10d or r10c - which use version 3.4 of clang - are not affected by it, which we have verified ourselves last month.

    Therefor I suggest that you switch to r10d until r10f (or r11, if that should be the next version) gets released.

    I don't remember that NDK error happening before I made that change, so I changed it back. Naturally, I got some TYPENAME/rtti errors when building to Android, just like before.

    But I did NOT receive the NDK error when reverting this.
    Interesting.

    How did you get around the rtti compilation errors, so that you could test that you did not receive that runtime crash anymore?

    Victory approaches.
    Please be a little bit more specific :)
  • DG Gage
    Options
    Ah okay, great. So... how do I use r10d or r10c instead of the current one with UE4.10? Some setting in AndroidWorks on a reinstall maybe?

    Oh... well since you ask it like that... I guess what was happening is that because of the rtti errors, I was not yet at a point where I would see the NDK errors.

    Victory = things work. One thing stands in my way. And you are here. It will happen.
  • DG Gage
    Options
    UE4 has an option to choose a directory for the NDK... so I can probably just download it and point to it. I'll update you.
  • Kaiserludi
    Options
    Just download the NDK seperately at http://developer.android.com/ndk/downloads/index.html.

    They only show a link there to the latest version, which is r10e, but you can just change the version of the NDK in the download link to get a link to a downlaod of whaever version you want.
    So for example http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86_64.exe is the 64 bit Windows installer for r10d.

    When running the installer remember the path you install it to.

    Afterwards just adjust the path to the NDK in the UE SDK config (the screen that you can see at https://forums.unrealengine.com/showthread.php?78171-Correct-Setup-for-Android-(which-versions-for-JDK-SDK-NDK-ANT-)&amp;p=342697&amp;viewfull=1#post342697) to point to your new NDK installation.
  • DG Gage
    Options
    I downloaded r10c, pointed to it in UE4 in the Android SDK settings, and I am still getting the exact same error. Almost like it's stuck in its ways and doesn't wanna change NDKs. I am positive I am pointing to the correct directory, but the build error still mentions the r10e location. Maybe if I (uh oh) delete r10e...
  • DG Gage
    Options
    So now it's just complaining that it can't find the r10e directory. Nice. Might be time for an engine re-install. Not the first time I've seen the builder get stubborn and lock into something that doesn't exist
  • DG Gage
    Options
    What if I rename the r10c folder to r10e

    Hacks.
  • DG Gage
    Options
    Nope. Welp. For some reason it just really does not want to use anything else. Unless you have an idea, I'm going to reinstall UE4
  • Kaiserludi
    Options
    Hmm, was the old r10e folder at the same path as the r10c one? In that case a rename should actually do it.

    Another less hacky approach would be to navigate to the Windows environment variables and edit the variables for NDK to refer to your r10c install. I am not sure which environment variable UE is using and there may be multiple NDK env variable, so be sure that you don't overlook any (ANDROID_NDK_ROOT and NDKROOT would be the usual suspects as well as PATH). You may also have an NVPACK environment variable that UE may potentially use to look for the NDK in a subfolder of the path specified for the nvpack. If that should be the case, just move your r10c folder into that location.
  • DG Gage
    Options
    It was the exact same error as above, so it was probably wanting something slightly more specific than just the name of the directory file.

    That sounds interesting. It does mention in the tooltips in the UE4 Android SDK settings that it defaults to NDKROOT. Where can I find these variables?

    I'm also deleting r10e completely from my drive, keeping r10c inside NVPACK, to avoid any further weirdness. But maybe Windows itself is still stuck on a feeling?
  • DG Gage
    Options
    Engine reinstall did the trick. Build successful!

    For anyone stumbling across this issue:
    - Follow Photon SDK instructions in the UE4 particle demo readme
    - Delete the r10e NDK directory from your C:\NVPACK
    - Replace with r10c or r10d NDK directory
    - (might not be necessary) In UE4's Android SDK settings, make sure the NDK section points to your r10c or r10d directory
    - Reinstall UE4
  • DG Gage
    Options
    Thanks Stefan! You rocked my world yet again.