Skip to content
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

Merged
merged 14 commits into from
Nov 20, 2020

Conversation

Matioupi
Copy link
Contributor

@Matioupi Matioupi commented Nov 2, 2020

  • 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...

Comment on lines 116 to 123
# 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()
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@PhoebeHui PhoebeHui Nov 10, 2020

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.

Copy link
Contributor

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!

Copy link
Contributor

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.

@PhoebeHui PhoebeHui changed the title Curl fixes [curl] Fixes pkgconfig configuration file Nov 3, 2020
@PhoebeHui PhoebeHui added category:port-bug The issue is with a library, which is something the port should already support requires:author-response labels Nov 3, 2020
@PhoebeHui PhoebeHui added info:reviewed Pull Request changes follow basic guidelines and removed requires:author-response labels Nov 10, 2020
@PhoebeHui PhoebeHui removed the info:reviewed Pull Request changes follow basic guidelines label Nov 10, 2020
endif()
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcurl.pc DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
endif()

Copy link
Contributor

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

Suggested change
vcpkg_fixup_pkgconfig()

Copy link
Contributor Author

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

This reverts commit cb4da8b.
@Matioupi
Copy link
Contributor Author

With commit cb4da8b
build with features such as : .\vcpkg\vcpkg.exe install curl[core,tool,http2,ssh,openssl,winssl,mbedtls,sspi]:x64-windows
fails (where not failing before the commit)

@PhoebeHui
Copy link
Contributor

PhoebeHui commented Nov 18, 2020

@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

-- Fixing pkgconfig file: D:/packages/curl_x86-windows/lib/pkgconfig/libcurl.pc
-- CHECK_LIB_wldap32_RELEASE:CHECK_LIB_wldap32_RELEASE-NOTFOUND
CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:233 (message):
  Library "wldap32" 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:299 (vcpkg_fixup_pkgconfig_check_files)
  ports/curl/portfile.cmake:144 (vcpkg_fixup_pkgconfig)
  scripts/ports.cmake:136 (include)

x64-uwp:

CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:233 (message):
  Library "crypt32" 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:299 (vcpkg_fixup_pkgconfig_check_files)
  ports/curl/portfile.cmake:144 (vcpkg_fixup_pkgconfig)
  scripts/ports.cmake:136 (include)

x64-linux and x64-osx

-- Fixing pkgconfig file: /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/libcurl.pc
-- CHECK_LIB_c /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libssl.a /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libcrypto.a /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libz.a_RELEASE:CHECK_LIB_c /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libssl.a /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libcrypto.a /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libz.a_RELEASE-NOTFOUND
CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:233 (message):
  Library "c
  /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libssl.a
  /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libcrypto.a
  /mnt/vcpkg-ci/packages/curl_x64-linux/lib/pkgconfig/../../lib/libz.a" 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

@Matioupi
Copy link
Contributor Author

@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)
Copy link
Contributor

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!

Copy link
Contributor Author

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

@PhoebeHui PhoebeHui added the requires:all-feature-testing vcpkg install port[all features supported by that port] needs to be demonstrated to function label Nov 19, 2020
@PhoebeHui
Copy link
Contributor

PhoebeHui commented Nov 19, 2020

@Matioupi, the feature 'c-ares' test fail with x64-windows, could you please take a look?

-- CHECK_LIB_curl E:/vcpkg/14350/vcpkg/packages/curl_x64-windows/lib/cares.lib_RELEASE:CHECK_LIB_curl E:/vcpkg/14350/vcpkg/packages/curl_x64-windows/lib/cares.lib_RELEASE-NOTFOUND
CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:233 (message):
  Library "curl E:/vcpkg/14350/vcpkg/packages/curl_x64-windows/lib/cares.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:299 (vcpkg_fixup_pkgconfig_check_files)
  ports/curl/portfile.cmake:166 (vcpkg_fixup_pkgconfig)
  scripts/ports.cmake:136 (include)

Other features test passed with x64-windows.

@Matioupi
Copy link
Contributor Author

Should be fixed now. I guess the regressions in C.I. are unrelated to those commits

@PhoebeHui
Copy link
Contributor

@Matioupi, please ignore it, currently it has been fixed, I have rerun the CI testing.

All features test passed with x64-windows.

@PhoebeHui PhoebeHui added info:reviewed Pull Request changes follow basic guidelines and removed requires:all-feature-testing vcpkg install port[all features supported by that port] needs to be demonstrated to function requires:author-response labels Nov 20, 2020
@strega-nil strega-nil merged commit 878d7ea into microsoft:master Nov 20, 2020
@strega-nil
Copy link
Contributor

Alright, thanks @Matioupi :D

strega-nil pushed a commit that referenced this pull request Nov 23, 2020
* 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]>
Sungeun0318 pushed a commit to Sungeun0318/-vcpkg that referenced this pull request May 15, 2024
* 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]>
Sungeun0318 pushed a commit to Sungeun0318/-vcpkg that referenced this pull request May 15, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants