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

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

Closed
karliss opened this issue Sep 3, 2024 · 4 comments · Fixed by #3375
Closed

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

karliss opened this issue Sep 3, 2024 · 4 comments · Fixed by #3375

Comments

@karliss
Copy link
Member

karliss commented Sep 3, 2024

Goals:

  • test that it's possible
  • create CI jobs which automatically test this
    • should use the artifacts from the other jobs to ensure clean environment instead of reusing some of the intermediate build files or direct headers from Cutter source build
    • might need cutter-deps (on Windows and Linux)
@karliss
Copy link
Member Author

karliss commented Sep 3, 2024

Current status:

  • macOS
    • find_package(Cutter) and rizin worked with CMAKE_PREFIX_PATH to Cutter.App/Contents/Resources
    • make file generation succeeded
    • compilation failed, couldn't find rizin header file (probably a mistake in Rizin cmake files or flags used by Cutter to build rizin)
  • Linux appimage -
    • warning about "Cannot generate a safe runtime search path for target sample_plugin because files in some irectories may conflict with libraries in implicit directories" and the list of libs from the Appimage which would shadow the system libs. Not sure if this is an issue, we kind of want the appimage libs to replace the system libs.
    • same rizin header issue as on macOS
  • Windows - need to check

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
Copy link
Member Author

karliss commented Sep 3, 2024

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
Copy link
Member Author

karliss commented Sep 3, 2024

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
Copy link
Member

wargio commented Sep 3, 2024

Nice. i did this once on windows.

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

Successfully merging a pull request may close this issue.

2 participants