Rootless android device trying to install frida and not just at frida at many other packages getting this error how to fix this pyproject.toml-based and subprocess-exited-with-error × Building wheel for frida (pyproject.toml) did not run successful

~ $ pip install frida
Collecting frida
Using cached frida-16.2.5.tar.gz (917 kB)
Installing build dependencies … done
Getting requirements to build wheel … done
Installing backend dependencies … done
Preparing metadata (pyproject.toml) … done
Building wheels for collected packages: frida
Building wheel for frida (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for frida (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [115 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-311
creating build/lib.linux-aarch64-cpython-311/frida
copying frida/init.py → build/lib.linux-aarch64-cpython-311/frida
copying frida/core.py → build/lib.linux-aarch64-cpython-311/frida
copying frida/py.typed → build/lib.linux-aarch64-cpython-311/frida
creating build/lib.linux-aarch64-cpython-311/frida/_frida
copying frida/_frida/init.pyi → build/lib.linux-aarch64-cpython-311/frida/_frida
copying frida/_frida/py.typed → build/lib.linux-aarch64-cpython-311/frida/_frida
running build_ext
/data/data/com.termux/files/usr/bin/sh: 1: which: not found
Downloading toolchain 20240514…
Extracting toolchain…
Downloading SDK 20240514 for linux-arm64…
Extracting SDK…
Cloning into ‘frida-core’…
The Meson build system
Version: 1.4.99
Source dir: /data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae
Build dir: /data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/build
Build type: native build
Program python3 found: YES (/data/data/com.termux/files/usr/bin/python3)
Project name: frida-python
Project version: 16.2.5
C compiler for the host machine: /data/data/com.termux/files/usr/bin/cc -march=armv8-a (clang 18.1.6 “clang version 18.1.6”)
C linker for the host machine: /data/data/com.termux/files/usr/bin/cc -march=armv8-a ld.lld 18.1.6
Host machine cpu family: aarch64
Host machine cpu: aarch64
Program python3 found: YES (/data/data/com.termux/files/usr/bin/python)
WARNING: We thought we found pkg-config ‘/data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/deps/toolchain-linux-arm64/bin/pkg-config --static --define-variable=frida_sdk_prefix=/data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/deps/sdk-linux-arm64’ but now it’s not there. How odd!
Found pkg-config: NO
Run-time dependency python found: YES 3.11
Found CMake: /data/data/com.termux/files/usr/bin/cmake (3.29.3)
WARNING: CMake Toolchain: Failed to determine CMake compilers state
Run-time dependency frida-core-1.0 found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency frida-core-1.0

  Executing subproject frida-core for machine: host

  frida-core| Program python3 found: YES (/data/data/com.termux/files/usr/bin/python3)
  frida-core| Project name: frida-core
  frida-core| Project version: 16.2.5
  frida-core| C compiler for the host machine: /data/data/com.termux/files/usr/bin/cc -march=armv8-a (clang 18.1.6 "clang version 18.1.6")
  frida-core| C linker for the host machine: /data/data/com.termux/files/usr/bin/cc -march=armv8-a ld.lld 18.1.6
  frida-core| C++ compiler for the host machine: /data/data/com.termux/files/usr/bin/c++ -march=armv8-a (clang 18.1.6 "clang version 18.1.6")
  frida-core| C++ linker for the host machine: /data/data/com.termux/files/usr/bin/c++ -march=armv8-a ld.lld 18.1.6

  subprojects/frida-core/meson.build:1:0: ERROR: Could not execute Vala compiler: /data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/deps/toolchain-linux-arm64/bin/valac-0.58 --vapidir=/data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/deps/toolchain-linux-arm64/share/vala-0.58/vapi '--pkg-config=/data/data/com.termux/files/usr/bin/python /data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/build/frida-pkg-config.py'

  A full log can be found at /data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/build/meson-logs/meson-log.txt
  Command '['/data/data/com.termux/files/usr/bin/python', '/data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/releng/meson/meson.py', 'setup', '-Dprefix=/usr/local', '-Ddefault_library=static', '-Doptimization=s', '-Db_ndebug=true', '-Dstrip=true', '--native-file=/data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/build/frida-linux-arm64.txt', PosixPath('/data/data/com.termux/files/usr/tmp/pip-install-gmnj4s6h/frida_a18d4f999c5543f0878559a36f2044ae/build')]' returned non-zero exit status 1.
  make: *** [Makefile:4: all] Error 1
  Traceback (most recent call last):
    File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 410, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
      self.run_setup()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 130, in <module>
    File "<string>", line 18, in main
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 184, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
      dist.run_commands()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 968, in run_command
      super().run_command(command)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/normal/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 968, in run_command
      super().run_command(command)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 132, in run
      self.run_command(cmd_name)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 968, in run_command
      super().run_command(command)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 91, in run
      _build_ext.run(self)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
      self.build_extensions()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
      self._build_extensions_serial()
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-gkplhqg4/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
      self.build_extension(ext)
    File "<string>", line 120, in build_extension
    File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 571, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for frida
Failed to build frida
ERROR: Could not build wheels for frida, which is required to install pyproject.toml-based projects

These errors look to me like:

  1. The package you are trying to install doesn’t have a pre-compiled file that matches the platform/architecture you are trying to install on. This is not too surprising, armv8 is not common build target.
  2. Because there is no pre-compiled package file, pip downloads the source version of the package (an “sdist”) and tries to build it on your Android device.
  3. The package has a native extension (C code or similar, not pure Python), so pip tries to follow the package’s instructions to compile the C component (hence the cmake, meson, ldd etc.)
  4. Your device does not have all the tools installed needed to compile the library extension, so the build fails. Since the package couldn’t be built pip can’t install it.

Are you trying to do this in a terminal app directly on your Android device? If rooted I guess it might be possible, but I do not know how to install standard build tools in that environment, or if that’s even possible. It would be very unusual.

If your main goal is to use Frida to hook an Android app, it would be much easier to install frida-tools on a PC and use ADB and a precompiled frida server like described here: https://frida.re/docs/android/

1 Like