Skip to content

Fix linking libraries on Windows #6462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2017
Merged

Fix linking libraries on Windows #6462

merged 1 commit into from
Jan 11, 2017

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Dec 22, 2016

  • Don't add _IMPLIB libraries, to avoid the following errors:
could not find dependency 'swiftCore_IMPLIB-NOTFOUND'

Extracted from #5904

@hughbe hughbe changed the title Fix linking libraries on Windows using MSVC Fix linking libraries on Windows Dec 22, 2016
set(dep "${CMARK_LIBRARY_DIR}/${dep}.lib")
else()
set(dep "${CMARK_LIBRARY_DIR}/lib${dep}.a")
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... Actually, aren't all of the ${SWIFTLIB_SINGLE_LINK_LIBRARIES} targets? We should use the OUTPUT_NAME from the target (or the LINK_LIBRARY) property to get the name to link against without having to worry about the target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I've extracted this section of code to #6498. I haven't checked this recommendation out yet but I'll research


# On Windows, we need to link mincore.lib for various file system APIs used by Clang.
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
target_link_libraries("${name}" "mincore.lib")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't clang have to link against those as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is weird - very weird. I've done some research - only lib/AST and tools/SourceKit/lib/SwiftLang need mincore.lib. This is because they directly link to clangDriver.lib

@hughbe
Copy link
Contributor Author

hughbe commented Dec 27, 2016

I've updated the PR just to fix the _IMPLIB stuff - the other PRs should be rather self explantory

@moiseev
Copy link
Contributor

moiseev commented Jan 9, 2017

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 23b2a4a into swiftlang:master Jan 11, 2017
@hughbe hughbe deleted the libraries-windows branch January 11, 2017 08:32
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.

4 participants