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

[Xamarin.Android.Build.Tasks] AOT+LLVM needs minSdkVersion #795

Merged
merged 1 commit into from
Aug 31, 2017

Conversation

jonpryor
Copy link
Member

@jonpryor jonpryor commented Aug 29, 2017

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58029

Scenario: Build a project with:

  • $(Configuration)=Release
  • $(AotAssemblies)=True
  • $(EnableLLVM)=True
  • $(TargetFrameworkVersion)=v7.1 (API-25)
  • //uses-sdk/@android:minSdkVersion=22 (in AndroidManifest.xml)
  • with Android NDK r12b or later

Actual results: the app runs, but the AOT'd images aren't used:

AOT: image 'Xamarin.Android.Support.v7.AppCompat.dll.so' not found: dlopen failed: cannot locate symbol "__aeabi_memset" referenced by "/data/app/com.companyname.App1-1/lib/arm/libaot-Xamarin.Android.Support.v7.AppCompat.dll.so"...

The __aeabi_memset symbol can't be found, preventing e.g.
Xamarin.Android.Support.v7.AppCompat.dll.so from being used. Meaning
the app pays the build overhead and size penalty of AOT+LLVM, but
doesn't get anything out of it; only the JIT is used.

The cause of the missing __aeabi_memset symbol is that we're
using the NDK paths which corresponds with $(TargetFrameworkVersion),
not the NDK paths which correspond with
//uses-sdk/@android:minSdkVersion. Because of this, if you use the
.apk on a platform which is >= minSdkVersion but less than
$(TargetFrameworkVersion), the AOT images won't be used.

Fix this by updating the <Aot/> task to instead use the
//uses-sdk/@android:minSdkVersion value, as determined by the
<GenerateJavaStubs/> task. This ensures that we use NDK paths which
correspond to the app's minimum supported API level, which should
allow the AOT images to be loaded on downlevel devices.

@jonpryor jonpryor requested a review from dellis1972 August 29, 2017 21:14
@jonpryor jonpryor added the do-not-merge PR should not be merged. label Aug 29, 2017
@jonpryor
Copy link
Member Author

TODO: Unit tests.

@dellis1972
Copy link
Contributor

@jonpryor the test failure is

AOT task error, ApiLevel property not set.

Looks like we don't always get the _AndroidMinSdkId

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58029

Scenario: Build a project with:

  * `$(Configuration)`=Release
  * `$(AotAssemblies)`=True
  * `$(EnableLLVM)`=True
  * `$(TargetFrameworkVersion)`=v7.1 (API-25)
  * `//uses-sdk/@android:minSdkVersion`=10 (in `AndroidManifest.xml`)
  * with Android NDK r12b or later
  * on particular hardware devices, e.g. a Nexus 5.

Actual results: the app runs, but the AOT'd images aren't used:

	AOT: image 'Xamarin.Android.Support.v7.AppCompat.dll.so' not found: dlopen failed: cannot locate symbol "__aeabi_memset" referenced by "/data/app/com.companyname.App1-1/lib/arm/libaot-Xamarin.Android.Support.v7.AppCompat.dll.so"...

The `__aeabi_memset` symbol can't be found, preventing e.g.
`Xamarin.Android.Support.v7.AppCompat.dll.so` from being used. Meaning
the app pays the build overhead and size penalty of AOT+LLVM, but
doesn't get anything out of it; only the JIT is used.

The [cause of the missing `__aeabi_memset` symbol][0] is that we're
using the NDK paths which corresponds with `$(TargetFrameworkVersion)`,
*not* the NDK paths which correspond with
`//uses-sdk/@android:minSdkVersion`. Because of this, if you use the
`.apk` on a platform which is >= `minSdkVersion` but less than
`$(TargetFrameworkVersion)`, the AOT images won't be used.

[0]: android/ndk#126

Fix this by updating the `<Aot/>` task to instead use the
`//uses-sdk/@android:minSdkVersion` value. This ensures that we use
NDK paths which correspond to the app's minimum supported API level,
which should allow the AOT images to be loaded on downlevel devices.
@jonpryor
Copy link
Member Author

