Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] support libclang? #2046

Closed
DanAlbert opened this issue Jul 19, 2024 · 5 comments
Closed

[FR] support libclang? #2046

DanAlbert opened this issue Jul 19, 2024 · 5 comments
Assignees

Comments

@DanAlbert
Copy link
Member

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 #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

This comment was marked as off-topic.

@DanAlbert DanAlbert changed the title [FR support libclang? [FR] support libclang? Jul 25, 2024
@wqyfavor
Copy link

wqyfavor commented Sep 3, 2024

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
Copy link

SkewedZeppelin commented Sep 3, 2024

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

@DanAlbert DanAlbert self-assigned this Oct 28, 2024
@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r28 Oct 28, 2024
@DanAlbert DanAlbert moved this from Unconfirmed to Triaged in NDK r28 Oct 28, 2024
@DanAlbert
Copy link
Member Author

The plan is for libclang to be in r28 (actually supported, on purpose, not just a thing we shipped accidentally like it was before). It'll be absent on Windows for r28 (because that's not something we've ever built, or at least not in recent history), but assuming it's just a matter of flipping the switch, it'll be included for Windows as well for r29. If it's more complicated then Windows support will likely be put on the back burner, depending on how hard it looks to fix.

bvlgah pushed a commit to bvlgah/llvm_android_mirror that referenced this issue Oct 30, 2024
Bug: android/ndk#2046
Test: ./toolchain/llvm_android/build.py --no-build linux
Change-Id: I0e4437050d949f9fd1f972bc2945fc5189062a83
@DanAlbert DanAlbert moved this from Triaged to Needs cherry-pick in NDK r28 Nov 1, 2024
@pirama-arumuga-nainar
Copy link
Collaborator

Windows libclang is now packaged in ToT AOSP clang and will be in r29. But note that libclang-cpp is not available on Windows:

# For MinGW we only enable shared library if LLVM_LINK_LLVM_DYLIB=ON.
# Without that option resulting library is too close to 2^16 DLL exports limit.

Setting LLVM_LINK_LLVM_DYLIB will make all tools link against libLLVM.dll, slowing down the whole build. So the recommendation for users needing Windows libclang-cpp is to build their own toolchain with that CMake option set.

@DanAlbert DanAlbert moved this from Needs cherry-pick to Merged in NDK r28 Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Merged
Development

No branches or pull requests

5 participants