-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[curl] Fixes pkgconfig configuration file #14350
Conversation
ports/curl/portfile.cmake
Outdated
# Fix the pkgconfig file for debug | ||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") | ||
if(VCPKG_TARGET_IS_WINDOWS) | ||
vcpkg_replace_string(${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcurl.pc "-lcurl" "-lcurl-d") | ||
vcpkg_replace_string(${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcurl.pc "/lib/zlib.lib" "/debug/lib/zlibd.lib") | ||
endif() | ||
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcurl.pc DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) | ||
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.
Could you use vcpkg_fixup_pkgconfig() instead?
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.
Hello, I tried, but without working examples of how to properly us it, I only achieved to get error messages such as :
for additionnal command :
vcpkg_fixup_pkgconfig(DEBUG_FILES libcurl.pc)
-- Fixing pkgconfig file: C:/src/vcpkg/packages/curl_x64-windows/lib/pkgconfig/libcurl.pc -- CHECK_LIB_curl C:/src/vcpkg/packages/curl_x64-windows/lib/zlib.lib_RELEASE:CHECK_LIB_curl C:/src/vcpkg/packages/curl_x64-windows/lib/zlib.lib_RELEASE-NOTFOUND CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:232 (message): Library "curl C:/src/vcpkg/packages/curl_x64-windows/lib/zlib.lib" was not found! If it is a system library use the SYSTEM_LIBRARIES parameter for the vcpkg_fixup_pkgconfig call! Otherwise, correct the *.pc file Call Stack (most recent call first): scripts/cmake/vcpkg_fixup_pkgconfig.cmake:298 (vcpkg_fixup_pkgconfig_check_files) ports/curl/portfile.cmake:125 (vcpkg_fixup_pkgconfig) scripts/ports.cmake:136 (include)
So in the end, I used a search/replace strategy (as in the zlib portfile by the way).
If you have some examples of how to use vcpkg_fixup_pkgconfig() properly (e.g. in this particular case) I'd change it in the PR and can also add the exemple in https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_fixup_pkgconfig.md which do not contain specific exemples.
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.
@Matioupi, it seems vcpkg_fixup_pkgconfig() doesn't handle this case, cc @Neumann-A, he might be interested in this.
I don't have a good suggestion now, replace the string seems the only way that fix the issue now.
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.
vcpkg_fixup_pkgconfig()
only fixes the paths to make them work with relative paths and checks if the libraries mentioned within the pc file exists. If they do not exists they need to be corrected. As such a) first correct the library names in the *.pc file and b) call vcpkg_fixup_pkgconfig() after that to handle/correct the paths and make them relative.
vcpkg_fixup_pkgconfig is not intended to automatically fix -l flags!
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.
@Neumann-A, I think the zlib also need to be replaced.
From
Libs.private: -lwldap32 -lwinmm -lws2_32 -ladvapi32 -lcrypt32 E:/vcpkg/clean/vcpkg/installed/x64-windows/lib/zlib.lib
To
Libs.private: -lwldap32 -lwinmm -lws2_32 -ladvapi32 -lcrypt32 -lzlib
Then it will check the zlib.pc file when use vcpkg_fixup_pckconfig.
endif() | ||
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcurl.pc DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) | ||
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.
add the call after you corrected the *.pc files
vcpkg_fixup_pkgconfig() |
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.
Hello, I took into account both your request and the one from @PhoebeHui to change :/vcpkg/clean/vcpkg/installed/x64-windows/lib/zlib.lib style lib to -lzlib. Actually, I had to do it otherwise vcpkg_fixup_pkgconfig() call was failing.
I also added other libs for some feature enabled builds such as :
vcpkg.exe install curl[core,tool,http2,ssh,openssl,winssl,mbedtls,sspi]:x64-windows
cb4da8b
to
2938eec
Compare
This reverts commit cb4da8b.
With commit cb4da8b |
@Matioupi, you need to add the following libs as system libraries likes the commit 'cb4da8b' do. BTW, I tested them locally, and it has others issues except the following CI failures. So I summit that changes, I haven't test the features. however, it passed with core. I suggest to test this changes locally with defalut and features. See the CI test failures: x86-windows/x64-windows/x64-windows-static/arm64-windows
x64-uwp:
x64-linux and x64-osx
|
@PhoebeHui : Wouldn't it be better to add those libs as Windows system libs "vcpkg wide" ? as proposed in : aee37bd ? |
@@ -192,5 +192,7 @@ if(VCPKG_TARGET_IS_WINDOWS) | |||
list(APPEND VCPKG_SYSTEM_LIBRARIES vfw32) | |||
list(APPEND VCPKG_SYSTEM_LIBRARIES winmm) | |||
list(APPEND VCPKG_SYSTEM_LIBRARIES wsock32) | |||
list(APPEND VCPKG_SYSTEM_LIBRARIES Ws2_32) | |||
list(APPEND VCPKG_SYSTEM_LIBRARIES ws2_32) |
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.
NO! Add both cases if necessary. vcpkg_fixup_pkgconfig does not do a case insensitive compare!
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.
Ok, so far I've seen no side effet of having ws2_32 instead of Ws2_32 and this change was mostly cosmetic. I believe it's better to have only once the Ws2_32 with the capital W than twice. Will revert to Ws2_32
@Matioupi, the feature 'c-ares' test fail with x64-windows, could you please take a look?
Other features test passed with x64-windows. |
Should be fixed now. I guess the regressions in C.I. are unrelated to those commits |
@Matioupi, please ignore it, currently it has been fixed, I have rerun the CI testing. All features test passed with x64-windows. |
Alright, thanks @Matioupi :D |
* Fix pkgconfig for windows debug build. Re-allow tool feature on non windows platforms * Fix tool feature * Modified debug/release prvate libs according to #14350 (comment) Added vcpkg_fixup_pkgconfig() according to #14350 (comment) * Delete portfile.cmake.orig * Fix pkgconfig * Revert "Fix pkgconfig" This reverts commit cb4da8b. * Bump port version to 3 * add missing system libs for windows. made case type coherent for ws2_32 * Fix build on x64-linux triplet * Reverted ws2_32 to Ws2_32 as discudssed in #14350 (comment) * More fixes for Linux build with features * Fix for feature c-ares * Formatting * First fix attemps for #14681 * More fix for #14681 (Windows only for now) * Add brotli dependcy when brotli feature is enabled * Fixed indentation Co-authored-by: Phoebe Ma <[email protected]>
* Fix pkgconfig for windows debug build. Re-allow tool feature on non windows platforms * Fix tool feature * Modified debug/release prvate libs according to microsoft/vcpkg#14350 (comment) Added vcpkg_fixup_pkgconfig() according to microsoft/vcpkg#14350 (comment) * Delete portfile.cmake.orig * Fix pkgconfig * Revert "Fix pkgconfig" This reverts commit cb4da8b. * Bump port version to 3 * add missing system libs for windows. made case type coherent for ws2_32 * Fix build on x64-linux triplet * Reverted ws2_32 to Ws2_32 as discudssed in microsoft/vcpkg#14350 (comment) * More fixes for Linux build with features * Fix for feature c-ares * Formatting Co-authored-by: Phoebe Ma <[email protected]>
* Fix pkgconfig for windows debug build. Re-allow tool feature on non windows platforms * Fix tool feature * Modified debug/release prvate libs according to microsoft/vcpkg#14350 (comment) Added vcpkg_fixup_pkgconfig() according to microsoft/vcpkg#14350 (comment) * Delete portfile.cmake.orig * Fix pkgconfig * Revert "Fix pkgconfig" This reverts commit cb4da8b. * Bump port version to 3 * add missing system libs for windows. made case type coherent for ws2_32 * Fix build on x64-linux triplet * Reverted ws2_32 to Ws2_32 as discudssed in microsoft/vcpkg#14350 (comment) * More fixes for Linux build with features * Fix for feature c-ares * Formatting * First fix attemps for microsoft/vcpkg#14681 * More fix for microsoft/vcpkg#14681 (Windows only for now) * Add brotli dependcy when brotli feature is enabled * Fixed indentation Co-authored-by: Phoebe Ma <[email protected]>
What does your PR fix?
This PR fixes the libcurl.pc pkgconfig configuration file for windows debug build. It also enables tool on non windows platforms (except uwp)
Which triplets are supported/not supported? Have you updated the CI baseline?
test triplets : x64-windows / x64-windows-static / x86-windows / x86-windows-static / x64-linux / arm64-linux
(tested with/without tool feature enabled) and x64-uwp (core feature only)
Yes, to the best of my knowledge...