chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
807 stars 132 forks source link

Frida - Cannot compile native code #1070

Open christiancoleman opened 9 months ago

christiancoleman commented 9 months ago

Frida seems to be a bit obscure of a request. I haven't seen mention of it in the issues (open or closed) and the FAQ of course doesn't mention it.

Chaquopy version

plugins {
    id 'com.android.application' version '8.2.0' apply false
    id 'com.android.library' version '8.2.0' apply false
    id 'com.google.gms.google-services' version '4.4.0' apply false
    id("com.chaquo.python") version "15.0.1" apply false
}

Relevant parts of your build.gradle file

android {
    namespace 'com.exampler'
    compileSdk 34

    defaultConfig {
        applicationId "com.example"
        minSdk 26 // Android 8.0 (Oreo) is API level 26
        targetSdk 34
        versionCode 1
        versionName "1.0"

        ndk {
            //noinspection ChromeOsAbiSupport
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        }

        externalNativeBuild {
            ndkBuild {
                arguments "FRIDA_CORE_DEVKIT=frida-core-devkit-16.1.8-android-arm64/"
            }
        }
    }

    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
        }
    }

Describe your issue

I'm trying to include a python interpreter in my code in order to run the program known as Frida. The app would be only for users that are rooted, and would be basically a trainer for a game.

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-13.1
Processing c:\workspaces\git\com.example\app\frida-16.1.8-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Collecting typing-extensions; python_version < "3.11"
  Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Installing collected packages: typing-extensions, frida
Successfully installed frida-16.1.8 typing-extensions-4.9.0
Chaquopy: Installing for armeabi-v7a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-13.1
Collecting frida==16.1.8
  Using cached frida-16.1.8.tar.gz (41 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: frida
  Building wheel for frida (PEP 517): started
  Building wheel for frida (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: 'C:\Workspaces\Git\com.example\app\build\python\env\debug\Scripts\python.exe' 'C:\Workspaces\Git\com.example\app\build\python\env\debug\Lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\c\AppData\Local\Temp\tmpxmlddbnh'
       cwd: C:\Users\c\AppData\Local\Temp\pip-install-0i34bg2s\frida
  Complete output (15 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-311
  creating build\lib.win-amd64-cpython-311\frida
  copying frida\core.py -> build\lib.win-amd64-cpython-311\frida
  copying frida\__init__.py -> build\lib.win-amd64-cpython-311\frida
  copying frida\py.typed -> build\lib.win-amd64-cpython-311\frida
  creating build\lib.win-amd64-cpython-311\_frida
  copying _frida\__init__.pyi -> build\lib.win-amd64-cpython-311\_frida
  copying _frida\py.typed -> build\lib.win-amd64-cpython-311\_frida
  running build_ext
  building '_frida' extension
  error: CCompiler.compile: Chaquopy cannot compile native code
  ----------------------------------------
ERROR: Failed to install frida==16.1.8 from https://files.pythonhosted.org/packages/d7/30/e923f7e3e3bdfbf2171df010731f252f06b5dab1496b82f6ed473c7b55d6/frida-16.1.8.tar.gz#sha256=dc4118f48c5e1b2241eee7d53ab836d42636c511fbf2f8f8b2dcab133421d09d.
For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues.
  ERROR: Command errored out with exit status 1:

  error: CCompiler.compile: Chaquopy cannot compile native code

Failed to install frida==16.1.8 from https://files.pythonhosted.org/packages/d7/30/e923f7e3e3bdfbf2171df010731f252f06b5dab1496b82f6ed473c7b55d6/frida-16.1.8.tar.gz#sha256=dc4118f48c5e1b2241eee7d53ab836d42636c511fbf2f8f8b2dcab133421d09d.

Chaquopy: Exit status 1

> Task :app:generateDebugPythonRequirements FAILED
Execution failed for task ':app:generateDebugPythonRequirements'.
> Process 'command 'C:\Workspaces\Git\com.example\app\build\python\env\debug\Scripts\python.exe'' finished with non-zero exit value 1 
mhsmith commented 8 months ago

This package contains native components, so it would have to be built into a wheel file. If you'd like to try doing this yourself, follow the instructions here. And if you're successful, please make a pull request so we can add the package to the public repository.

If anyone else wants this package too, let us know by clicking the thumbs-up button above.