LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.76k stars 634 forks source link

Android port does not compile #354

Open LunarWatcher opened 6 years ago

LunarWatcher commented 6 years ago

Environment

Description

I did everything it said on the setup page, and after getting through the etc errors I finally got down to the native compile (c/c++ files). When compiling, I'm getting this error:

compile-native-platform:
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\util\xxhash\org_lwjgl_util_xxhash_LibXXHash.c:6:
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler]  #include <inttypes.h>
 [Compiler]                       ^
 [Compiler] compilation terminated.
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\nuklear\org_lwjgl_nuklear_Nuklear.c:10:
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\util\par\org_lwjgl_util_par_LibPar.c:6:
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\openvr\org_lwjgl_openvr_VRCompositor.c:6:
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\stb\org_lwjgl_stb_LibSTB.c:6:
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\util\xxhash\org_lwjgl_util_xxhash_XXHash.c:9:
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler]  #include <inttypes.h>
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler]  #include <inttypes.h>
 [Compiler]  #include <inttypes.h>
 [Compiler]  #include <inttypes.h>
 [Compiler]                       ^
 [Compiler] compilation terminated.
 [Compiler]                  from D:\programming\lwjgl3\lwjgl3\modules\core\src\generated\c\system\android\org_lwjgl_system_android_ANativeWindow.c:6:
 [Compiler]                       ^
 [Compiler] ../../../../modules\core\src\main\c/system/linux/LinuxConfig.h:7:22: fatal error: inttypes.h: No such file or directory
 [Compiler]  #include <inttypes.h>
 [Compiler]                       ^
 [Compiler] compilation terminated.
 [Compiler]  #include <inttypes.h>
 [Compiler] compilation terminated.
 [Compiler]                       ^
 [Compiler] compilation terminated.
 [Compiler]                       ^
 [Compiler]                       ^
 [Compiler] compilation terminated.
 [Compiler] compilation terminated.
 [Compiler] In file included from ../../../../modules\core\src\main\c/system/common_tools.h:11:0,
BUILD FAILED
D:\programming\lwjgl3\lwjgl3\build.xml:442: The following error occurred while executing this line:
D:\programming\lwjgl3\lwjgl3\config\android\build.xml:247: The following error occurred while executing this line:
D:\programming\lwjgl3\lwjgl3\config\android\build.xml:60: The following error occurred while executing this line:
D:\programming\lwjgl3\lwjgl3\config\android\build.xml:31: apply returned: 1

I checked some other issues like this one, and it looks like the file has been removed completely. This references the same thing, though this SO post with a download link. Downloading and adding the files to the project cause different exceptions, most notably that it has to be compiled in Visual Studio.

I can't use VS since the project is designed for IntelliJ. And there's (currently) no way to import IntelliJ projects into VS. Removing the throws cause different exceptions for different files that aren't found.

TL:DR; inttypes.h doesn't exist anymore. How can I get it to compile?


I have already had to add retrolambda and tweak a lot to get it to run at all, which is annoying given the "just run it" description in the android-test repo. Does the Android port even work?


Reproduction:

Spasi commented 6 years ago

You're not supposed to use msvc to compile the Android branch. You must set the ANDROID_SDK_HOME environment variable to point to the Android SDK and LWJGL will use the NDK toolchain to build everything.

LunarWatcher commented 6 years ago

ANDROID_SDK_HOME is set, it points to the root where the NDK is installed in the default install location. The NDK was used in the first place, my attempt on using a downloaded inttypes.h file was an attempt to get it to work. With or without the NDK, it doesn't compile.

I have done about 5 re-clones by now, and every single time it fails to build with some kind of error. After pushing through errors with retrolambda missing, jdk tools missing and a bunch of other errors I get to this, which I can't get past because it doesn't exist and can't be used any more. The SDK home is set, Java home is set, running the ant build still fails

Spasi commented 6 years ago

This could be an issue with NDK 16, which has the unified headers only. In my setup there are 64 different inttypes.h files, but I have not upgraded to 16 yet. I'll post again when I have time to test it.

LunarWatcher commented 6 years ago

Using the NDK archive I manually downloaded the previous NDK version (r15c). It's transferring into the NDK-bundle folder right now, I'll post again if I can get it to work with a different version. I'm going to try the previous three versions until I either get through all or find one that works

LunarWatcher commented 6 years ago

Using r15c works perfectly, it compiles now. Some of the other issues I had were related to sloppy environment variable setting cough

Revision 16 breaks the build, probably due to the unified headers you mentioned.

djwillcaine commented 4 years ago

Just ran into this issue when compiling for android. First off retrolambda.jar was misssing from the lib directory but you can download that from here, once that was sorted I got the same error. Rolling back to r15c as @LunarWatcher suggested worked though.