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

[libarchive,lz4] Fix pc file, modernize portfile #20146

Merged
merged 15 commits into from
Sep 24, 2021

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Sep 14, 2021

prefix=${pcfiledir}/../..

exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/../include

Name: libarchive
Description: library that can create and read several streaming archive formats
Version: 3.5.2
Cflags: -I"${includedir}"
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L"${libdir}" -larchive 
Requires: zlib bzip2 liblzma lzo2 liblz4 libzstd libxml-2.0

(Note that libssl and libcrypto are missing. That's how I found that libarchive doesn't use OpenSSL on 'Darwin'.)

@dg0yt dg0yt changed the title [ibarchive] Fix pc file, modernize portfile [libarchive] Fix pc file, modernize portfile Sep 14, 2021
@dg0yt dg0yt mentioned this pull request Sep 14, 2021
1 task
@NancyLi1013 NancyLi1013 added the category:port-bug The issue is with a library, which is something the port should already support label Sep 14, 2021
ports/libarchive/portfile.cmake Outdated Show resolved Hide resolved
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L${libdir} -larchive
Libs.private: @LIBS@
+Requires.private: @LIBARCHIVE_REQUIRES_PRIVATE@
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 please help submit the changes to upstream if possible?

There is also a similar issue from upstream libarchive/libarchive#1446

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try, as time permits.

Copy link

Choose a reason for hiding this comment

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

I would appreciate if someone could help us verify libarchive/libarchive#2253 which claims to be a fix for libarchive/libarchive#1446

ports/libarchive/portfile.cmake Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

