Skip to content

fix: decouple libidalib from plugin build#19

Merged
0xeb merged 2 commits intomainfrom
decouple-idalib-from-plugin
Mar 5, 2026
Merged

fix: decouple libidalib from plugin build#19
0xeb merged 2 commits intomainfrom
decouple-idalib-from-plugin

Conversation

@0xeb
Copy link
Member

@0xeb 0xeb commented Mar 5, 2026

Summary

  • Decouples libidalib from the IDA plugin binary. The static library (liblibidasql.a) no longer links idasdk::idalib — it only uses compilation-only targets (ida_compiler_settings, ida_platform_settings) plus SDK include paths. Each consumer brings its own SDK target.
  • Extracts Session implementation into session.cpp. Session is the only code with idalib symbol references (init_library, open_database, close_database). When the plugin links the static archive, session.o is never pulled in — the idalib symbols never need resolution.
  • No header or API changes. The header still declares Session (declarations don't create symbol references). CLI and plugin CMakeLists are unchanged — they already get the right SDK target from ida_add_idalib() / ida_add_plugin().

Before

All three platform plugin binaries (.dll, .so, .dylib) unnecessarily linked libidalib.

After

  • Plugin: links libida.dylib only — no libidalib
  • CLI: links both libida.dylib and libidalib.dylib (as expected)

Verified locally on macOS:

$ otool -L idasql.dylib | grep idalib
# (no output — libidalib is gone)

$ otool -L idasql | grep idalib
@rpath/libidalib.dylib

Test plan

  • CI builds pass on all platforms (Windows, Linux, macOS)
  • Plugin binary does NOT link libidalib on any platform
  • CLI binary still links both libida and libidalib
  • Plugin loads in IDA GUI and HTTP server works
  • CLI: idasql -s <db> -q "SELECT * FROM welcome" succeeds

0xeb added 2 commits March 5, 2026 13:16
The idasql static library linked idasdk::idalib as PUBLIC, forcing all
consumers — including the IDA plugin — to transitively link
libidalib.dylib. The plugin runs inside IDA GUI and should only link
libida.dylib (via idasdk::plugin). libidalib is strictly for standalone
programs.

Two changes working together:

1. CMake: Replace idasdk::idalib with compilation-only targets
   (ida_compiler_settings, ida_platform_settings) plus SDK include path.
   No SDK library linkage on the static lib — each consumer already gets
   the right SDK target from its own cmake macro.

2. TU split: Extract Session implementation into session.cpp. Session is
   the only code with idalib symbol references (init_library,
   open_database, close_database). When the plugin links the static
   archive, no plugin code references Session symbols, so session.o is
   never pulled in and idalib symbols never need resolution.
Decouples idasql from ida-sdk's submodule pin of ida-cmake. This gives
us immediate control over build fixes (e.g. link order) without waiting
for upstream ida-sdk to update its submodule.
@0xeb 0xeb merged commit 947ae25 into main Mar 5, 2026
8 checks passed
@0xeb 0xeb deleted the decouple-idalib-from-plugin branch March 5, 2026 18:48
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 this pull request may close these issues.

1 participant