Mimicking Termux Behavior #4564
-
I have a rather strange request, please tell me if what I'm trying to do is possible and even makes sense. I need to integrate in a normal Android 12 / Kotlin app some pre-existing, large Node.Js code (possibly without rewriting it in a different language, of course). Said code seems to work as expected under Termux. I was able to extract relevant parts of Termux installation (Node.Js interpreter, a few .so and required Javascript code) and have as a subprocess of my app. Problem is I seem able to do this only if I disable SELinux ( Termux is obviously able to run random executables without requiring this. If this is not the case please point me to reasons why I'm trying to do something (nearly) impossible. To clarify my position:
Many THANKS in Advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Termux can run random executables because of |
Beta Was this translation helpful? Give feedback.
-
Restrictions regarding android file executions are detailed at https://github.com/agnostic-apollo/Android-Docs/blob/master/site/pages/en/projects/docs/apps/processes/app-data-file-execute-restrictions.md but they are not relevant if you use Additionally, you cannot use binaries/libraries compiled for
|
Beta Was this translation helpful? Give feedback.
Termux can run random executables because of
targetSdkVersion=28
. If you set highertargetSdkVersion
android will block execution of W^X executables.But if you are planning to use executables on sdcard you can simply build your nodejs version with
-Wl,-rpath=$ORIGIN
in LDFLAGS and put the main nodejs executable (renamed to libnodejs.so) and all libraries intolib/<abi>
of your apk, allowing it to be executed as regular code after extracting.