Repository navigation
Build Windows import libraries with the linker's own lib - #131
Merged
Merged
Conversation
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.
On x86, the import libraries for ZDSR, BoyPCReader and PC-Talker come out with the wrong symbol names whenever
llvm-libis onPATH, and prism fails to link:find_program(PRISM_LIB_TOOL NAMES lib llvm-lib)searchesPATH, and MSVC'slibis only onPATHinside a developer prompt. Outside one, a Visual Studio generator build picks upllvm-libwherever LLVM is installed, which includes GitHub's Windows runners. The two read the*32.deffiles differently. GivenPCTKStatus@0,libmakes the symbol_PCTKStatus@0and importsPCTKStatus@0, whilellvm-libmakes the symbolPCTKStatus@0as written. The compiler asks for the underscored name, so onlylib's output links. On x64 and ARM64 nothing is decorated, so the two tools agree there and the problem stays hidden.What this does
The search now looks beside
CMAKE_LINKERfirst. With MSVC that is wherelib.exelives, so the librarian always matches the toolchain doing the build. With clang-cl andlld-link, the linker's directory is LLVM's own, sollvm-libis still what it finds.PATHis searched afterwards, as before.Testing
Built shared for Win32 with the Visual Studio 2022 generator, with Scoop's LLVM first on
PATH. Before, the link failed as above. After,PRISM_LIB_TOOLresolves to MSVC'sHostx64/x86/lib.exe, prism links, anddumpbin /importsshowsPCTKUSR.dllimported by the names the definition files give, such asPCTKPinStatus@0. Not tested with clang-cl.