Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Android V8 Support#290

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
KurtGokhan wants to merge9 commits intomicrosoft:master
base:master
Choose a base branch
Loading
fromKurtGokhan:android
Draft

Conversation

KurtGokhan
Copy link
Contributor

@KurtGokhanKurtGokhan commentedSep 12, 2021
edited
Loading

This PR partially adds support for using V8 with ClearScript in Android Mono. It is partial because it requires some manual steps, and it uses some solutions which can be considered ashacks.

The PR may not be up to merging standards but I opened it hoping that I can get some feedback or other people may find it useful.

Summary of what was done:

  • Adds-a flag toV8Update.sh, andANDROID symbol to Makefile to build V8 for Android. It can build forarm andarm64 architectures and can only be built in Linux. To be able to build, it is required to installinstall-build-deps-android.sh of v8 as far as I can tell.
    • This buildsClearScriptV8.android-arm.so andClearScriptV8.android-arm64.so but they need to be prefixed withlib likelibClearScriptV8.android-arm.so otherwiseDLLImport can't find it when built with release configuration for some reason (works with debug though, I guess it is a Mono bug).
  • AddedHostSettings.IsAndroid to tell the ClearScript that current platform is Android. The user must set this setting to true in Android platforms. (For example, I am using#if UNITY_ANDROID build flag to conditionally add it)
    • This is because .NET (and Mono) cannot differentiate between Android and Linux so I had to add this setting. Likewise it incorrectly reportsArm asX86 so I had to add some hacks for that.
  • Added interfaces to Android native libraries. They were similar to Linux so it was fairly easy.

var baseDirectory = "";
try
{
baseDirectory = appDomain.BaseDirectory;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Mono throws error here for some reason.

@@ -127,6 +153,11 @@ private static IntPtr LoadNativeLibrary(string baseName, string platform, string
messageBuilder.AppendInvariant("\n{0}: {1}", systemPath, MiscHelpers.EnsureNonBlank(GetLoadLibraryErrorMessage(), "Unknown error"));
}

if (HostSettings.IsAndroid)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As far as I understand, ClearScript works even if we don't callLoadNativeLibrary. And I cannot makeLoadNativeLibrary work consistently for Android. So, if it does not work, I decided to ignore the error for Android. It certainly works, although I don't know what effects this may have.

@ClearScriptLib
Copy link
Collaborator

Hi@KurtGokhan,

Thanks so much for contributing! At the moment we're focused on the next point release, so we'll evaluate Android support a bit later – most likely toward the end of the year.

Apparently .NET 6 will support Android and iOS in some capacity; thatcould eliminate the need for new APIs such asHostSettings.IsAndroid, but we'll have to wait to know for sure. Our preference would be for ClearScript to be aligned with official .NET mobile support – whatever that ends up looking like.

Thanks again!

@KurtGokhanKurtGokhan mentioned this pull requestOct 14, 2021
@nextfool
Copy link

Hi@KurtGokhan,

Thanks so much for contributing! At the moment we're focused on the next point release, so we'll evaluate Android support a bit later – most likely toward the end of the year.

Apparently .NET 6 will support Android and iOS in some capacity; thatcould eliminate the need for new APIs such asHostSettings.IsAndroid, but we'll have to wait to know for sure. Our preference would be for ClearScript to be aligned with official .NET mobile support – whatever that ends up looking like.

Thanks again!

image
Seems the latest .net 6 rc2 still does not have "android" as an os platform option...

@nextfool
Copy link

nextfool commentedOct 19, 2021
edited
Loading

Hi@KurtGokhan so I am now able to build the arm64 version for android. how ever I also want to build x86 from android, so I just start the command like this: make -f Unix/Makefile CPU=x86 ANDROID=1
every thing runs perfectly until here:
image

I checked the "build-android-x86-release.log" and the detail error is this:
image

it seems the libatomic library is missing, but when I try to install it , it says
image

Can you please point me out whats goes wrong here?
Thank you very much!

@KurtGokhan
Copy link
ContributorAuthor

@nextfool you are probably missing one of the build dependencies. Try runningbuild-dependencies.sh once in the v8 folder before trying to build.

@KurtGokhan
Copy link
ContributorAuthor

KurtGokhan commentedOct 19, 2021
edited
Loading

Sorry, the correct file name isinstall-build-deps-android.sh and it is underV8/build/v8/build.

@KurtGokhan
Copy link
ContributorAuthor

Tested with 7.1.7 and works well.install-build-deps-android.sh must be run again with the new V8 version before building.

@KurtGokhan
Copy link
ContributorAuthor

This does not work currently. Can't build the V8 Android library anymore with the current V8 source code. Android NDK removed linkers I used so the build scripts must be changed. I haven't figured how yet.

@KurtGokhanKurtGokhan marked this pull request as draftJune 16, 2022 13:34
@KurtGokhan
Copy link
ContributorAuthor

I didn't have time to update this PR so converting it to draft. PR can be closed if not needed anymore.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@KurtGokhan@ClearScriptLib@nextfool

[8]ページ先頭

©2009-2025 Movatter.jp