ITADN

Timestamps are preserved when installing packages, making build system unaware that files were modified

#1899Opentouraill-adobe 创建于 2026-01-15
T
touraill-adobecommented
The install behavior of `vcpkg-tool` seems to not interact nicely with timestamp-based build systems, at least on filesystems that support hard links. Most `vcpkg` ports download sources in a way that preserve timestamps (by downloading an archive, or creating an archive with `git archive <commit>`). Those files are then installed in `$VCPKG_ROOT/packages` during build, usually preserving timestamps (e.g. with cmake install commands). Finally they are installed in `<binary_dir>/vcpkg_installed`, using hard links when possible, thereby preserving timestamps again. What this means is that headers are installed with old timestamps, making the build system unaware that they were modified. As a consequence, when building the consuming project, files are not recompiled as they should. The problem does not occur when restoring files from the binary cache, in this case Here is a simple repro case with an executable that prints the version of `xxHash`: [CMakeLists.txt](https://github.com/user-attachments/files/24637502/CMakeLists.txt) [print_version.cpp](https://github.com/user-attachments/files/24637505/print_version.cpp) [vcpkg.json](https://github.com/user-attachments/files/24637503/vcpkg.json) Repro steps: - `VCPKG_BINARY_SOURCES="clear" cmake -GNinja -B build && cmake --build build && ./build/print_version` => prints `801` - update `vcpkg.json` to pull `0.8.2` - `VCPKG_BINARY_SOURCES="clear" cmake -GNinja -B build && cmake --build build && ./build/print_version` => version `0.8.2` is installed but `print_version.cpp` is not recompiled and still prints `802`
0 条评论