You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
android_libcpp_shared` 0.2.0 fails on NDK 28 for arm64-v8a #5
android_libcpp_shared 0.2.0 fails on NDK 28 for arm64-v8a
Package:package:android_libcpp_shared 0.2.0 Repo:dart-lang/native Flutter: 3.44.2 NDK: 28.2.13676358 Host: macOS with Apple Silicon M1 Pro Target ABI: arm64-v8a (Pixel 6a)
Error:
Hook.build hook of package:android_libcpp_shared has invalid output
- Code asset "package:android_libcpp_shared/libc++_shared.so" file
(/Users/.../ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64//sysroot/usr/lib/aarch64-linux-android/libc++_shared.so)
does not exist as a file.
Root cause:
NDK 28 changed the layout for arm64. There are two issues:
2. Wrong filename.
For arm64 in NDK 28 the library is named libc++.so, not libc++_shared.so.
Verification:
# Top-level aarch64 directory — no libc++_shared.so
ls $NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/
# libc++_static.a libc++abi.a libc++experimental.a libc.a ...# No libc++_shared.so# API-level subdirectory — libc++.so present under a different name
ls $NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/24/
# libc++.so libc.so libm.so libdl.so ...# Other ABIs still have libc++_shared.so at the top level (not affected)
find $NDK_HOME -name "libc++_shared.so"# arm-linux-androideabi, x86_64-linux-android, i686-linux-android, riscv64-linux-android# Missing: aarch64-linux-android
Additional behaviour:
The build succeeds on the first run because hook output is cached in .dart_tool/hooks_runner/. Subsequent builds (or after flutter clean) fail immediately because the cached file path is validated and the file does not exist. This makes the bug appear intermittent.
Hook.build hook of package:android_libcpp_shared has invalid output
- Code asset "package:android_libcpp_shared/libc++_shared.so" file (/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64//sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so) does not exist as a file.
~ find $ANDROID_HOME/ndk/28.2.13676358 -name "libc++_shared.so"2>/dev/null
/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so
/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so
/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/riscv64-linux-android/libc++_shared.so
Good call, I ended up building my C++ library with ANDROID_STL=c++_static instead but good to know you can downgrade and have it work. Thanks for that
Same issue
Hook.build hook of package:android_libcpp_shared has invalid output
Code asset "package:android_libcpp_shared/libc++_shared.so" file (/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64//sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so) does not exist as a file.
~ find $ANDROID_HOME/ndk/28.2.13676358 -name "libc++_shared.so" 2>/dev/null
/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so
/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so
/Users/hostname/Library/Android/sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/riscv64-linux-android/libc++_shared.so
had to do this for the build to succeed
@chillbrodev thanks for the ping, I don't know what is going on with my github, but I haven't had any notifications for this repo. I will take a look next week, including the pending PRs. Sorry for the delay, I also just got back from vacation
@chillbrodev thanks for the ping, I don't know what is going on with my github, but I haven't had any notifications for this repo. I will take a look next week, including the pending PRs. Sorry for the delay, I also just got back from vacation
No worries, GitHub has been weird lately. I hope your vacation was good. If you need anything please let me know. I am happy to test as needed.
@kattaliraees@chillbrodev I'm about to push a fix that will more helpfully fail and checks more paths.
But it might be helpful if you both can run: find /path/to/ndk -name 'libc++_shared.so'
and share the output, as that file should exist in each NDK version, if it doesn't it could be a partial/corrupt install
btw @chillbrodevlibc++_shared.so is different from libc++.so so it can't just replace one with the other.
I've just released version 0.2.1 which has (hopefully) the fix for this, it should at the very least give you more information about when it fails.
And you can now specify the location of the NDK root (or the path the the specific libc++_shared.so either via an env var ANDROID_LIBCPP_SHARED_PATH or, in your pubspec.yaml (this avoids gradle cache but of course, then there's a hardcoded path in the pubspec which is probably less useful in most cases):
@zeyus Okay great, I'll pull this down and give it a go. I think what might have happened is I got a bad NDK stuck in my path. Thanks for investigating this and pushing up some fixes.
Here is the output you requested for "find /path/to/ndk -name 'libc++_shared.so'"
@zeyus Okay great, I'll pull this down and give it a go. I think what might have happened is I got a bad NDK stuck in my path. Thanks for investigating this and pushing up some fixes.
Here is the output you requested for "find /path/to/ndk -name 'libc++_shared.so'"
Ah, interesting, it seems like the triple you're targeting (aarch64-linux-android) is not actually there!
I think that points to a corrupted NDK install, as you can see, each triple should have its own libc++_shared.so, what I would suggest is just deleting that entire NDK directory (rm -rf /Users/uptech/android/ndk/28.2.13676358) and then reinstall ndk 28.2.13676358, using sdkmanager, e.g. sdkmanager --install ndk;28.2.13676358, or using the GUI in Android Studio.
If you still don't end up with libc++_shared.so there, let me know, at least the package will fail with a more useful error message now. I have 3 NDKs installed on my linux machine, and even more on my macbook, and use this package to compile some native libs, and it has been working, but I would love to pick up on some of these edge cases so it's as easy as possible (e.g. the PR and issue about windows, which I don't have access to for testing) :D
Activity
kattaliraees commentedon Jun 14, 2026
Same issue
had to do this for the build to succeed
chillbrodev commentedon Jun 15, 2026
Good call, I ended up building my C++ library with
ANDROID_STL=c++_staticinstead but good to know you can downgrade and have it work. Thanks for thatchillbrodev commentedon Aug 7, 2026
@zeyus Bump on this
zeyus commentedon Aug 7, 2026
@chillbrodev thanks for the ping, I don't know what is going on with my github, but I haven't had any notifications for this repo. I will take a look next week, including the pending PRs. Sorry for the delay, I also just got back from vacation
chillbrodev commentedon Aug 11, 2026
No worries, GitHub has been weird lately. I hope your vacation was good. If you need anything please let me know. I am happy to test as needed.
zeyus commentedon Aug 12, 2026
@chillbrodev Just investigating this, it's odd, on my linux machine and my macos I see that specific
libc++_shared.soLinux ndk 28:
Linux ndk 29:
And MacOS:
zeyus commentedon Aug 12, 2026
@kattaliraees @chillbrodev I'm about to push a fix that will more helpfully fail and checks more paths.
But it might be helpful if you both can run:
find /path/to/ndk -name 'libc++_shared.so'and share the output, as that file should exist in each NDK version, if it doesn't it could be a partial/corrupt install
Merge pull request #7 from NexusDynamic/feature/fix-shlib-search
zeyus commentedon Aug 12, 2026
btw @chillbrodev
libc++_shared.sois different fromlibc++.soso it can't just replace one with the other.I've just released version
0.2.1which has (hopefully) the fix for this, it should at the very least give you more information about when it fails.And you can now specify the location of the NDK root (or the path the the specific
libc++_shared.soeither via an env varANDROID_LIBCPP_SHARED_PATHor, in yourpubspec.yaml(this avoids gradle cache but of course, then there's a hardcoded path in the pubspec which is probably less useful in most cases):[Fix NexusDynamic#5] Update path resolution and handling of missing/i…
chillbrodev commentedon Aug 12, 2026
@zeyus Okay great, I'll pull this down and give it a go. I think what might have happened is I got a bad NDK stuck in my path. Thanks for investigating this and pushing up some fixes.
Here is the output you requested for "find /path/to/ndk -name 'libc++_shared.so'"
╰─❯ find /Users/uptech/android/ndk/28.2.13676358 -name 'libc++_shared.so'
/Users/uptech/android/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so
/Users/uptech/android/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so
/Users/uptech/android/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so
/Users/uptech/android/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/riscv64-linux-android/libc++_shared.so
zeyus commentedon Aug 13, 2026
Ah, interesting, it seems like the triple you're targeting (
aarch64-linux-android) is not actually there!I think that points to a corrupted NDK install, as you can see, each triple should have its own
libc++_shared.so, what I would suggest is just deleting that entire NDK directory (rm -rf /Users/uptech/android/ndk/28.2.13676358) and then reinstall ndk 28.2.13676358, usingsdkmanager, e.g.sdkmanager --install ndk;28.2.13676358, or using the GUI in Android Studio.If you still don't end up with
libc++_shared.sothere, let me know, at least the package will fail with a more useful error message now. I have 3 NDKs installed on my linux machine, and even more on my macbook, and use this package to compile some native libs, and it has been working, but I would love to pick up on some of these edge cases so it's as easy as possible (e.g. the PR and issue about windows, which I don't have access to for testing) :Dchillbrodev commentedon Aug 14, 2026
@zeyus I will do the NDK re-install tomorrow and let you know. I also have a windows machine and could test things there for you.