Skip to content

build: refactor Android build system#44207

Merged
nodejs-github-bot merged 5 commits into
nodejs:mainfrom
MeowShe:android-configure
Sep 12, 2022
Merged

build: refactor Android build system#44207
nodejs-github-bot merged 5 commits into
nodejs:mainfrom
MeowShe:android-configure

Conversation

@MeowShe

@MeowShe MeowShe commented Aug 11, 2022

Copy link
Copy Markdown
Contributor

Completely rewritten the Android build process in Python to make it more complete and CI ready.

  • Supported building node for android on macOS (Intel)

Refs: #36287

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. labels Aug 11, 2022
@MeowShe MeowShe closed this Aug 11, 2022
@MeowShe MeowShe reopened this Aug 11, 2022
@MeowShe MeowShe force-pushed the android-configure branch 4 times, most recently from 8ef2283 to 4e6f250 Compare August 15, 2022 08:29
@MeowShe MeowShe changed the title build: improved build for Android platform build: refactored Android build system Aug 16, 2022
@MeowShe MeowShe force-pushed the android-configure branch 2 times, most recently from 12b559b to dc5aad2 Compare August 17, 2022 00:05
@tniessen

Copy link
Copy Markdown
Member

cc @nodejs/build

@MeowShe

MeowShe commented Aug 30, 2022

Copy link
Copy Markdown
Contributor Author

cc @nodejs/build

Is there anything I can do to advance this pull request plz?

@MeowShe MeowShe closed this Sep 4, 2022
@tniessen

tniessen commented Sep 4, 2022

Copy link
Copy Markdown
Member

I'm very sorry about the lack of activity on the project's side here. I'm afraid I don't know if any of the current project members actively maintain support for Android. There is no platform team for Android, and android-configure appears to be modified about once a year only.

I'm going to try pinging those folks who approved previous PRs: @cclauss @devnexen @F3n67u @yashLadha @bnoordhuis

@cclauss

cclauss commented Sep 4, 2022

Copy link
Copy Markdown
Contributor

I do know Android so I have not commented.

@MeowShe MeowShe reopened this Sep 5, 2022
@F3n67u F3n67u added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 5, 2022
Comment thread android_configure.py Outdated
@F3n67u F3n67u removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 5, 2022
@MeowShe MeowShe requested a review from F3n67u September 5, 2022 06:05
Comment thread android_configure.py Outdated
Comment thread android-configure Outdated
Comment thread android_configure.py
sys.exit(0)

if len(sys.argv) != 4:
print("Usage: ./android-configure [patch] <path to the Android NDK> <Android SDK version> <target architecture>")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but in this branch, BUILDING.md is out of date, do I need to create a new branch and pull requests to update it or later?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be better to update this doc in the same pr.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi, @MeowShe. Would you update BUILDING.md in this pr?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi, @MeowShe. Would you update BUILDING.md in this pr?

I want but I don't seem to know how to do it because the BUILDING.md in this branch is out of date and if I update BUILDING.md it will cause a conflict and I will have to merge main branch to solve it, but the nodejs Pull Request CI doesn't seem to allow me to do that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I will update BUILDING.md using rebase when all the fix are ready.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MeowShe would you mind update the BUILDING.md to keep the doc update with this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will open a new pull request to update it, and a macOS build fix will be included, thank you.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. A person asked me in an email if android configure is supported in the latest main branch. So I remember our BUILING.md if lost updated with our codebase.😃

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will commit those changes ASAP 😃

Comment thread android_configure.py Outdated
Comment thread android_configure.py Outdated
Comment thread android-patches/trap-handler.h.patch
@F3n67u

F3n67u commented Sep 5, 2022

Copy link
Copy Markdown
Contributor

I tried to build with this change on macOS (Intel), but got the following error:

$ ./android-configure ~/Library/Android/sdk/ndk/25.1.8937393 28 x86_64
$ make
rm -f /Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a ar-file-list; mkdir -p `dirname /Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a`
ar crsT /Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a @/Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a.ar-file-list
ar: @/Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a.ar-file-list: No such file or directory
make[1]: *** [/Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a] Error 1
make: *** [node] Error 2

Do you have any idea why this error happened?

Comment thread android_configure.py Outdated
Comment thread android_configure.py Outdated
Comment thread android_configure.py Outdated
Completely rewritten the Android build system using Python

Co-Authored-By: 东灯 <43312495+Lampese@users.noreply.github.com>
Co-Authored-By: Feng Yu <F3n67u@outlook.com>
@F3n67u

F3n67u commented Sep 5, 2022

Copy link
Copy Markdown
Contributor

I tried to build with this change on macOS (Intel), but got the following error:

$ ./android-configure ~/Library/Android/sdk/ndk/25.1.8937393 28 x86_64
$ make
rm -f /Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a ar-file-list; mkdir -p `dirname /Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a`
ar crsT /Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a @/Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a.ar-file-list
ar: @/Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a.ar-file-list: No such file or directory
make[1]: *** [/Users/feng/dev/node/out/Release/obj.target/tools/icu/libicuucx.a] Error 1
make: *** [node] Error 2

Do you have any idea why this error happened?

I cannot build for Android with main branch too, so feel free to ignore this comment.

Comment thread android_configure.py
print("- Patches List -")
print("[1] [deps/v8/src/trap-handler/trap-handler.h] related to https://github.com/nodejs/node/issues/36287")
if platform.system() == "Linux":
os.system('patch -f ./deps/v8/src/trap-handler/trap-handler.h < ./android-patches/trap-handler.h.patch')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use subprocess.run() instead of os.system() for security and compatibility reasons.

Comment thread android_configure.py Outdated
@F3n67u F3n67u changed the title build: refactored Android build system build: refactor Android build system Sep 5, 2022
@tniessen

Copy link
Copy Markdown
Member

Thanks for the contribution @MeowShe.

@xeoshow

xeoshow commented Oct 7, 2022

Copy link
Copy Markdown

Hello @MeowShe ,
I am new to nodejs on android, does this pr mean we could use nodejs on android? If so, is there any binary out of the box that we could install on the centOS 7.6 or some linux? If not, is there any guide to how to build it for centOS or linux?And is there any tutorial or document for how to use it on linux?

Great thanks!

Best regards, Jason

@MeowShe

MeowShe commented Oct 7, 2022

Copy link
Copy Markdown
Contributor Author

Hello @MeowShe ,

I am new to nodejs on android, does this pr mean we could use nodejs on android? If so, is there any binary out of the box that we could install on the centOS 7.6 or some linux? If not, is there any guide to how to build it for centOS or linux?And is there any tutorial or document for how to use it on linux?

Great thanks!

Best regards, Jason

Yes, now we can run node applications on Android, if you've asking how to build Node.js binary for Android on CentOS, just follow BUILDING.md please.

Alternatively, you may want to look at #44888, which is a pull request in progress that has not yet been merged.

@xeoshow

xeoshow commented Oct 7, 2022

Copy link
Copy Markdown

Thanks for help @MeowShe , By BUILDING.md, you mean exactly the below link? After building, what is the result output we will get? A binary file we could just execute? Thanks again!

https://github.com/MeowShe/node/blob/android-build/BUILDING.md#android

@MeowShe

MeowShe commented Oct 7, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for help @MeowShe , By BUILDING.md, you mean exactly the below link? After building, what is the result output we will get? A binary file we could just execute? Thanks again!

https://github.com/MeowShe/node/blob/android-build/BUILDING.md#android

Yes, a binary can be executed on Android will be built, then you can use ProcessBuilder (Android API) or any other ways to run it.

@Sanoussi85

Copy link
Copy Markdown

#44207 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants