-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Struggling with differences in abi_info and build failures with binarycaching #16615
Comments
btw, this is the message i get for building libpq (both v141 and v142):
the message for ocilib is more or less equal. I can't see how the patch is corrupt. (And, as I mentioned, this only happens in the microsoft hosted azure pipeline) |
@meastp, do you install git locally, if so, what's revision do you use? It may be relate to the EOL, I noticed that EOL of the failed patch is CRLF, and the previous passed patch are LF. |
locally: 99dc49d In Azure I have both tried using the provided revision, and Yes, it did look like it might be EOL related when I looked closely at the patches. How to resolve this? |
@meastp, could you manually update the EOL of 'ports/libpq/patches/windows/openssl_exe_path.patch' file to LF, and see if the patch could apply successfully? |
@PhoebeHui I opened all windows patch files in notepad++ (which shows line endings), and when comparing the patches with the source files they apply to, I see differences in line endings in multiple patch files. Not sure if this is a problem for all the files:
|
@meastp, I can't repro this issue locally, so could you help confirm if these patches could apply successfully when update all EOL from CRLF to LF in your machine? |
@PhoebeHui I could never reproduce this locally - it only happens on the Microsoft hosted azure pipeline agent. I'm not sure why... |
@PhoebeHui could this be a git (global) setting on the agent that handles crlf/lf differently than on our local machines? |
It may be relate to the git gloable setting, @strega-nil, do you know more about this? |
I have added the following git config to my pipeline yaml script: - powershell: |
git clone https://github.com/microsoft/vcpkg.git vcpkg-latest
workingDirectory: 'C:\'
after: - powershell: |
git config --global core.autocrlf false
git clone https://github.com/microsoft/vcpkg.git vcpkg-latest
workingDirectory: 'C:\' We will se if this makes a difference |
@PhoebeHui The Could you please explain the differences in the first part of triplet_abi so I can perhaps fix it/consolidate and reuse the binary packages between CI and my dev machine? :) |
From https://github.com/microsoft/vcpkg-tool/blob/main/src/vcpkg/build.cpp#L444, the differences in the first part of triplet_abi seems due to the triplet_entry.hash is different. @ras0219-msft, could you please take a look at the abi info? |
@ras0219-msft perhaps the parts making up (at least the first part of) |
We do have a I also agree it'd be good to improve visibility of the precise factors; maybe improving https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md#implementation-notes-internal-details-subject-to-change-without-notice is the right first step. |
@ras0219-msft Thank you for the explanation. So, you're saying that the first hash of the triplet_abi is computed from only the triplet file? Or could this be caused by multiple reasons? Would the difference in CMake versions 3.19.5 vs 3.19.2 contribute at all? I would think being able to reuse the binary packages across machines is pretty important, so more documentation would help troubleshooting/pinpoint the issue. |
I also encountered the
and it was successfully applied. So is there some way to preserve the line endings when the patches are replicated to the |
Ensures that file endings are consistent between the ports and the versioned port under `versioning`. Fixes microsoft/vcpkg#16615 (comment). Before this fix, a patch with LF endings could end up with CRLF endings on Windows causing corrupt patch issues.
Ensures that file endings are consistent between the ports and the versioned port under `versioning`. Fixes microsoft/vcpkg#16615 (comment). Before this fix, a patch with LF endings could end up with CRLF endings on Windows causing corrupt patch issues.
@ras0219-msft This solved neither my build issue with libpq (when I tried to remove autocrlf false) nor the first part of abi_info. Could you please point to where this hash is computed? I'd like to have debug output for a single package to try to pinpoint the difference... Should I open a new issue? |
@meastp, I reopen this issue, so you don't need to open a new issue. |
@JackBoosY Not really - see this comment for what's missing: #16615 (comment) |
The new triplet option VCPKG_DISABLE_COMPILER_TRACKING would be used to disable compiler tracking, and it should be included in next release. Related microsoft/vcpkg-tool@5e55749 |
@PhoebeHui Isn't that for the compiler? Does it turn the entire abi_tracking off? What I need is the tools version to either be ignored or (ideally) forced to always downloaded through vcpkg - I still want the compiler version to be tracked. |
I am also stumbling over this issue. vcpkg is using the version of cmake from the outside environment in the ABI info rather than the cmake version downloaded to vcpkg/downloads/tools. |
I found the problem. vcpkg searches for tools from the system before downloading them. If the system tool version >= the minimum required version, vcpkg does not use the cmake version it downloads: There is the VCPKG_FORCE_SYSTEM_BINARIES environment variable, but that does the opposite of what I want. I want vcpkg to only use the fetched version of cmake. |
Wait... debug output does show that vcpkg uses the version of cmake it downloads?? Then why is that not used in the ABI info?
|
Oh, nevermind, I got myself into a weird state by deleting vcpkg/downloads... 🙃 Not sure why I did that. vcpkg does use the version of cmake it downloads if I don't interfere with it 😆
Now it works. |
@BillyONeal Was this issue fixed in the latest master? |
I don't believe anything has changed here. I know microsoft/vcpkg-tool#181 touches a similar area. |
@JoergAtGithub seems to be dealing with the same or similar issue on Windows with vcpkg on GitHub Actions using CMake 3.21.3 but locally vcpkg uses the copy of CMake 3.21.1 that it downloads. |
Because the CMake version is included in the cache key, I think vcpkg should unconditionally use the version of CMake it downloads and error if this is not found. I do not think it should fall back to the system CMake. |
I still believe that always using a downloaded copy is incorrect; large initial downloads like that to use anything have been a consistent end user complaint which is why we try to use the system copy if it is new enough. However, we should be using the same version number we use from the system in the cache key, not whatever version we were looking for. If we aren't doing that it is indeed a bug. |
I understand why users would be annoyed with that... OTOH, for my uses the tools vcpkg downloads have a trivial size compared to the source code of the packages and the build artifacts. By contrast the cost of cache misses is waiting over 4 hours for a local build (for context, here is the vcpkg.json file).
But this is the cause of cache misses. So what should users do to make use of a binary cache from a server for local development, manually install the exact same CMake version that the server uses and repeat that whenever the server gets updated? This is quite cumbersome and I don't want to ask contributors to go through that trouble. I am unclear why the CMake version is included in the cache key in the first place. Do different versions of CMake really produce ABI incompatible libraries? The binary caching feature of vcpkg is currently quite frustrating to use. First a user has to find out that a hash of the compiler executable is included in the cache key and find the documentation to disable that. Now there is this issue with mismatched CMake versions. It's a lot of trouble, and a lot time, to figure out how to get vcpkg's binary caching to work consistently. I understand vcpkg aims for reproducible builds as much as it can, but I am in doubt this should come at the cost of usability. |
In general, this is good. Checking for a minimum required version of a tool and using the system's copy of the tool is appropriate in most cases. But it is not appropriate when the version of the tool is included in the cache key. IMO either vcpkg should unconditionally download its own copy of CMake or the CMake version should not be used in the cache key. |
I am willing to fix this myself, but I would need to know how it should be fixed. Either the CMake version could be removed from the cache key or vcpkg could always download & use its own copy of CMake with a specific version. If you are certain that the default behavior should remain as it is, this fix could be optional, but I think it should be the default. |
@Be-ing Your proposed fix (either og them) would save us a lot of unnecessary hassle and build time. Thank you for this :) |
I made a PR for vcpkg-tool to require an exact version match for CMake so vcpkg will always download its own copy of CMake if the system version is not an exact match. That was surprisingly easy to implement. The vcpkg-tool C++ code was easy to understand (apart from the wide usage of "maybe"). :) |
An alternative solution could be treating the CMake version in the binary cache key as only the minimum required version but not putting the actual version of CMake used in the cache key. That would allow using newer system versions of CMake without needing to download an exact version of CMake. That feels hacky and fragile though; allowing a range of versions to be compatible with the ABI info seems to kinda work against the purpose of tracking the ABI info. If it is permissible to not have an exact match of the CMake version to have a cache hit, then I think it would make more sense to not track the CMake version in the ABI info. |
Apparently GitHub Actions updated its version of PowerShell from version 7.1.4 to 7.1.5 and the PowerShell version is included in the ABI info so that triggered a full rebuild of Windows libraries. So I made vcpkg require an exact version of PowerShell as well as CMake in microsoft/vcpkg-tool#223 |
This is finally fixed with microsoft/vcpkg-tool#234 and #21471. You need to use the new
|
@Be-ing Great, thanks! I didn't find documentation for the two features. Do I need to use the two in combination, or can I keep compiler tracking (I'm assuming this means the exact compiler version/update is ignored?) while using consistent versions of tools? |
Yes, they should function independently so you can use one or the other (or both or neither). For changing compiler tracking, I recommend using the documented triplet variable |
I was thinking these options should be combined into one, so I'm curious what kind of setup you have where including the compiler in the abi_info is desired but you need vcpkg to use exact tool versions? |
Thanks,both :) @Be-ing Well, the primary motivation for the tools feature is to be able to share binary caching between the Azure build agent and local developer machines. I still would like to trigger a rebuild when the compiler revision is changed. Since the build agent is the one that gets new compiler versions first (it's a Microsoft-Hosted Agent, so it is usually updated switfly), rebuilding do not affect us too much, and the binarycache is ready when devs upgrade their local compiler version. How do you trigger a rebuild of the packages in case of a compiler bug? Perhaps VCPKG_DISABLE_COMPILER_TRACKING instead should be a version number that can be increased from 1 in case of this happening? Or have you solved this some other way? |
We do hash the triplet file itself, so you can manually force a rebuild by changing a comment in the file. However, I generally would recommend against |
I am trying to use vcpkg for building in Azure Pipelines (CI, Microsoft Hosted Agent windows-2019 and vs2017-win2016) and to be able to reuse the binary packages produced on my dev machine.
Everything except two packages compile successfully in Azure, but the binary package hashes are different. The two packages that fail (libpq and ocilib, with an error about corrupt patch) does compile successfully on my dev machine.
Here is an example from the abi_info on ocilib:
Dev machine (builds ok):
CI (build fails):
I see that these are different:
I'm hoping that patch versions don't affect the binary hash version of the binary packages?
Could you explain the last difference (triplet_abi)? I would like to produce binary packages that I can reuse between machines, and (obviously) successfully build libpq and ocilib in Azure.
The text was updated successfully, but these errors were encountered: