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

vcpkg export with feature does not work anymore #22913

Closed
gix opened this issue Feb 3, 2022 · 10 comments
Closed

vcpkg export with feature does not work anymore #22913

gix opened this issue Feb 3, 2022 · 10 comments
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) Stale

Comments

@gix
Copy link
Contributor

gix commented Feb 3, 2022

Describe the bug

vcpkg export fails when using features. This recently broke (probably microsoft/vcpkg-tool#298?).

Environment

  • OS: Windows
  • Compiler: N/A

To Reproduce
Steps to reproduce the behavior:

  1. .\vcpkg.exe install 'abseil[cxx17]'

  2. .\vcpkg export abseil[cxx17] --nuget

    Error: List of features is not allowed in this contectExample:
      vcpkg export zlib zlib:x64-windows boost --nuget
    
  3. .\vcpkg export abseil --nuget

    The following packages need to be built:
        abseil:x86-windows
    There are packages that have not been built.
    To build them, run:
        vcpkg install abseil:x86-windows
    

Expected behavior
Exporting a port with feature works as before.

@JackBoosY JackBoosY self-assigned this Feb 6, 2022
@JackBoosY
Copy link
Contributor

Yeah, but we may end up deprecating including features because the body of the export is a port instead of a feature.

@JackBoosY
Copy link
Contributor

@ras0219-msft Is this changes by design?

@ras0219-msft
Copy link
Contributor

ras0219-msft commented Feb 7, 2022

Because export does not install or remove packages, the set of features has always had no substantial effect except perhaps failing if the features were not currently installed. Therefore, if you had a configuration before that worked, the workaround is simply to remove the feature list from the packages list. All currently installed features of the selected packages will be exported.

However, we'll still need to look into this as a scripting regression and perhaps issue a warning instead that features on the cli have no effect for the export command.

Thanks for posting this issue!

@JackBoosY JackBoosY added the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Feb 8, 2022
@daschuer
Copy link
Contributor

If you consider a scripting environment where the same string is used to install and export the ports, it makes perfectly sens to have the list of features also during export. The alternative would be some magic string handling to remove the features, or using --x-all-installed. The later might be export deprecated packages that have been installed earlier.

@FrankHeimes
Copy link
Contributor

This situation is unsatisfying. The latest version of vcpkg can not do what previous calls .\vcpkg.exe install 'opencv4[contrib]' did for me, i. e. downloading and installing a few header files for the Aruco extension of OpenCV

For OpenCV, a workaround is to patch vcproj.json to include "contrib" into the list of "default-features".

But that defies the whole point of vcpkg to automagically install all required packages.

daschuer added a commit to daschuer/vcpkg that referenced this issue Mar 19, 2022
This is a workaround for a upstream regression tracked in microsoft#22913
fwcd added a commit to fwcd/m1xxx that referenced this issue May 31, 2022
@invy
Copy link

invy commented Aug 27, 2022

Therefore, if you had a configuration before that worked, the workaround is simply to remove the feature list from the packages list. All currently installed features of the selected packages will be exported.

Not very nice workaround, it either requires editing a bunch of build configuration, or doing some not really needed scripting.

However, we'll still need to look into this as a scripting regression and perhaps issue a warning instead that features on the cli have no effect for the export command.

The problem appears in scripting environment. It is also related to the package dependencies. So I think the logic here could look like:

  1. Export accepts packages with features.
  2. Export verifies whether packages with corresponding features are installed, if no, there should be either warning or error. I.e. User has installed curl, but wants to export curl[ssh] which requires also libssh to be present, so it's a nice check.
  3. Existing scripting environments should not break.

@LilyWangLL LilyWangLL assigned Adela0814 and unassigned JackBoosY Dec 6, 2022
@pkeir
Copy link

pkeir commented Jan 9, 2024

Any update on this? I rely on vcpkg export opencv[contrib], but now I get the message "error: list of features is not allowed in this context". Is there a workaround?

@dg0yt
Copy link
Contributor

dg0yt commented Jan 9, 2024

AFAIU the answer was that features don't make sense for the export command: #22913 (comment)

There was the idea of adding a more tolerant behaviour, but maybe this tolerance is no longer relevant after almost two years.

@pkeir
Copy link

pkeir commented Jan 9, 2024

Thanks. I had misread that comment. The advice in my case would be to use vcpkg export opencv. I'll give that a try.

(I had been thinking of opencv[contrib] as adding a component (contrib) rather than specifying a feature.)

Copy link

github-actions bot commented Jul 8, 2024

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

@github-actions github-actions bot added the Stale label Jul 8, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) Stale
Projects
None yet
Development

No branches or pull requests

10 participants