-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
vcpkg_check_linkage: Better explain the ONLY_DYNAMIC_LIBRARY situation #42508
base: master
Are you sure you want to change the base?
Conversation
if("${VCPKG_CRT_LINKAGE}" STREQUAL "static") | ||
message(FATAL_ERROR "This port can only build as a dynamic library, but the triplet \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick?
if("${VCPKG_CRT_LINKAGE}" STREQUAL "static") | |
message(FATAL_ERROR "This port can only build as a dynamic library, but the triplet \ | |
if("${VCPKG_CRT_LINKAGE}" STREQUAL "static") | |
message(FATAL_ERROR "This port can only build as a dynamic library, but the triplet \ | |
For example, on Windows, each DLL will get its own copy of the CRT, meaning such DLLs cannot share \ | ||
standard library components over the DLL boundary. On non-Windows, different .sos or .dylibs may \ | ||
cause mutually incompatible symbols from different CRT versions to be concurrently loaded. | ||
If you can edit the port calling vcpkg_check_linkage emitting this message, consider adding \ | ||
(!static | !static-crt) to the \"supports\" expression so that this combination can fail early. | ||
If you are merely consuming this port, you can consider choosing a triplet which selects a dynamic \ | ||
CRT and/or library linkage. If you really know what you're doing, understand the potential \ | ||
problems a static CRT with a dynamic library can cause, and are confident that this port safely \ | ||
handles that configuration and want to proceed anyway, author a custom triplet which explicitly \ | ||
sets VCPKG_LIBRARY_LINKAGE to dynamic and VCPKG_CRT_LINKAGE to static. For example: | ||
if(\"\${PORT}\" STREQUAL \"${PORT}\") | ||
set(VCPKG_LIBRARY_LINKAGE dynamic) | ||
set(VCPKG_CRT_LINKAGE static) | ||
endif()") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to move these details to https://learn.microsoft.com/vcpkg/maintainers/functions/vcpkg_check_linkage, and to only print a link here.
(And perhaps print the original intro "Refusing to build unexpected dynamic library against the static CRT.")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please! This is way too long! Nobody will read this 17 lines long message!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please! This is way too long! Nobody will read this 17 lines long message!
I don't think someone unwilling to read the 17 line message will be willing to go to separate documentation pages and read the same message either.
if("${VCPKG_CRT_LINKAGE}" STREQUAL "static") | ||
message(FATAL_ERROR "This port can only build as a dynamic library, but the triplet \ | ||
selects a static library and a static CRT. Building a dynamic library with a static CRT creates \ | ||
conditions many developers find surprising, and for which most ports are unprepared, so vcpkg will \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conditions many developers find surprising, and for which most ports are unprepared, so vcpkg will \ | |
conditions many developers find surprising and for which most ports are unprepared. Therefore, vcpkg will \ |
For example, on Windows, each DLL will get its own copy of the CRT, meaning such DLLs cannot share \ | ||
standard library components over the DLL boundary. On non-Windows, different .sos or .dylibs may \ | ||
cause mutually incompatible symbols from different CRT versions to be concurrently loaded. | ||
If you can edit the port calling vcpkg_check_linkage emitting this message, consider adding \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can edit the port calling vcpkg_check_linkage emitting this message, consider adding \ | |
If you can edit the port calling vcpkg_check_linkage that emits this message, consider adding \ | |
cause mutually incompatible symbols from different CRT versions to be concurrently loaded. | ||
If you can edit the port calling vcpkg_check_linkage emitting this message, consider adding \ | ||
(!static | !static-crt) to the \"supports\" expression so that this combination can fail early. | ||
If you are merely consuming this port, you can consider choosing a triplet which selects a dynamic \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are merely consuming this port, you can consider choosing a triplet which selects a dynamic \ | |
If you are consuming this port, consider choosing a triplet that selects a dynamic \ |
problems a static CRT with a dynamic library can cause, and are confident that this port safely \ | ||
handles that configuration and want to proceed anyway, author a custom triplet which explicitly \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
problems a static CRT with a dynamic library can cause, and are confident that this port safely \ | |
handles that configuration and want to proceed anyway, author a custom triplet which explicitly \ | |
problems a static CRT with a dynamic library can cause, are confident that this port safely \ | |
handles that configuration, and want to proceed anyway, author a custom triplet which explicitly \ |
I cancelled the build pending review of dg0yt's comment by other maintainers: #42508 (comment) and I'll apply everything else. (I just didn't want to cause another validation run with that outstanding) |
The failures are baseline issues. |
Related: #42456
I know the formatting looks strange; this is a workaround for
FATAL_ERROR
's behavior that inserts extra newlines :(Output looks like this: