Skip to content

Windows: RSTUDIO_USE_SYSTEM_DEPENDENCIES / RSTUDIO_USE_SYSTEM_ZLIB still builds vendored rstudio-zlib #19245

Closed

Description

@gtritchie

On Windows, configuring with RSTUDIO_USE_SYSTEM_DEPENDENCIES=ON (or RSTUDIO_USE_SYSTEM_ZLIB=ON) can't succeed. zlib is taken from find_package, but the build still creates the vendored rstudio-zlib target from the fetched sources, which don't exist on that path.

In src/cpp/ext/CMakeLists.txt:

  • On the system path, fetch() calls find_package and never sets ZLIB_SOURCE_DIR/ZLIB_BINARY_DIR (L190).
  • The if(WIN32 AND ZLIB_ENABLED) block (L560-L571) runs regardless of where zlib came from. It calls configure_file("${ZLIB_SOURCE_DIR}/zconf.h.cmakein" ...), which becomes /zconf.h.cmakein, so configure fails there.

The vendored target is also linked unconditionally on WIN32:

A fix would skip the rstudio-zlib block when zlib comes from the system, and link ZLIB::ZLIB in those three places instead. The block that forces libgit2's ZLIB_* cache variables (L444) is already skipped on the system path, so libgit2 would pick up the same system zlib.

Found by reading the code while reviewing #19239, which fixes RSTUDIO_USE_SYSTEM_DEPENDENCIES for the other dependencies; not yet reproduced on a Windows machine. Default Windows builds (no system dependencies) are not affected.

Activity

  1. added theissue type on Oct 23, 2026
  2. added
    tech debt
    on Oct 23, 2026
  3. kevinushey commented on Nov 5, 2026

    @kevinushey
    Collaborator

    Fixed by #19239, merged on November 2, 2026. The system-zlib path now aliases rstudio-zlib to ZLIB::ZLIB and skips creation of the vendored library.

    Verified against main at 11a39a3 using a focused harness that extracts the dependency helpers and zlib setup from the production CMake code and exercises the Windows CMake branches on macOS:

    • RSTUDIO_USE_SYSTEM_ZLIB=ON: configuration, compilation, and compression/decompression round trips passed using each of the three consumer link statements (rstudio-core, rstudio-core-tests, and rstudio-core-synctex).
    • RSTUDIO_USE_SYSTEM_DEPENDENCIES=ON: the same checks passed.
    • Default vendored selection and RSTUDIO_USE_SYSTEM_DEPENDENCIES=ON with RSTUDIO_USE_SYSTEM_ZLIB=OFF: configuration passed, with the vendored static target and generated zconf.h present.

    This was a focused CMake smoke check, not a full RStudio build or native Windows validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugtech debt

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions