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

How do I modify sources of ports before installing? #26132

Closed
BullyWiiPlaza opened this issue Aug 2, 2022 · 4 comments
Closed

How do I modify sources of ports before installing? #26132

BullyWiiPlaza opened this issue Aug 2, 2022 · 4 comments
Assignees
Labels
category:question This issue is a question

Comments

@BullyWiiPlaza
Copy link
Contributor

BullyWiiPlaza commented Aug 2, 2022

I'm trying to track down a Dear ImGui bug, my operating system is Windows 11 Pro. For the bug research I need to install imgui v1.88 (the latest) and comment out 1 - 2 lines of code. When installing the imgui package, I see output as follows:

C:\vcpkg>vcpkg install imgui:x64-windows-static --no-binarycaching
Computing installation plan...
The following packages will be built and installed:
    imgui[core]:x64-windows-static -> 1.88#1
Detecting compiler hash for triplet x64-windows-static...
Installing 1/1 imgui:x64-windows-static...
Building imgui[core]:x64-windows-static...
-- Using cached ocornut-imgui-v1.88.tar.gz.
-- Cleaning sources at C:/vcpkg/buildtrees/imgui/src/v1.88-34c93572a3.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/vcpkg/downloads/ocornut-imgui-v1.88.tar.gz
-- Using source at C:/vcpkg/buildtrees/imgui/src/v1.88-34c93572a3.clean
-- Found external ninja('1.10.2').
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Installing: C:/vcpkg/packages/imgui_x64-windows-static/share/imgui/copyright
-- Performing post-build validation
-- Performing post-build validation done
Elapsed time to handle imgui:x64-windows-static: 13.11 s

Total elapsed time: 16.09 s

imgui provides CMake targets:
    # this is heuristically generated, and may not be correct
    find_package(imgui CONFIG REQUIRED)
    target_link_libraries(main PRIVATE imgui::imgui)

I already found the --no-binarycaching which helps me avoid using cached binaries instead of rebuilding. I tried modifying the archive under C:/vcpkg/downloads/ocornut-imgui-v1.88.tar.gz but it seems to cause vcpkg to fail afterwards:

-- Extracting source C:/vcpkg/downloads/ocornut-imgui-v1-bfb73813.88.tar.gz
CMake Error at scripts/cmake/vcpkg_extract_source_archive.cmake:159 (file):
  file RENAME failed to rename

    C:/vcpkg/buildtrees/imgui/src/v1.88-34c93572a3.clean.tmp/imgui-1.88

  to

    C:/vcpkg/buildtrees/imgui/src/v1.88-34c93572a3.clean

  because: Access is denied.



Call Stack (most recent call first):
  scripts/cmake/vcpkg_extract_source_archive_ex.cmake:8 (vcpkg_extract_source_archive)
  scripts/cmake/vcpkg_from_github.cmake:113 (vcpkg_extract_source_archive_ex)
  ports/imgui/portfile.cmake:12 (vcpkg_from_github)
  scripts/ports.cmake:147 (include)


error: building imgui:x64-windows-static failed with: BUILD_FAILED
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+imgui
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[imgui]+Build+error
Include '[imgui] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
    vcpkg-tool version: 2022-07-21-a0e87e227afb536c62188c11ad029954f28fdb22
    vcpkg-scripts version: 48369f2a2 2022-08-01 (18 hours ago)

You can also use the prefilled template from C:\vcpkg\installed\vcpkg\issue_body.md.

I used 7-zip for modifying the ocornut-imgui-v1.88.tar.gz file. I'm not sure if that's a viable way to do it. If I delete the ocornut-imgui-v1-bfb73813.88.tar.gz it will redownload from GitHub: -- Downloading https://github.com/ocornut/imgui/archive/v1.88.tar.gz -> ocornut-imgui-v1-bfb73813.88.tar.gz.... This wipes out my edit.

Or if I modify the ocornut-imgui-v1-bfb73813.88.tar.gz I get:

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


  File does not have expected hash:

          File path: [ C:/vcpkg/downloads/ocornut-imgui-v1-bfb73813.88.tar.gz ]
      Expected hash: [ bfb7381334f1493d64386321401086e4136129b3cc57bf57505ec6183008dddab1a2056b0af2610bc3286c606bafdf9b6e3ebc103131e0504bab2336662bc2c1 ]
        Actual hash: [  ]

  The cached file SHA512 doesn't match.  The file may have been corrupted.
  To re-download this file please delete cached file at path
  C:/vcpkg/downloads/ocornut-imgui-v1-bfb73813.88.tar.gz and retry.

Is there another straightforward way of modifying a *.cpp of a port and recompiling with it?

@Osyotr
Copy link
Contributor

Osyotr commented Aug 2, 2022

vcpkg install imgui:x64-windows-static --editable
This will prevent vcpkg from clearing extracted source files directory.

@JackBoosY JackBoosY added the category:question This issue is a question label Aug 3, 2022
@JackBoosY
Copy link
Contributor

The another way is make a patch and apply it in ports/PORT_NAME/portfile.cmake.

@Osyotr
Copy link
Contributor

Osyotr commented Aug 3, 2022

Yes, this is usually done in combination. See https://stackoverflow.com/a/72778459/5802715

@BullyWiiPlaza
Copy link
Contributor Author

Yes, this is usually done in combination. See https://stackoverflow.com/a/72778459/5802715

Thanks, this was very helpful. That's all I needed.

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

3 participants