baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.86k stars 1.33k forks source link

Build fails if java in PATH is older than version 8 #1137

Closed ArronYeh closed 5 years ago

ArronYeh commented 5 years ago

Description

compiling Android version fail, error message as following

[100%] Generating ../bin/org.renderdoc.renderdoccmd.arm32.apk Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:803) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) renderdoccmd/CMakeFiles/apk.dir/build.make:62: recipe for target 'bin/org.renderdoc.renderdoccmd.arm32.apk' failed make[2]: [bin/org.renderdoc.renderdoccmd.arm32.apk] Error 1 CMakeFiles/Makefile2:457: recipe for target 'renderdoccmd/CMakeFiles/apk.dir/all' failed make[1]: [renderdoccmd/CMakeFiles/apk.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

Repro steps

$ cmake -DBUILD_ANDROID=On -DANDROID_ABI=armeabi-v7a .. $ make

Environment

cmake config as following -- Check for working CXX compiler: /media/ssd/RenderDoc_source/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features - done -- Check for working C compiler: /media/ssd/RenderDoc_source/android-ndk-r14b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works -- Detecting C compiler ABI info - done -- Detecting C compile features - done -- Calculating version -- Building RenderDoc version 1.2 -- Disabling GL driver on android -- Disabling qrenderdoc for android build -- Disabling renderdoc python modules for android build -- Using Android ABI armeabi-v7a -- Using Android native API level 21 -- Interceptor-lib not enabled (USE_INTERCEPTOR_LIB) - android hooking will use sometimes less reliable PLT-interception method. -- Using Android build-tools version 26.0.1 -- Using android.jar from platform android-23 -- Building APK versionCode 12, versionName c13214272389d8514a508bece50a93ff88051e24 -- Enabled APIs: -- - OpenGL ES (EGL) -- - Vulkan -- Configuring done -- Generating done

others openjdk-8-jdk is already the newest version (8u181-b13-0ubuntu0.16.04.1). JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ cmake version 3.6.3

baldurk commented 5 years ago

I don't have an idea immediately what would cause this, I haven't seen the error before. Searching for it on google suggests that it's caused by the java source in the android SDK being too new for the JDK/JRE you're using, though supposedly java 8 should be new enough for version 52.0.

I would suggest double checking that the javac being used is definitely the one you think, by running make --trace to see the commands executed. The JAVA_HOME variable is captured when cmake is run at first so perhaps cmake has cached an older JDK.

If not that, then if you can't upgrade your JDK you could possibly downgrade the android SDK you're using to one compatible with an older JDK.

mi2think commented 5 years ago

I don't have an idea immediately what would cause this, I haven't seen the error before. Searching for it on google suggests that it's caused by the java source in the android SDK being too new for the JDK/JRE you're using, though supposedly java 8 should be new enough for version 52.0.

I would suggest double checking that the javac being used is definitely the one you think, by running make --trace to see the commands executed. The JAVA_HOME variable is captured when cmake is run at first so perhaps cmake has cached an older JDK.

If not that, then if you can't upgrade your JDK you could possibly downgrade the android SDK you're using to one compatible with an older JDK.

Hi, I'm doubt why not provide a android apk of renderdoc, like provide a PC install file in renderdoc site?

baldurk commented 5 years ago

I'm sorry I'm not sure I understand, binary builds are provided. All of the stable versioned releases as well as nightly builds include compiled android APKs which also use interceptor-lib (which is difficult to compile locally): https://renderdoc.org/builds

This issue is about someone who wants to compile the android apk locally perhaps with local changes or for debugging, so those wouldn't be useful.

mi2think commented 5 years ago

I'm sorry I'm not sure I understand, binary builds are provided. All of the stable versioned releases as well as nightly builds include compiled android APKs which also use interceptor-lib (which is difficult to compile locally): https://renderdoc.org/builds

This issue is about someone who wants to compile the android apk locally perhaps with local changes or for debugging, so those wouldn't be useful.

Sorry, first I didn't find apk in "RenderDo/plugins/android" directory, so I get a "no sever running" tips. After I install apk to phone manually, it works. I mean maybe somone like me didn't know where to find apk, since in your links post, It just say "Win x86/64" or "Linux x64".

Maybe show the directory of apk in How do I use RenderDoc on Android? is a useful tips.

ArronYeh commented 5 years ago

Hi, I have tried the apk you provided, it indeed workable! However, RenderDoc can't capture most of our android apk, although these apks can be launched by RenderDoc correctly. The error message is OpenGLES(Not Presenting) So, we trying to find out the cause of this situation.

ArronYeh commented 5 years ago

The brief of our apk architecture as following: Main thread: only handles the events, may not invoke any OpengGL APIs. Render to Texture and present 3D texture to native window may be handled by other assistant threads. Is it possible to capture the OpengGL information through RenderDoc?

baldurk commented 5 years ago

Please try not to add multiple different issues from different people into this bug, it makes it very difficult for me to track.

@mi2think your problem is not related to this one. You should never have to install the APK manually, and installing an incompatible android APK could lead to subtle problems. The Win x86/64 and Linux x64 links refer to the OS for the host computer, which is why android is not mentioned. The same android support should be included with all builds.

Can you please open a new issue about that and give me more information? Please include where you originally installed from, exactly what build, and whether you can reproduce it by reinstalling. If you originally installed a nightly build then it's possible that night android compilation failed leading to a build without the APKs, but the stable builds should always have the APKs.

@ArronYeh Please keep this about the original compilation issue, that will also help anyone else who has the same problem and finds it. For your problems capturing can you please open a new issue to discuss it with as much information as you can provide and a repro case if possible. That way if either issue is resolved there is a clear solution.

ArronYeh commented 5 years ago

Hi Baldurk, sorry for your inconvenience, build RenderDoc of android version locally may be the main target of the issue.

The JDK is the one which I expected. ( checked through make --trace )

baldurk commented 5 years ago

What's the version of java in your path? If you run:

$ java --version
$ $JAVA_HOME/bin/java --version

What do you get? Are they the same versions or different?

ArronYeh commented 5 years ago

HI baldurk, This issue is solved by following your suggestion. The root cause of this issue is I used different java $ java --version => "1.7.0_95" $ $JAVA_HOME/bin/java --version => "1.8.0_181"

solution: $ sudo update-alternatives --config java select version 1.8

org.renderdoc.renderdoccmd.arm32.apk is generated and work correctly. Thanks for your help :)

baldurk commented 5 years ago

OK thanks, I'll add a check to the cmake file to make sure the java version in the path is at at least 1.8, since it seems like some of the android SDK utilities run it instead of using $JAVA_HOME.