5 ms·
The Android NDK just barely supports C and C++ either, unless you're ok with 1990's tooling standards. The whole thing feels like it's maintained by two dudes l
by flohofwoe 1y ago
The Android NDK just barely supports C and C++ either, unless you're ok with 1990's tooling standards. The whole thing feels like it's maintained by two dudes locked in a Google basement somewhere. I doubt they have the capacity to deal with Rust support in the NDK, unless there's a big strategic change in Android tooling.
- cogman10 1y agoI'm not sure what you mean by this. Looking at a sample app [1] for the NDK, the tooling appears to be gradle and Cmake. Cmake isn't the newest of tools, but it's also not that dated. [1] https://github.com/android/ndk-samples/tree/main/endless-tunnel/app https://github.com/android/ndk-samples/tree/main/endless-tun...
- flohofwoe 1y agoBoth Gradle and CMake have a strong late 1990's smell to them. While CMake is sort of a necessary evil in the C/C++ world, there's no excuse for dragging Gradle into the NDK, combining both build tools leads to a complexity explosion that rarely works and tends to break after either the NDK or SDK is updated, or somebody merely looks the wrong way at the build files.
- pjmlp 1y agoCMake is the defacto tool adopted by the industry, regardless how many love to hate it. You can use BSD Make instead of Gradle, isn't UNIX great?
- flohofwoe 1y ago> You can use BSD Make instead of Gradle, isn't UNIX great? So the NDK officially supports creating an APK just with a Makefile? That would be news to me (and great news at that). It is possible to cobble together a build process that directly calls various Android SDK command line tools to build an APK directly from a C/C++ build tool without involving Gradle, but as far as I know, most of those invoked cmdline tools are deprecated and building APKs outside Gradle is not 'supported' by the Android SDK/NDK (e.g. it may stop working at any time).
- pjmlp 1y agoNo, I wasn't talking about APKs. The NDK supports building shared objects with Makefiles, via ndk-build. The original plan to deprecate ndk-build was reversed, due to the complaints. Pretty much official, https://developer.android.com/ndk/guides/build https://developer.android.com/ndk/guides/build I also stand corrected, it is actually GNU Make, not BSD Make.
- quotemstr 1y agoHuh? "Barely"? What are you talking about? The NDK supports compiling C++ just fine. There are CMake files, among other things, ready to use --- as well as Soong native configurations. CMake is under active development. Other toolkits are within easy reach: for example, Meson works fine. Also Bazel. Hell, even autotools can be made to work.
- flohofwoe 1y agoSure, building C/C++ code into an .so file kinda works but that's about it, try building the APK entirely with cmake, that's simply not supported, you'll have to integrate with Gradle. The result is a complexity clusterf*ck that's a nightmare to maintain. The NDK team should take a long hard look at Emscripten to get some inspiration how native code development is integrated into a 'native-hostile' runtime platform.
- pjmlp 1y agoInteresting that you give Emacripten as example, given how badly documented its whole tooling is, and is a pain to prevent it from downloading the Java tooling and everything else that is already downloaded, unless using the Github installation from source.
- flohofwoe 1y agoThe one great feature of Emscripten is that you can do: emcc hello.c -o hello.html ...and it produces an output that's immediately runnable in a web browser instead of just a bare .wasm file which needs to be wrapped in a html with additional steps. E.g. emcc is a drop-in replacement for gcc/clang which can be used directly in a C/C++ build tool as a C/C++ compiler and linker while still doing the right thing (producing a runnable .html). The NDK equivalent would be a gcc-compatible compiler wrapper which can do this: ndkcc hello.c -o hello.apk ...such a simple and obvious thing to do, yet it doesn't happen because the Android SDK/NDK developers have no clue about developer workflows outside of their precious Java ivory tower. > and is a pain to prevent it from downloading the Java tooling and everything else that is already downloaded, That's a feature, not a bug. It's trivial to install different emsdk versions side by side, each entirely self-contained and without polluting the system or requiring external dependencies. The separate Java dependency also has been dropped a while ago, since the only remaining component that depends on Java is the optional Closure compiler step, and that comes now with an embedded Java runtime (as far as I'm aware at least).
- pjmlp 1y agoNope it clearly supports ISO C 11 and ISO C++17. I do agree the NDK team is rather small.