Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build on mac #600

Open
thushw opened this issue May 23, 2024 · 6 comments
Open

build on mac #600

thushw opened this issue May 23, 2024 · 6 comments

Comments

@thushw
Copy link

thushw commented May 23, 2024

I'm on MacOS Monterey (12.2.1) and hit an issue trying to build the plugin with r2pm -ci r2frida. Could you help?

...
...
make io_frida.dylib
r2pm -r src/r2frida-compile -H src/_agent.h -o src/_agent.js -Sc src/agent/index.ts
make[1]: *** [src/_agent.js] Error 11
make: *** [all] Error 2
Build failed
mkdir -p /"/Users/thushara/.local/share/radare2/plugins"
mkdir -p /"/Users/thushara/.local/share/radare2/prefix/bin"
rm -f "//Users/thushara/.local/share/radare2/plugins/io_frida.dylib"
cp -f io_frida.dylib* /"/Users/thushara/.local/share/radare2/plugins"
cp: io_frida.dylib*: No such file or directory
make: *** [user-install] Error 1
Install fail
@trufae
Copy link
Member

trufae commented May 23, 2024

This looks like a segfault on the typescript compiler of the frida sdk. Are you on x64?

@thushw
Copy link
Author

thushw commented May 23, 2024

Yes, it is a 6-Core Intel Core i7

Screen Shot 2024-05-23 at 11 04 04 AM

@trufae
Copy link
Member

trufae commented May 24, 2024

Try running with lldb — src/r2frida-compile -H src/_agent.h -o src/_agent.js -Sc src/agent/index.ts

Maybe you need to “r2pm -r sh” to set the proper environment. Will be useful to have a backtrace of the crash

@thushw
Copy link
Author

thushw commented May 24, 2024

It might be my compiler, the lldb command unfortunately did not work :

Screen Shot 2024-05-24 at 9 18 58 AM

This is the full log of the build failure :

r2pm -ci r2frida
INFO: Cleaning r2frida
INFO: Using r2-5.9.3 and r2pm-5.9.3
INFO: Cleaning r2frida
INFO: git clone --depth=10 --recursive https://github.com/nowsecure/r2frida /Users/thushara/.local/share/radare2/r2pm/git//r2frida
Cloning into '/Users/thushara/.local/share/radare2/r2pm/git//r2frida'...
remote: Enumerating objects: 185, done.
remote: Counting objects: 100% (185/185), done.
remote: Compressing objects: 100% (145/145), done.
remote: Total 185 (delta 32), reused 123 (delta 25), pack-reused 0
Receiving objects: 100% (185/185), 207.02 KiB | 5.45 MiB/s, done.
Resolving deltas: 100% (32/32), done.
INFO: Starting install for r2frida
INFO: SCRIPT=<<EOF
INFO: 	unset CFLAGS
	unset LDFLAGS
	./configure || R2PM_FAIL "Install fail"
	if [ -n "${FRIDA_VERSION}" ]; then
		${MAKE} frida_version=${FRIDA_VERSION} || R2PM_FAIL "Build failed"
	else
		${MAKE} || R2PM_FAIL "Build failed"
	fi
	if [ "$GLOBAL" = 1 ]; then
		${R2PM_SUDO} ${MAKE} install || R2PM_FAIL "Install fail"
	else
		${MAKE} user-install R2_PLUGDIR="${R2PM_PLUGDIR}" || R2PM_FAIL "Install fail"
	fi
INFO: EOF
checking build system type... x86_64-unknown-darwin
checking host system type... x86_64-unknown-darwin
checking target system type... x86_64-unknown-darwin
checking for working directories... current
using prefix '/usr/local'
checking for pkg-config... /usr/local/bin/pkg-config
checking for c compiler... gcc
checking exec r2 -v... ok
Using PKGCONFIG: /usr/local/bin/pkg-config
checking pkg-config flags for r_core... yes
checking for curl... /usr/bin/curl
checking for wget... /usr/local/bin/wget
checking for git... /usr/bin/git
checking for xz... /usr/local/bin/xz
creating ./config.mk
creating ./config.h
cleaning temporally files... done

Final report:
 - R2_VERSION = radare2 5.9.3 32155 @ darwin-x86-64
