rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.9k stars 1.15k forks source link

Make sure cutter sample cpp plugins can be compiled against main release packages. #3372

Closed karliss closed 2 months ago

karliss commented 2 months ago

Goals:

karliss commented 2 months ago

Current status:

While it might be possible to hack the plugin build to force it finding rizin headers, that shouldn't be necesarry with properly made cmake library files. It should work by just having single CMAKE_PREFIX_PATH to locate the .cmake files.

karliss commented 2 months ago

Both the macOS an Linux issue was caused by #include <rizin/rz_core.h> vs #include <rz_core.h>. Since the cmake files set the include dir to "appimage_location/usr/lib/include/rizin" instead of ".../include" so the plugin had to use the later form. Haven't yet tested how well the compiled plugins work.

Rizin headers at least are prefixed by rz_, minimizing chance of conflict. But a lot of cutter headers have very generic sounding names. I would probably prefer if the cutter headers were namespace into "cutter/" folder instead of polluting top level include level. If that means that includes in the cutter source itself becomes a bit more verbose, I am willing to accept that.

Should probably look into how different libraries handle it, before deciding on doing major changes with regards to header handling.

karliss commented 2 months ago

With the include adjustment and adding CMAKE_PREFIX_PATH for cutter and cutter-deps was able to compile and run the sample plugin on Linux and macOS.

wargio commented 2 months ago

Nice. i did this once on windows.