Identify DLLs from the stage#23
Merged
scheibelp merged 2 commits intospack:mainfrom Apr 28, 2026
Merged
Conversation
0f18e5d to
10f0031
Compare
scheibelp
reviewed
Dec 5, 2025
Member
scheibelp
left a comment
There was a problem hiding this comment.
A few preliminary questions/requests
76ba236 to
e2c35b1
Compare
e2c35b1 to
f60bde8
Compare
Collaborator
Author
|
Rebased on #32 |
…has a pitfall, where post installation, the paths inside import libraries to their corresponding DLLs is no longer valid, as it points to the DLL as it existed at link time, which is the stage. We cannot presume where the DLL will end up in the install tree vs the stage, and we need valid "rpaths" at test time, so we are forced to marshall libs and their dlls post install. Since we cannot 1:1 map a location in an install tree to a location in the stage, we need some other mechanism for aligning these two binaries. Previously we simply used the symbols exported by each, but since import libraries and DLLs can export different sets of symbols, despite the fact they are a import lib/dll pair, we cannot use that approach. Instead, inject the stage path inside the dll via a resource file, so when we go to do relocation post install, we can simply query the stage dll path from the import library, search for a dll with a corresponding entry in the string table, and know we've identified a pair. This PR: Creates a resource descriptor file (res) and injects the current path to the dll (stage time) into the string table with the identifier "59673" (randomly selected number, it just needs to be any consistent identifier) it into the first pass link line that creates the initial dll. The identifier needs to be a numeric, and this is a random one I chose. Signed-off-by: John Parent <john.parent@kitware.com>
Signed-off-by: John Parent <john.parent@kitware.com>
f60bde8 to
8dcfe60
Compare
scheibelp
approved these changes
Apr 28, 2026
| } | ||
|
|
||
| ExecuteCommand rc_executor("rc", | ||
| {"/fo" + res_file_name + " " + rc_file_name}); |
Member
There was a problem hiding this comment.
It looks like these files are being created in the CWD. I think as a follow-up they should be made in a temp dir.
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.
Relocating DLL and their corresponding libs from the stage currently has a pitfall, where post installation, the paths inside import libraries to their corresponding DLLs is no longer valid, as it points to the DLL as it existed at link time, which is the stage. We cannot presume where the DLL will end up in the install tree vs the stage, and we need valid "rpaths" at test time, so we are forced to marshall libs and their dlls post install.
Since we cannot 1:1 map a location in an install tree to a location in the stage, we need some other mechanism for aligning these two binaries. Previously we simply used the symbols exported by each, but since import libraries and DLLs can export different sets of symbols, despite the fact they are a import lib/dll pair, we cannot use that approach.
Instead, inject the stage path inside the dll via a resource file, so when we go to do relocation post install, we can simply query the stage dll path from the import library, search for a dll with a corresponding entry in the string table, and know we've identified a pair.
This PR:
Creates a resource descriptor file (res) and injects the current path to the dll (stage time) into the string table with the identifier as a custom, unique to Spack, "spackresource" type added into the first pass link line that creates the initial dll.