After committing all other changes, the version database must be updated
git add -u && git commit
git checkout e201002b4f4827d7b7b672f0c5c672a77fc3b77d -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/l-/libarchive.json b/versions/l-/libarchive.json
index 030b766..43ae7f8 100644
--- a/versions/l-/libarchive.json
+++ b/versions/l-/libarchive.json
@@ -1,7 +1,7 @@
 {
   "versions": [
     {
-      "git-tree": "88d645389e5de66763a38b44824f027bd0afb28c",
+      "git-tree": "eb7c77caa0e229ab1135c93439e828fe817ead73",
       "version-semver": "3.5.2",
       "port-version": 1
     },

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 5d734efcef674dbf9b7b204484fc8f006101dcb5 -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/l-/libarchive.json b/versions/l-/libarchive.json
index 030b766..43ae7f8 100644
--- a/versions/l-/libarchive.json
+++ b/versions/l-/libarchive.json
@@ -1,7 +1,7 @@
 {
   "versions": [
     {
-      "git-tree": "88d645389e5de66763a38b44824f027bd0afb28c",
+      "git-tree": "eb7c77caa0e229ab1135c93439e828fe817ead73",
       "version-semver": "3.5.2",
       "port-version": 1
     },

@dg0yt
Copy link
Contributor Author

dg0yt commented Sep 16, 2021

Hm, there are no pc files for the MSVC builds of port openssl.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 5d734efcef674dbf9b7b204484fc8f006101dcb5 -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/l-/libarchive.json b/versions/l-/libarchive.json
index c2bd24a..db88d23 100644
--- a/versions/l-/libarchive.json
+++ b/versions/l-/libarchive.json
@@ -1,7 +1,7 @@
 {
   "versions": [
     {
-      "git-tree": "8969063703167d3f1f756d4e4150e73ba55399db",
+      "git-tree": "d2243554df7c2ea6e5ea0c0400c938906a5931aa",
       "version-semver": "3.5.2",
       "port-version": 1
     },

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 5d734efcef674dbf9b7b204484fc8f006101dcb5 -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/l-/libarchive.json b/versions/l-/libarchive.json
index c2bd24a..44b6870 100644
--- a/versions/l-/libarchive.json
+++ b/versions/l-/libarchive.json
@@ -1,7 +1,7 @@
 {
   "versions": [
     {
-      "git-tree": "8969063703167d3f1f756d4e4150e73ba55399db",
+      "git-tree": "1b734af1229f28de971d85044a365fb7069b1975",
       "version-semver": "3.5.2",
       "port-version": 1
     },

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

You have modified or added at least one portfile where deprecated functions are used.

If you feel able to do so, please consider migrating them to the new functions:
vcpkg_install_cmake -> vcpkg_cmake_install (from port vcpkg-cmake)
vcpkg_build_cmake -> vcpkg_cmake_build (from port vcpkg-cmake)
vcpkg_configure_cmake -> vcpkg_cmake_configure (Please remove the option PREFER_NINJA) (from port vcpkg-cmake)
vcpkg_fixup_cmake_targets -> vcpkg_cmake_config_fixup (from port vcpkg-cmake-config)

In the ports that use the new function, you have to add the corresponding dependencies:

{
  "name": "vcpkg-cmake",
  "host": true
},
{
  "name": "vcpkg-cmake-config",
  "host": true
}

The following files are affected:

  • ports/libarchive/portfile.cmake

@dg0yt
Copy link
Contributor Author

dg0yt commented Sep 16, 2021

This is complete. If possible this should be tested with #20062 on windows, static and dynamic.
CC @c72578 @JonLiu1993

Comment on lines +33 to 43
include(SelectLibraryConfigurations)
find_library(Z_VCPKG_LZO_LIBRARY_DEBUG NAMES lzo2d lzo2 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
find_library(Z_VCPKG_LZO_LIBRARY_RELEASE NAMES lzo2 PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
select_library_configurations(Z_VCPKG_LZO)
if(Z_VCPKG_LZO_LIBRARY)
list(APPEND z_vcpkg_libarchive_libs ${Z_VCPKG_LZO_LIBRARY})
else()
set(LibArchive_FOUND FALSE)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why Z_VCPKG ? Where is the conflict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it is a wrapper. It is run in user project scope, isn't it?. And select_library_configurations is know to set <PREFIX>_FOUND. So this just tries to go out of the way of user projects.

@NancyLi1013 NancyLi1013 added the depends:different-pr This PR or Issue depends on a PR which has been filed label Sep 18, 2021
@NancyLi1013
Copy link
Contributor

The problem caused by CI pipeline line depends on PR #20236.

@c72578
Copy link
Contributor

c72578 commented Sep 18, 2021

Remark: This is how libarchive.pc looks now (at 141ec0d4ccf3a65272c284ef49d573c8e696fc48) in case of x64-windows:

prefix=${pcfiledir}/../..

exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libarchive
Description: library that can create and read several streaming archive formats
Version: 3.5.2
Cflags: -I"${includedir}"
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L"${libdir}" -larchive
Libs.private:  -lcrypto -lssl -lssl -lssl -lssl -lssl -lssl
Requires.private:  zlib bzip2 liblzma liblz4 libzstd libxml-2.0

It contains -lssl 6 times under Libs.private

@dg0yt
Copy link
Contributor Author

dg0yt commented Sep 18, 2021

Thanks for the feedback @c72578. I assume it works now for #20062?

It contains -lssl 6 times under Libs.private

I don't think this is a problem for now. The library is added for each matching algorithm. This could be improved upstream, instead of adding complexity to the patch. Maybe when I upstream the patch...

@c72578
Copy link
Contributor

c72578 commented Sep 18, 2021

@dg0yt the situation concerning #20062 has improved, however it is still failing for x64-linux:
/usr/bin/ld: cannot find -llz4

This is how libarchive.pc looks under x64-linux now (tested at commit 74f3712):

prefix=${pcfiledir}/../..

exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libarchive
Description: library that can create and read several streaming archive formats
Version: 3.5.2
Cflags: -I"${includedir}"
Cflags.private: -DLIBARCHIVE_STATIC
Libs: -L"${libdir}" -larchive 
Requires: zlib bzip2 liblzma liblz4 libzstd libcrypto libxml-2.0 libssl libssl libssl libssl libssl libssl

See: liblz4 in Requires

@c72578
Copy link
Contributor

c72578 commented Sep 19, 2021

@dg0yt The remaining issue is related to the port lz4.
lz4_x64-linux/debug/lib/pkgconfig\liblz4.pc contains -llz4, but it should contain -llz4d

prefix=${pcfiledir}/../..
#   LZ4 - Fast LZ compression algorithm
#   Copyright (C) 2011-2014, Yann Collet.
#   BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)

libdir=${prefix}/lib
includedir=${prefix}/../include

Name: lz4
Description: extremely fast lossless compression algorithm library
URL: http://www.lz4.org/
Version: 1.9.3
Libs: -L"${prefix}/lib" -llz4
Cflags: -I"${prefix}/../include"

The issue is resulting from here:

if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/lz4.pc")

The file is called liblz4.pc

@dg0yt
Copy link
Contributor Author

dg0yt commented Sep 19, 2021

lz4_x64-linux/debug/lib/pkgconfig\liblz4.pc contains -llz4, but it should contain -llz4d

Thanks for reporting @c72578. I added a fix to this PR now.

@dg0yt dg0yt changed the title [libarchive] Fix pc file, modernize portfile [libarchive,lz4] Fix pc file, modernize portfile Sep 19, 2021
Copy link
Contributor

@c72578 c72578 left a comment

Choose a reason for hiding this comment

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

@dg0yt Thanks. I have completed the testing and the PR LGTM now.

@c72578
Copy link
Contributor

c72578 commented Sep 22, 2021

@NancyLi1013 PR #20236 has been merged in the meantime.

@NancyLi1013
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@NancyLi1013 NancyLi1013 removed the depends:different-pr This PR or Issue depends on a PR which has been filed label Sep 23, 2021
@NancyLi1013 NancyLi1013 added info:reviewed Pull Request changes follow basic guidelines and removed requires:author-response labels Sep 23, 2021
@BillyONeal
Copy link
Member

Thanks @dg0yt for the fixes, @c72578 @JonLiu1993 for testing, and @Neumann-A for the review!

@BillyONeal BillyONeal merged commit 845a5fd into microsoft:master Sep 24, 2021
@dg0yt dg0yt deleted the libarchive branch December 12, 2021 09:15
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.

[libarchive] wrapper emits warnings and uses find_dependency
6 participants