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

Modifying code procedure does not work. #40657

Closed
DougRogers opened this issue Aug 26, 2024 · 18 comments
Closed

Modifying code procedure does not work. #40657

DougRogers opened this issue Aug 26, 2024 · 18 comments
Assignees
Labels
category:question This issue is a question

Comments

@DougRogers
Copy link

DougRogers commented Aug 26, 2024

I am trying to modify an existing port (openimageio) using this procedure:

https://learn.microsoft.com/en-us/vcpkg/produce/update-package-version?pivots=shell-cmd

Windows11

To Reproduce
Step1
xcopy C:\vcpkg\ports\openimageio C:\vcpkg\myports\openimageio /E

Step 2
I then modifed the ports version (in myports\openimageio).

Step 3
vcpkg install --overlay-ports=C:\vcpkg\myports\openimageio openimageio

According to the docs, I should get info about sha

Run vcpkg install --overlay-ports=$OVERLAY_LOCATION vcpkg-sample-library, you will get an error about the SHA512 of the package. Copy the value of the actual hash in your portfile.

This is what is printed.

C:\vcpkg>vcpkg install --overlay-ports=C:\vcpkg\myports\openimageio openimageio
Computing installation plan...
The following packages will be built and installed:
    openimageio:x64-windows@2.5.14.1 -- C:\vcpkg\myports\openimageio
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from C:\Users\Roger\AppData\Local\vcpkg\archives in 109 us. Use --debug to see more details.
Installing 1/1 openimageio:x64-windows@2.5.14.1...
Building openimageio:x64-windows@2.5.14.1...
C:\vcpkg\myports\openimageio: info: installing overlay port from here
-- Downloading https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/v2.5.14.1.tar.gz -> AcademySoftwareFoundation-OpenImageIO-v2.5.14.1.tar.gz...
[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from C:\vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: C:\vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
error: Missing AcademySoftwareFoundation-OpenImageIO-v2.5.14.1.tar.gz and downloads are blocked by x-block-origin.
error: https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/v2.5.14.1.tar.gz: failed: status code 404
[DEBUG] D:\a\_work\1\s\src\vcpkg\base\downloads.cpp(1030):
[DEBUG] Time in subprocesses: 0us
[DEBUG] Time in parsing JSON: 3us
[DEBUG] Time in JSON reader: 0us
[DEBUG] Time in filesystem: 583us
[DEBUG] Time in loading ports: 0us
[DEBUG] Exiting after 460 ms (448914us)

CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:32 (message):

      Failed to download file with error: 1
      If you are using a proxy, please check your proxy setting. Possible causes are:

      1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable
         to `https://address:port`. This is not correct, because `https://` prefix
         claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr
         , etc..) is an HTTP proxy. Try setting `http://address:port` to both
         HTTP_PROXY and HTTPS_PROXY instead.

      2. If you are using Windows, vcpkg will automatically use your Windows IE Proxy Settings
         set by your proxy software. See https://github.com/microsoft/vcpkg-tool/pull/77
         The value set by your proxy might be wrong, or have same `https://` prefix issue.

      3. Your proxy's remote server is out of service.

      If you've tried directly download the link, and believe this is not a temporary
      download server failure, please submit an issue at https://github.com/Microsoft/vcpkg/issues
      to report this upstream download server failure.


Call Stack (most recent call first):
  scripts/cmake/vcpkg_download_distfile.cmake:270 (z_vcpkg_download_distfile_show_proxy_and_fail)
  scripts/cmake/vcpkg_from_github.cmake:106 (vcpkg_download_distfile)
  myports/openimageio/portfile.cmake:1 (vcpkg_from_github)
  scripts/ports.cmake:192 (include)


error: building openimageio:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle openimageio:x64-windows: 518 ms
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+openimageio
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[openimageio]+Build+error+on+x64-windows&body=Copy+issue+body+from+C%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

I do not see any sha data. How to I obtain it?

@StarGate-One
Copy link
Contributor

StarGate-One commented Aug 27, 2024

Version 2.5.14.1 does not exist on the repo AcademySoftwareFoundation-OpenImageIO?
Note: The SHA is in the portfile.cmake file with the keyword SHA512 followed by the hash.

image

@DougRogers
Copy link
Author

DougRogers commented Aug 27, 2024

@StarGate-One Correct as per the procedure. You are supported to force a failure to get a sha conflict, is what I thought. Otherwise it would just pull the version it finds, correct? I don't want that. I want to modify an existing version (2.5.14.0)

@StarGate-One
Copy link
Contributor

StarGate-One commented Aug 27, 2024

Need to modify the existing version and repackage it to the correct gz compressed file name and put a copy in the vcpkg downloads directory/folder.

You can use this tool to get hash values https://www.binaryfortress.com/HashTools/Download/ -or-
You can set the hash to zero in your overlay port and run your step 3 again and it will tell you that a hash mismatch exists and just copy the SHA512 it creates and change the 0 in your overlay port to the new SHA512.

@StarGate-One
Copy link
Contributor

That would be correct filename except you want to change the 0 to 1 and do the same in your overlay port vcpkg.json file.

@DougRogers
Copy link
Author

I set the version as 2.5.14.1 in the file name and the vcpkg.json file.
Getting this error.


C:\vcpkg>vcpkg install --overlay-ports=C:\vcpkg\myports\openimageio openimageio
Computing installation plan...
The following packages will be built and installed:
    openimageio:x64-windows@2.5.14.1 -- C:\vcpkg\myports\openimageio
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from C:\Users\Roger\AppData\Local\vcpkg\archives in 86.2 us. Use --debug to see more details.
Installing 1/1 openimageio:x64-windows@2.5.14.1...
Building openimageio:x64-windows@2.5.14.1...
C:\vcpkg\myports\openimageio: info: installing overlay port from here
-- Downloading https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/v2.5.14.1.tar.gz -> AcademySoftwareFoundation-OpenImageIO-v2-2d9423e1.5.14.1.tar.gz...
[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from C:\vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: C:\vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
error: Missing AcademySoftwareFoundation-OpenImageIO-v2-2d9423e1.5.14.1.tar.gz and downloads are blocked by x-block-origin.
error: https://github.com/AcademySoftwareFoundation/OpenImageIO/archive/v2.5.14.1.tar.gz: failed: status code 404
[DEBUG] D:\a\_work\1\s\src\vcpkg\base\downloads.cpp(1030):
[DEBUG] Time in subprocesses: 0us
[DEBUG] Time in parsing JSON: 3us
[DEBUG] Time in JSON reader: 0us
[DEBUG] Time in filesystem: 558us
[DEBUG] Time in loading ports: 0us
[DEBUG] Exiting after 503 ms (491520us)

CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:32 (message):

      Failed to download file with error: 1
      If you are using a proxy, please check your proxy setting. Possible causes are:

      1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable
         to `https://address:port`. This is not correct, because `https://` prefix
         claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr
         , etc..) is an HTTP proxy. Try setting `http://address:port` to both
         HTTP_PROXY and HTTPS_PROXY instead.

      2. If you are using Windows, vcpkg will automatically use your Windows IE Proxy Settings
         set by your proxy software. See https://github.com/microsoft/vcpkg-tool/pull/77
         The value set by your proxy might be wrong, or have same `https://` prefix issue.

      3. Your proxy's remote server is out of service.

      If you've tried directly download the link, and believe this is not a temporary
      download server failure, please submit an issue at https://github.com/Microsoft/vcpkg/issues
      to report this upstream download server failure.


Call Stack (most recent call first):
  scripts/cmake/vcpkg_download_distfile.cmake:270 (z_vcpkg_download_distfile_show_proxy_and_fail)
  scripts/cmake/vcpkg_from_github.cmake:106 (vcpkg_download_distfile)
  myports/openimageio/portfile.cmake:1 (vcpkg_from_github)
  scripts/ports.cmake:192 (include)


error: building openimageio:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle openimageio:x64-windows: 928 ms
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+openimageio
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[openimageio]+Build+error+on+x64-windows&body=Copy+issue+body+from+C%3A%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md


C:\vcpkg>

@DougRogers
Copy link
Author

Looks like I need to set the sha in the portfile to get it to work. It seemed to install after I got the sha for the .gz file and put in there.

@DougRogers
Copy link
Author

@StarGate-One Thank you. I was to get it working, thanks to your help.

@jimwang118 jimwang118 added the category:question This issue is a question label Aug 27, 2024
@jimwang118
Copy link
Contributor

If your issue has been resolved, please close this issue.

@DougRogers
Copy link
Author

I was able to get the modified version to work. Instructions in link should be updated to reflect this method.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 27, 2024

Instructions in link should be updated to reflect this method.

Where is the actual problem with the instructions?
AFAIU an attempt was made to reference a non-existing version (or git tag). This can't work.

What can be improved in the docs is mentioning cases where you must modify the source reference before determining the SHA512:
microsoft/vcpkg-docs#392

Need to ... repackage it to the correct gz compressed file name and put a copy in the vcpkg downloads directory/folder.

Repackaging on the user's side is unlikely to give the same SHA512 as produced by Github or other on-the-fly services.

@DougRogers
Copy link
Author

AFAIU an attempt was made to reference a non-existing version (or git tag). This can't work.

That is what is called for in the instructions and what I needed to do to get it to work.
Change the version in vcpkg.json to 1.0.1.

For my case, I wanted to modify code in openimageio 2.5.14.0 and use the modified version. How would I do that? Step #2 says : Change the version in vcpkg.json to 1.0.1. If I set it to a known version, vcpkg would have just downloaded that, correct? What version should I have used in step 2?

When I changed the version to a non-existing version and tried step 3: I did not get the hash info as indicated.

Run vcpkg install --overlay-ports=$OVERLAY_LOCATION vcpkg-sample-library, you will get an error about the SHA512 of the package. Copy the value of the actual hash in your portfile.

They way I got it working was to extract the .gz file, change the code and compress it to a new, non-existing version 2.5.14.1

I extracted the hash from that and put that in the portfile.cmake along with 2.5.14.1.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 27, 2024

AFAIU an attempt was made to reference a non-existing version (or git tag). This can't work.

That is what is called for in the instructions and what I needed to do to get it to work. Change the version in vcpkg.json to 1.0.1.

That's an example. It shows the template.

What version should I have used in step 2?

Any existing version that you want to use. (YMMV.)

They way I got it working was to extract the .gz file, change the code and compress it to a new, non-existing version 2.5.14.1. I extracted the hash from that and put that in the portfile.cmake along with 2.5.14.1.

But which gz file? There is no 2.5.14.1 release (upstream), and no tutorial in vpckg will be able to explain how to download releases from the future...

@DougRogers
Copy link
Author

I took the 2.5.14.0 build in downloads, extracted its contents, modified it, then saved it to 2.5.14.1.gz, then got its sha value. I then put that in downloads area.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 28, 2024

So the sources are still 2.5.14.0, but labeled 2.5.14.1, locally. Well, really not an issue with the tutorial. Maybe you have a different goal in the end, but it is not clear.

@DougRogers
Copy link
Author

I wanted the simplest way to modify openimageio and use the modified version. The procedure in the tutorial did not work for me.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 30, 2024

The given tutorial is for updating a port for a new upstream version, not for injecting own modifications. Maybe you need this tutorial:
https://learn.microsoft.com/vcpkg/consume/install-locally-modified-package

@DougRogers
Copy link
Author

I tried that one first, but it was way to complicated for a simple, one line fix.

@DougRogers
Copy link
Author

Changing version and making modifications to a library should be trivial and not require a procedure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

16 participants
@DougRogers @dg0yt @StarGate-One @jimwang118 and others