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

radare2 fails to build on macOS High Sierra #22793

Closed
armdn opened this issue Apr 4, 2024 · 12 comments
Closed

radare2 fails to build on macOS High Sierra #22793

armdn opened this issue Apr 4, 2024 · 12 comments

Comments

@armdn
Copy link

armdn commented Apr 4, 2024

Environment

Thu Apr  4 10:48:31 MSK 2024
radare2 5.8.8 0 @ darwin-x86-64
birth: git.5.8.8 2023-06-08__13:54:42
commit: 5.8.8
options: gpl release -O1 cs:5 cl:2 make
Darwin x86_64
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Description

Newer version of radare2 v.5.9.0 fails to build (from homebrew) with this logs with error in end:

Last 15 lines from /Users/admin/Library/Logs/Homebrew/radare2/02.make:
clang -c -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/include  -MD -fno-common   -fPIC -Wall -g -DR2__UNIX__=1 -DR2_PLUGIN_INCORE -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/zip/include -Ip/libbfwbf/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/bochs/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/gdb/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/qnx/include/ -Ip/librapwrap/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/winkd/ -DXNU_USE_PTRACE=0 -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -fvisibility=hidden -o p/debug_rap.o p/debug_rap.c
clang -c -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/include  -MD -fno-common   -fPIC -Wall -g -DR2__UNIX__=1 -DR2_PLUGIN_INCORE -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/zip/include -Ip/libbfwbf/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/bochs/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/gdb/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/qnx/include/ -Ip/librapwrap/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/winkd/ -DXNU_USE_PTRACE=0 -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -fvisibility=hidden -o p/debug_rv32ima.o p/debug_rv32ima.c
clang -c -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/include  -MD -fno-common   -fPIC -Wall -g -DR2__UNIX__=1 -DR2_PLUGIN_INCORE -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/zip/include -Ip/libbfwbf/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/bochs/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/gdb/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/qnx/include/ -Ip/librapwrap/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/winkd/ -DXNU_USE_PTRACE=0 -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -fvisibility=hidden -o p/debug_winkd.o p/debug_winkd.c
clang -c -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/include  -MD -fno-common   -fPIC -Wall -g -DR2__UNIX__=1 -DR2_PLUGIN_INCORE -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/zip/include -Ip/libbfwbf/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/bochs/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/gdb/include/ -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/qnx/include/ -Ip/librapwrap/include -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/winkd/ -DXNU_USE_PTRACE=0 -I/private/tmp/radare2-20240404-45088-vxfubn/radare2-5.9.0/libr/../shlr/sdb/include -fvisibility=hidden -o p/native/xnu/xnu_debug.o p/native/xnu/xnu_debug.c
In file included from p/native/xnu/xnu_debug.c:47:
p/native/xnu/xnu_threads.c:275:4: error: use of undeclared identifier 'THREAD_CONVERT_THREAD_STATE_TO_SELF'
                        THREAD_CONVERT_THREAD_STATE_TO_SELF,
                        ^
1 error generated.
make[5]: *** [p/native/xnu/xnu_debug.o] Error 1
make[4]: *** [prelib-build] Error 2
make[3]: *** [foo] Error 2
make[2]: *** [debug] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2


Test

Just tried upgrade radare2 to newer version via brew.

@trufae trufae added this to the 5.9.2 - codename neatrunner milestone Apr 4, 2024
@trufae
Copy link
Collaborator

trufae commented Apr 4, 2024

i dont have any sierra around. but the error seems related to the commit adding support to sonoma, maybe you can work out an ifdef patch tweaking this commit 08e232d because the one above should be building and working fine on your side.

Can you clone the repo and try to get this patch ready? i dont think the convert logic was necessary before the arm64e cpus and this was added later. So maybe commenting out the block will build and make the debugger work without too much extra work

Screenshot 2024-04-04 at 20 15 10

@armdn
Copy link
Author

armdn commented Apr 5, 2024

Thanks for the answer! Will try tomorrow!

@armdn
Copy link
Author

armdn commented Apr 5, 2024

Tried to build latest version from git on macOS 10.14.6, and the same error...

[debug 934] CC p/native/xnu/xnu_debug.c
In file included from p/native/xnu/xnu_debug.c:47:
p/native/xnu/xnu_threads.c:276:4: error: use of undeclared identifier 'THREAD_CONVERT_THREAD_STATE_TO_SELF'
                        THREAD_CONVERT_THREAD_STATE_TO_SELF,
                        ^
1 error generated.
make[5]: *** [p/native/xnu/xnu_debug.o] Error 1
make[4]: *** [prelib-build] Error 2
make[3]: *** [foo] Error 2
make[2]: *** [debug] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

@trufae
Copy link
Collaborator

trufae commented Apr 16, 2024

any chance to get a fix for this upstream? i'm looking forward releasing a 5.9.2 for bugfixes mainly

@trufae
Copy link
Collaborator

trufae commented Apr 16, 2024

@armdn i didnt touched the code, so it's expected that the error is the same. i was just sharing the code for you to fix it, because i dont have any high sierra to test

@trufae
Copy link
Collaborator

trufae commented Apr 16, 2024

here's my blind fix #22838

@armdn
Copy link
Author

armdn commented Apr 16, 2024

Will try that fix in a day or two (im out of my home in other city for now).

@armdn
Copy link
Author

armdn commented Apr 18, 2024

here's my blind fix #22838

Tried latest code from git, and YES build is completed successfully!

@trufae
Copy link
Collaborator

trufae commented Apr 18, 2024

But can you confirm the debugger works?

@trufae
Copy link
Collaborator

trufae commented Apr 28, 2024

ping? i'll close the ticket, but will be good to confirm the debugger is working as expected

@trufae trufae closed this as completed Apr 28, 2024
@armdn
Copy link
Author

armdn commented May 1, 2024

Yes, debugger is working. I checked it right after building.

@trufae
Copy link
Collaborator

trufae commented May 1, 2024

Great!! Thank you i love when blindfixes work at first try

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