Skip to content

fix(algo): link networkit_state and deploy its DLL on Windows - #53

Closed
adsharma wants to merge 1 commit into
mainfrom
fix/algo-link-networkit-state
Closed

fix(algo): link networkit_state and deploy its DLL on Windows#53
adsharma wants to merge 1 commit into
mainfrom
fix/algo-link-networkit-state

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Problem

Windows link of the algo extension fails with LNK2019/LNK1120, e.g.:

networkit.lib(Log.cpp.obj) : error LNK2019: unresolved external symbol
  "__declspec(dllimport) enum Aux::Log::LogLevel __cdecl
  NetworKit::GlobalState::getLogLevel(void)" (__imp_?getLogLevel@GlobalState@NetworKit@@...)

Root cause

The vendored icebug Windows artifact splits NetworKit into two pieces:

  • lib/networkit.lib — a large static lib (Log.cpp.obj, SignalHandling.cpp.obj, ...)
  • lib/networkit/networkit_state.lib + networkit_state.dll — the GlobalState singleton

The static lib's members reference the GlobalState accessors via __imp_* dllimport
thunks (21 of them), but the algo extension only linked networkit.lib — never
networkit_state.lib — so the __imp_GlobalState::* thunks were unresolved.

Verified against the actual artifact: networkit.lib defines zero __imp_ symbols but
references 21 __imp_GlobalState::*; networkit_state.lib defines both the plain and
__imp_ forms of all 24 GlobalState accessors.

Fix

  • download_icebug.cmake: on WIN32, also find_library networkit_state (in both the
    prebuilt vendor/lib/networkit path and the ICEBUG_SOURCE_DIR local-build path) and set
    ICEBUG_STATE_LIB / ICEBUG_STATE_DLL.
  • algo/CMakeLists.txt: on WIN32, link ICEBUG_STATE_LIB and add a post-build copy of
    networkit_state.dll next to the built extension so the imports resolve at load time.

Notes

  • Non-Windows is unaffected (the networit state is bundled into the shared lib).
  • If networkit_state.dll still isn't found at load time on Windows (it must be on PATH or
    beside the loading module), the extension may fail to load even though linking now succeeds —
    the post-build copy places it next to libalgo.lbug_extension.

The vendored icebug Windows artifact splits NetworKit into two pieces:
a large static lib (networkit.lib) and a separate DLL + import lib for the
GlobalState singleton (networkit_state.dll/.lib). The static lib's members
(Log.cpp.obj, SignalHandling.cpp.obj) reference the GlobalState accessors via
__imp_* dllimport thunks, but the algo extension only linked networkit.lib,
so the link failed with LNK2019/LNK1120 (e.g. GlobalState::getLogLevel).

Resolve networkit_state.lib in download_icebug.cmake (both prebuilt and
ICEBUG_SOURCE_DIR paths), link it on WIN32, and copy networkit_state.dll
next to the built extension so the imports resolve at load time.
@adsharma

Copy link
Copy Markdown
Contributor Author

Landed via #52

@adsharma adsharma closed this Aug 10, 2026
@adsharma
adsharma deleted the fix/algo-link-networkit-state branch August 10, 2026 05:58
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