fix(algo): link networkit_state and deploy its DLL on Windows - #53
Closed
adsharma wants to merge 1 commit into
Closed
fix(algo): link networkit_state and deploy its DLL on Windows#53adsharma wants to merge 1 commit into
adsharma wants to merge 1 commit into
Conversation
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.
Contributor
Author
|
Landed via #52 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Windows link of the algo extension fails with LNK2019/LNK1120, e.g.:
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— theGlobalStatesingletonThe static lib's members reference the
GlobalStateaccessors via__imp_*dllimportthunks (21 of them), but the algo extension only linked
networkit.lib— nevernetworkit_state.lib— so the__imp_GlobalState::*thunks were unresolved.Verified against the actual artifact:
networkit.libdefines zero__imp_symbols butreferences 21
__imp_GlobalState::*;networkit_state.libdefines both the plain and__imp_forms of all 24GlobalStateaccessors.Fix
download_icebug.cmake: onWIN32, alsofind_librarynetworkit_state(in both theprebuilt
vendor/lib/networkitpath and theICEBUG_SOURCE_DIRlocal-build path) and setICEBUG_STATE_LIB/ICEBUG_STATE_DLL.algo/CMakeLists.txt: onWIN32, linkICEBUG_STATE_LIBand add a post-build copy ofnetworkit_state.dllnext to the built extension so the imports resolve at load time.Notes
networkit_state.dllstill isn't found at load time on Windows (it must be on PATH orbeside 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.