Repository navigation
Bundle a copy of libc++_shared.so instead of the NDK's own file - #9
Merged
Merged
Conversation
The Flutter tool records code asset files as build outputs and deletes stale ones, which removed libc++_shared.so from the NDK sysroot and broke later builds linking with -lc++_shared.
Member
|
Huh, weird that the build system deletes files out of the build directory. I don't see any harm in merging this to work around it but I feel like this is an upstream bug, adding shared libs should not make the build system think it owns them. |
Contributor
Author
|
exactly it should be flutter issue, but no harm for a workaround here since upstream can take time to to fix and publish (sry i forgot to mention this) thank u for ur work ^^ |
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The hook emits the NDK's
sysroot/usr/lib/<triple>/libc++_shared.soitself as the code asset file. Flutter'sDartBuildtarget lists asset files as build outputs (dart_build.d), and its build system deletes stale outputs, e.g.trackSharedBuildDirectorywhen the build configuration changes (a different ABI set, or a failed build). That deleteslibc++_shared.sofrom the NDK.Anything linking
-lc++_sharedagainst that NDK then fails (ld.lld: error: unable to find library -lc++_shared), and this package falls back to an older NDK or fails.This is the root cause of #5: NDK 28 ships
aarch64-linux-android/libc++_shared.so, it was deleted by the build.Fix
Copy the resolved library into
input.outputDirectoryand emit the copy. The source stays a dependency, so the hook still re-runs when it changes.Tests
test/hook_test.dartruns the hook throughtestBuildHook, checks the asset lives in the output directory, and that deleting it leaves the source intact.Branched from
v0.2.1(the hook is unchanged since, merges cleanly intomain). Packages still on^0.2.1(e.g. mecab_for_dart) would benefit from a 0.2.2 release.Credits
made by claude