nowsecure / frida-cycript

Cycript fork powered by Frida.
GNU Affero General Public License v3.0
375 stars 45 forks source link

Stuck building on palera1n arm64 device - need help #48

Open Einstein2150 opened 10 months ago

Einstein2150 commented 10 months ago

Building on macOS is fine but I have issues compiling it on the device directly:

iPad-Pro-2:~/frida-cycript root# meson build --buildtype minsize --strip
The Meson build system
Version: 1.2.3
Source dir: /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/frida-cycript
Build dir: /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/frida-cycript/build
Build type: native build
Project name: frida-cycript
Project version: 2.0.5
C compiler for the host machine: cc (clang 14.0.0 "Procursus clang version 14.0.0 (git@github.com:ProcursusTeam/Procursus.git 960af43cc715370e52ee5de85af29ea07ac0445b)")
C linker for the host machine: cc ld64 609
C++ compiler for the host machine: c++ (clang 14.0.0 "Procursus clang version 14.0.0 (git@github.com:ProcursusTeam/Procursus.git 960af43cc715370e52ee5de85af29ea07ac0445b)")
C++ linker for the host machine: c++ ld64 609
WARNING: Unknown CPU family 'ipad6,7', please report this at https://github.com/mesonbuild/meson/issues/new with the output of `uname -a` and `cat /proc/cpuinfo`
WARNING: Unknown CPU family 'ipad6,7', please report this at https://github.com/mesonbuild/meson/issues/new with the output of `uname -a` and `cat /proc/cpuinfo`
WARNING: Unknown CPU family 'ipad6,7', please report this at https://github.com/mesonbuild/meson/issues/new with the output of `uname -a` and `cat /proc/cpuinfo`
Host machine cpu family: ipad6,7
Host machine cpu: ipad6,7
WARNING: Unknown CPU family 'ipad6,7', please report this at https://github.com/mesonbuild/meson/issues/new with the output of `uname -a` and `cat /proc/cpuinfo`
Objective-C compiler for the host machine: cc (clang 14.0.0)
Objective-C linker for the host machine: cc ld64 609
Objective-C++ compiler for the host machine: c++ (clang 14.0.0)
Objective-C++ linker for the host machine: c++ ld64 609
WARNING: Unknown CPU family 'ipad6,7', please report this at https://github.com/mesonbuild/meson/issues/new with the output of `uname -a` and `cat /proc/cpuinfo`
Checking if "compiling for macOS" compiles: NO 
Checking if "compiling for iOS" compiles: YES 
Has header "android/api-level.h" : NO 
Program python3 found: YES (/private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/usr/bin/python3.9)
Program flex found: YES (/var/jb/usr/bin/flex)
Program ext/toolchain/usr/bin/bison.py found: YES (/private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/frida-cycript/ext/toolchain/usr/bin/bison.py)
Run-time dependency threads found: YES
Program npm found: NO

meson.build:120:8: ERROR: Program 'npm' not found or not executable

A full log can be found at /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/frida-cycript/build/meson-logs/meson-log.txt
WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.

Any chance to run node.js / npm? nvm can't install a compatible version:

nvm install --lts
Installing latest LTS version.
Downloading and installing node v20.9.0...
Downloading https://nodejs.org/dist/v20.9.0/node-v20.9.0-darwin-iPad6,7.tar.xz...
--2023-11-10 07:10:51--  https://nodejs.org/dist/v20.9.0/node-v20.9.0-darwin-iPad6,7.tar.xz
Resolving nodejs.org (nodejs.org)... 2606:4700:10::6814:172e, 2606:4700:10::6814:162e, 104.20.22.46, ...
Connecting to nodejs.org (nodejs.org)|2606:4700:10::6814:172e|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-11-10 07:10:52 ERROR 404: Not Found.