build

@jonpryor jonpryor removed the do-not-merge PR should not be merged. label Aug 31, 2017
@dellis1972 dellis1972 merged commit a953d3f into dotnet:master Aug 31, 2017
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 31, 2017
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58029

Scenario: Build a project with:

  * `$(Configuration)`=Release
  * `$(AotAssemblies)`=True
  * `$(EnableLLVM)`=True
  * `$(TargetFrameworkVersion)`=v7.1 (API-25)
  * `//uses-sdk/@android:minSdkVersion`=10 (in `AndroidManifest.xml`)
  * with Android NDK r12b or later
  * on particular hardware devices, e.g. a Nexus 5.

Actual results: the app runs, but the AOT'd images aren't used:

	AOT: image 'Xamarin.Android.Support.v7.AppCompat.dll.so' not found: dlopen failed: cannot locate symbol "__aeabi_memset" referenced by "/data/app/com.companyname.App1-1/lib/arm/libaot-Xamarin.Android.Support.v7.AppCompat.dll.so"...

The `__aeabi_memset` symbol can't be found, preventing e.g.
`Xamarin.Android.Support.v7.AppCompat.dll.so` from being used. Meaning
the app pays the build overhead and size penalty of AOT+LLVM, but
doesn't get anything out of it; only the JIT is used.

The [cause of the missing `__aeabi_memset` symbol][0] is that we're
using the NDK paths which corresponds with `$(TargetFrameworkVersion)`,
*not* the NDK paths which correspond with
`//uses-sdk/@android:minSdkVersion`. Because of this, if you use the
`.apk` on a platform which is >= `minSdkVersion` but less than
`$(TargetFrameworkVersion)`, the AOT images won't be used.

[0]: android/ndk#126

Fix this by updating the `<Aot/>` task to instead use the
`//uses-sdk/@android:minSdkVersion` value. This ensures that we use
NDK paths which correspond to the app's minimum supported API level,
which should allow the AOT images to be loaded on downlevel devices.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 31, 2017
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58029

Scenario: Build a project with:

  * `$(Configuration)`=Release
  * `$(AotAssemblies)`=True
  * `$(EnableLLVM)`=True
  * `$(TargetFrameworkVersion)`=v7.1 (API-25)
  * `//uses-sdk/@android:minSdkVersion`=10 (in `AndroidManifest.xml`)
  * with Android NDK r12b or later
  * on particular hardware devices, e.g. a Nexus 5.

Actual results: the app runs, but the AOT'd images aren't used:

	AOT: image 'Xamarin.Android.Support.v7.AppCompat.dll.so' not found: dlopen failed: cannot locate symbol "__aeabi_memset" referenced by "/data/app/com.companyname.App1-1/lib/arm/libaot-Xamarin.Android.Support.v7.AppCompat.dll.so"...

The `__aeabi_memset` symbol can't be found, preventing e.g.
`Xamarin.Android.Support.v7.AppCompat.dll.so` from being used. Meaning
the app pays the build overhead and size penalty of AOT+LLVM, but
doesn't get anything out of it; only the JIT is used.

The [cause of the missing `__aeabi_memset` symbol][0] is that we're
using the NDK paths which corresponds with `$(TargetFrameworkVersion)`,
*not* the NDK paths which correspond with
`//uses-sdk/@android:minSdkVersion`. Because of this, if you use the
`.apk` on a platform which is >= `minSdkVersion` but less than
`$(TargetFrameworkVersion)`, the AOT images won't be used.

[0]: android/ndk#126

Fix this by updating the `<Aot/>` task to instead use the
`//uses-sdk/@android:minSdkVersion` value. This ensures that we use
NDK paths which correspond to the app's minimum supported API level,
which should allow the AOT images to be loaded on downlevel devices.
cobey added a commit that referenced this pull request Aug 31, 2017
[Xamarin.Android.Build.Tasks] AOT+LLVM needs minSdkVersion (#795)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants