android / ndk

The Android Native Development Kit
1.97k stars 255 forks source link

[FR] support libclang? #2046

Open DanAlbert opened 2 months ago

DanAlbert commented 2 months ago

Description

For a while the NDK unintentionally included libclang (since it wasn't intentional, I'm not sure how long it was there). That was removed as part of https://github.com/android/ndk/issues/2010 to reduce download size. This FR tracks potentially adding that back as something properly supported. Right now that's not something we've got the bandwidth for, but it's worth considering if that ever changes.

The other thread notes that rust workflows need this for bindgen, so that's maybe something that'll force this. OTOH if bindgen needs it, it should probably be shipped with bindgen?

finagolfin commented 2 months ago

Hey, just a note that the NDK download page still incorrectly links to the NDK 26 changelog, even though NDK 27 was just released.

wqyfavor commented 3 weeks ago

It is so hard to develop Clang plugin with NDK.

NDK not shipping the clang/llvm headers required by plugins. I have to carefully choose exactly the same commit as NDK and build LLVM myself to get those headers. It's a bit troublesome, but tolerable.

After I happily built LLVM with the same commit as NDK and obtained the header files and libclang.dylib required by the plugin, I also happily included and linked it in my plugin and successfully compiled my plugin.

But what frustrates me is that I cannot use Clang that bundled in NDK27 to load my plugin, and I cannot find the libclang I need in NDK27.

Finally, I can only roll back our project to the previous NDK version and repeat the above steps.

SkewedZeppelin commented 3 weeks ago

fwiw Firefox forks in F-Droid.org were relying[1] on the regular NDK so we didn't have to compile the toolchain every build and Firefox was working just fine for years with the libclang previously available in r26 and older

[1] F-Droid exempts the official NDK and a small handful of other prebuilts, everything else has to be compiled from source