Binary download from https://nodejs.org/dist/v20.9.0/node-v20.9.0-darwin-iPad6,7.tar.xz failed, trying source.
grep: /var/jb/var/root/.nvm/.cache/bin/node-v20.9.0-darwin-iPad6,7/node-v20.9.0-darwin-iPad6,7.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 2 CPU core(s)
Number of CPU core(s) less than or equal to 2, running in single-threaded mode
Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!
Local cache found: ${NVM_DIR}/.cache/src/node-v20.9.0/node-v20.9.0.tar.xz
Checksums match! Using existing downloaded archive ${NVM_DIR}/.cache/src/node-v20.9.0/node-v20.9.0.tar.xz
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
nvm: install v20.9.0 `failed!

I'm on palera1n rootless iPad6,7 16.7.2

...or is there a deb-package or a compiled bin somewhere to find?

NSEcho commented 10 months ago

Hi @Einstein2150, can you try first installing xz and then try to install nvm.

Einstein2150 commented 10 months ago

OK. That makes sense but now it's more confusing

# nvm install --lts
Installing latest LTS version.
Downloading and installing node v20.9.0...
Downloading https://nodejs.org/dist/v20.9.0/node-v20.9.0-darwin-iPad6,7.tar.xz...
--2023-11-13 13:48:06--  https://nodejs.org/dist/v20.9.0/node-v20.9.0-darwin-iPad6,7.tar.xz
Resolving nodejs.org (nodejs.org)... 2606:4700:10::6814:172e, 2606:4700:10::6814:162e, 104.20.23.46, ...
Connecting to nodejs.org (nodejs.org)|2606:4700:10::6814:172e|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-11-13 13:48:07 ERROR 404: Not Found.

Binary download from https://nodejs.org/dist/v20.9.0/node-v20.9.0-darwin-iPad6,7.tar.xz failed, trying source.
grep: /var/jb/var/root/.nvm/.cache/bin/node-v20.9.0-darwin-iPad6,7/node-v20.9.0-darwin-iPad6,7.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Clang v3.5+ detected! CC or CXX not specified, will use Clang as C/C++ compiler!
Local cache found: ${NVM_DIR}/.cache/src/node-v20.9.0/node-v20.9.0.tar.xz
Checksums match! Using existing downloaded archive ${NVM_DIR}/.cache/src/node-v20.9.0/node-v20.9.0.tar.xz
$>./configure --prefix=/var/jb/var/root/.nvm/versions/node/v20.9.0 <
./configure: 6: exec: /bin/sh: not found
nvm: install v20.9.0 failed!

And now:

./configure: 6: exec: /bin/sh: not found 🙄 How could that be. It's useable in the terminal and I'm root ...

# sh
# id
uid=0(root) gid=0(wheel) groups=0(wheel)

... but its symlinked and not in /bin/sh . Because the jailbreak is rootless I have no write permission into this system-folder

# where sh
/var/jb/usr/bin/sh
/var/jb/bin/sh

That's sad ...

Einstein2150 commented 10 months ago

Now I manually un-xz-ed the archive and modified line 6 in configure from /bin/sh to /var/jb/bin/sh. It runs but ...

# ./configure
Node.js configure: Found Python 3.9.9...
gyp: [Errno 2] No such file or directory: '/bin/sh' while executing command 'python -c "import sys; print(sys.byteorder)"' in /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/.nvm/.cache/src/node-v20.9.0/node-v20.9 (1)/tools/v8_gypfiles/v8.gyp while loading dependencies of /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/.nvm/.cache/src/node-v20.9.0/node-v20.9 (1)/node.gyp while trying to load /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/.nvm/.cache/src/node-v20.9.0/node-v20.9 (1)/node.gyp
Error running GYP

same for python. Someone knows a trick to tell python that it must look to /var/jb/bin/sh? In /private/preboot/15C4E8BD455092F48176EAFD3FF8496C402D0840/jb-JHP37VM6/procursus/var/root/.nvm/.cache/src/node-v20.9.0/node-v20.9 (1)/node.gyp there is no /bin/sh-entry ...