Skip to content

[native_toolchain_c] Support minSdkVersion 19 and 20 #171

Closed
@dcharkes

Description

@dcharkes

Setting the Android minSdkVersion to 19 or 20 with

/// When compiling for Android, the minimum Android SDK API version to that
/// the compiled code will be compatible with.
///
/// Required when [targetOs] equals [OS.android].
///
/// Not available in [dryRun].
///
/// For more information about the Android API version, refer to
/// [`minSdkVersion`](https://developer.android.com/ndk/guides/sdk-versions#minsdkversion)
/// in the Android documentation.
int? get targetAndroidNdkApi {

causes the following at runtime when doing dlopen:

Invalid argument(s): Couldn't resolve native function 'sum' in
'package:my_package/my_package_bindings_generated.dart' : Failed to load dynamic library
'libmy_package.so': Failed to load dynamic library 'libmy_package.so': dlopen failed: TLS symbol
"_ZZN8gwp_asan15getThreadLocalsEvE6Locals" in dlopened
"/data/app/~~II5Pe1_V-_9YOORXFmjkwA==/com.example.my_package-fBAv9YGX7hLvZudMWuFp7g==/lib/arm64/libmy_package.so"
referenced from
"/data/app/~~II5Pe1_V-_9YOORXFmjkwA==/com.example.my_package-fBAv9YGX7hLvZudMWuFp7g==/lib/arm64/libmy_package.so"
using IE access model.

A quick search reveals this might have to do with libc++ linking.

background info: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#stl

It could also be related to

// TODO(dacoharkes): How to solve linking issues?
// Non-working fix: --sysroot=$NDKPATH/toolchains/llvm/prebuilt/linux-x86_64/sysroot.
// The sysroot should be discovered automatically after NDK 22.
// Workaround:
if (dynamicLibrary != null) '-nostartfiles',

Discovered while testing API versions on

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions