microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.13k stars 6.37k forks source link

Error: no postscript file: rerun with the vcpkg shell function rather than executable when running vcpkg activate #40609

Open Vitorbnc opened 2 months ago

Vitorbnc commented 2 months ago

Describe the bug After installing vcpkg and adding its folder to Path, I tried to run vcpkg activate inside a folder containing the vcpkg-configuraration.json shown below, but it fails to complete with the following message:

error: no postscript file: rerun with the vcpkg shell function rather than executable

Environment

To Reproduce Steps to reproduce the behavior:

  1. Install vcpkg
  2. Go to folder with vcpkg-configuraration.json
  3. Run vcpkg activate
  4. See error

Expected behavior Expected activation to succeed.

Failure logs

warning: vcpkg-artifacts is experimental and may change at any time.
Artifact                            Version Status    Dependency Summary
arm:tools/kitware/cmake 3.28.4  installed            Kitware's cmake tool
arm:tools/ninja-build/ninja 1.12.0  installed            Ninja Build
arm:compilers/arm/armclang 6.22.0  installed            Arm Compiler for Embedded
arm:compilers/arm/arm-none-eabi-gcc 13.3.1  installed            GCC compiler for ARM CPUs
arm:compilers/arm/llvm-embedded 17.0.1  installed            LLVM Embedded Toolchain for Arm CPUs

arm:compilers/arm/arm-none-eabi-gcc - EULA: https://developer.arm.com/GetEula?Id=d023c29f-8e81-49b0-979f-a5610ea2ccbb
error: no postscript file: rerun with the vcpkg shell function rather than executable

Additional context

vcpkg-configuration.json:

{
  "registries": [
    {
      "name": "arm",
      "kind": "artifact",
      "location": "https://artifacts.tools.arm.com/vcpkg-registry"
    }
  ],
  "requires": {
    "arm:tools/kitware/cmake": "^3.25.2",
    "arm:tools/ninja-build/ninja": "^1.10.2",
    "arm:compilers/arm/armclang":"^6.20.0",
    "arm:compilers/arm/arm-none-eabi-gcc": "^13.2.1",
    "arm:compilers/arm/llvm-embedded": "^17.0.1-0"
  }
}
FrankXie05 commented 2 months ago

Repo on x64-windows: image

@Vitorbnc cc @BillyONeal Could you plase help look into this issue?

moritzstoetter commented 2 months ago

I just ran into the same issue on Linux arm64.

Interestingly also while trying to fetch the artifact arm:compilers/arm/arm-none-eabi-gcc 13.3.1

BillyONeal commented 2 months ago

vcpkg.exe / vcpkg (the binary) can't touch environment variables in the enclosing console, only the shell function can do that. People got very very confused about "vcpkg the shell function" not being the same thing as vcpkg.exe or ./vcpkg, so we recently renamed it to vcpkg-shell: https://github.com/microsoft/vcpkg-tool/pull/1442

We also changed the error message to explain that better.

Vitorbnc commented 2 months ago

@BillyONeal I couldn't find any vcpkg-shell in the vcpkg install dir and calling vcpkg-shell does not seem to work. How do you use it? image

moritzstoetter commented 2 months ago

@BillyONeal Are you saying that following the official installation instructions here puts you into a position, where a subsequent call to vcpkg activate fails?

If so I am not surprised that "people got very confused".

Vitorbnc commented 2 months ago

@moritzstoetter I just double checked.

image

Vitorbnc commented 2 months ago

@FrankXie05 @BillyONeal any updates on this?

BillyONeal commented 1 month ago

@BillyONeal I couldn't find any vcpkg-shell in the vcpkg install dir and calling vcpkg-shell does not seem to work. How do you use it?

It only works using one of the 'installed' copies of vcpkg, like the one that comes with Visual Studio or the 'one liner' installer.

rebolloluis commented 1 month ago

Hello, I have the same problem. Is there a plan to fix this on the latest version of vcpkg on Github? or should we resignate to use the one-liner iex (iwr -useb https://aka.ms/vcpkg-init.ps1) still even though it's "not recommended for CI systems"? this on Windows 10 x64 host.

My use case is trying the below command so that it works on both local or CI build systems:

vcpkg activate

With this in a vcpkg-configuration.json on the same path:

{
 "registries": [
  {
   "name": "arm",
   "kind": "artifact",
   "location": "https://artifacts.tools.arm.com/vcpkg-registry"
  }
 ],
 "requires": {
  "arm:tools/open-cmsis-pack/cmsis-toolbox": "2.4.0",
  "arm:tools/kitware/cmake": "3.28.4",
  "arm:tools/ninja-build/ninja": "1.12.0",
  "arm:compilers/arm/armclang": "6.22.0",
  "arm:compilers/arm/arm-none-eabi-gcc": "^13.2.1",
  "arm:models/arm/avh-fvp": "^11.26.11",
  "arm:debuggers/arm/armdbg": "6.1.2"
 }
}

Thanks!

BillyONeal commented 1 month ago

@BillyONeal Are you saying that following the official installation instructions here puts you into a position, where a subsequent call to vcpkg activate fails?

If so I am not surprised that "people got very confused".

One of the reasons the entire artifacts feature remains experimental is that it is not practically usable from the "git clone" distribution of vcpkg. The official instructions are written for people not using artifacts because that remains 99.99% of vcpkg's user base, and the 'installed' copies don't work with classic mode.

Is there a plan to fix this on the latest version of vcpkg on Github?

I'm confirming an answer with our PM folks.