birth: git.5.9.2-12-g42a463096c 2024-05-23__10:17:17
commit: 42a463096ca89d33f6b1be77cfc066aee1e17dd4
options: gpl -O2 cs:5 cl:2 make
rm -f ext/frida
mkdir -p ext/frida-macos-16.2.5/_
rm -f frida-sdk.tar.xz
wget -c -O frida-sdk.tar.xz -c https://github.com/frida/frida/releases/download/16.2.5/frida-core-devkit-16.2.5-macos-x86_64.tar.xz
--2024-05-24 09:18:27--  https://github.com/frida/frida/releases/download/16.2.5/frida-core-devkit-16.2.5-macos-x86_64.tar.xz
Resolving github.com (github.com)... 140.82.116.4
Connecting to github.com (github.com)|140.82.116.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/9405122/947881ba-b165-4cbc-ab7f-e4c6f600776f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240524T161827Z&X-Amz-Expires=300&X-Amz-Signature=5d973c1c19c171c6f224fa83d027696b2ccfd86dadbaa2b34df72f184ae2a00b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9405122&response-content-disposition=attachment%3B%20filename%3Dfrida-core-devkit-16.2.5-macos-x86_64.tar.xz&response-content-type=application%2Foctet-stream [following]
--2024-05-24 09:18:27--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/9405122/947881ba-b165-4cbc-ab7f-e4c6f600776f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240524T161827Z&X-Amz-Expires=300&X-Amz-Signature=5d973c1c19c171c6f224fa83d027696b2ccfd86dadbaa2b34df72f184ae2a00b&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9405122&response-content-disposition=attachment%3B%20filename%3Dfrida-core-devkit-16.2.5-macos-x86_64.tar.xz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 32035044 (31M) [application/octet-stream]
Saving to: ‘frida-sdk.tar.xz’

frida-sdk.tar.xz                100%[=====================================================>]  30.55M  24.4MB/s    in 1.3s

2024-05-24 09:18:29 (24.4 MB/s) - ‘frida-sdk.tar.xz’ saved [32035044/32035044]

tar xJvf frida-sdk.tar.xz -C ext/frida-macos-16.2.5/_
x ./
x ./frida-core.h
x ./libfrida-core.a
x ./frida-core-example.c
mv ext/frida-macos-16.2.5/_/* ext/frida-macos-16.2.5
rmdir ext/frida-macos-16.2.5/_
#mv ext/frida ext/frida-macos-16.2.5
cd ext && ln -fs frida-macos-16.2.5 frida
[ "`readlink ext/frida`" = frida-macos-16.2.5 ] || \
		(cd ext && rm -f frida ; ln -fs frida-macos-16.2.5 frida)
rm -f src/_agent*
make src/r2frida-compile
cc -g src/r2frida-compile.c -Iext/frida  \
		-I/usr/local/include/libr -L/usr/local/lib -lr_util -ldl ext/frida/libfrida-core.a -framework Foundation -lbsm -framework AppKit -lresolv \
		-DFRIDA_VERSION_STRING=\"16.2.5\" -DFRIDA_VERSION_MAJOR=16 -DR2FRIDA_VERSION_STRING=\"5.9.2\" -fPIC -Wall -Werror -g -I/usr/local/include/libr -DWANT_SESSION_DEBUGGER=1 -fPIC -g -L/usr/local/lib -lr_core -lm -lr_config -ldl -lr_debug -ldl -lr_bin -ldl -lr_lang -ldl -lr_anal -ldl -lr_bp -ldl -lr_egg -ldl -lr_asm -ldl -lr_flag -ldl -lr_search -ldl -lr_syscall -ldl -lr_fs -ldl -lr_magic -ldl -lr_arch -ldl -lr_esil -ldl -lr_reg -ldl -lr_io -ldl -lr_socket -ldl -lr_cons -ldl -lr_crypto -ldl -lr_util -ldl -pthread -Iext/frida -o src/r2frida-compile
make io_frida.dylib
r2pm -r src/r2frida-compile -H src/_agent.h -o src/_agent.js -Sc src/agent/index.ts
make[1]: *** [src/_agent.js] Error 11
make: *** [all] Error 2
Build failed
mkdir -p /"/Users/thushara/.local/share/radare2/plugins"
mkdir -p /"/Users/thushara/.local/share/radare2/prefix/bin"
rm -f "//Users/thushara/.local/share/radare2/plugins/io_frida.dylib"
cp -f io_frida.dylib* /"/Users/thushara/.local/share/radare2/plugins"
cp: io_frida.dylib*: No such file or directory
make: *** [user-install] Error 1
Install fail
(thushara) thushara@thusharas-MBP rooted-phone $

@trufae
Copy link
Member

trufae commented May 24, 2024

Its a double dash “lldb — ..” instead of “lldb - ..”

@thushw
Copy link
Author

thushw commented May 24, 2024

Many thanks for helping me through this! lldb drops me to a shell like this, where I typed run (I figure this is a debugger) It looked like it worked (exit code 0)

Screen Shot 2024-05-24 at 4 53 39 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants