-
Notifications
You must be signed in to change notification settings - Fork 405
Description
Hi,
I've struggled a lot to have HexRaysCodeXplorer compiling successfully on a Mac Intel (Sonoma 14.7.5) for IDA 9.0 SP1. But after a handful of modifications (some already given in other issues here like #122 or #123), i've finally obtained a compiled and working plugin !
So i thought my "recipe" could help others.
STEP 1
You need to make several modifications to makefile.mac. These are the modified lines:
Now macOS and IDA are both 64-bit only, so must remove all 32-bit flags and specify 64-bit ones
LDFLAGS=-shared
ifdef __MAC__ CFLAGS= -fPIC -D__MAC__ -D__PLUGIN__ -std=c++11 -D__EA64__ -arch x86_64 EXT=dylib endif
Also changed extension: dylib instead of mpc
Remove uneeded lpro library:
LIBS= -lida -lc -lpthread -ldl
There's a comment in the file talking about lida64, but seems it doesn't exist (anymore?) on Mac.
add missing source files:
$(SRCDIR)Compat.cpp \
$(SRCDIR)MicrocodeExtractor.cpp \
Comment out unneeded link:
#ln -f -s $(IDA_SDK)/lib/x86_mac_gcc_32/pro.a libpro.a
I've also tested to use clang++ instead of g++, but not necessary: both are working for me. So optionally:
CC=clang++
I also had to modify these lines because of spaces present in the paths of IDA SDK:
LIBDIR=-L./ -L'$(IDA_DIR)'
INCLUDES=-I'$(IDA_SDK)/include' -I'$(HEXRAYS_SDK)/include'
STEP 2
You have to modify the source code file ReconstructableType.cpp and replace all occurences of following types:
struc_t => udt_type_data_t (only 1 occurence)
member_t => udm_t (be carefull: 4 occurences)
STEP 3
Compile like this (of course adapt your paths)
IDA_DIR=/Applications/IDA\ Professional\ 9.0.app/Contents/MacOS IDA_SDK=/Applications/IDA\ Professional\ 9.0.app/Contents/MacOS/idasdk90 make __EA64__=1 __MAC__=1 -f makefile.mac
and then
make install
That's all! Probably not the cleanest solution, but seems to work.
It could probably work for Apple silicon Mac by changing the architecture -arch ARM64 i suppose, but i have no Apple silicon computer, so can't test.