[
https://issues.apache.org/jira/browse/THRIFT-6320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6320.
--------------------------------
Assignee: Jens Geyer
Resolution: Fixed
> Stop asking for a static runtime when building the release compiler
> -------------------------------------------------------------------
>
> Key: THRIFT-6320
> URL: https://issues.apache.org/jira/browse/THRIFT-6320
> Project: Thrift
> Issue Type: Bug
> Components: Build Process
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Major
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> h2. Situation
> Commit {{dd8ecde06}} moved the project away from a statically linked Windows
> compiler. {{doc/ReleaseManagement.md}} now reads:
> bq. The compiler is portable and folks find it useful to be able to download
> one, especially if they are using third-party distributed runtime libraries
> for interpreted languages on Windows. It requires Visual C++ Runtime due to
> ASF regulations.
> Two things were left behind by that change.
> h3. The document still asks for the old property
> A few lines further down it still says:
> bq. Verify the executable only depends on kernel32.dll using depends.exe.
> A compiler that links the shared runtime cannot satisfy that, so the
> instruction contradicts the paragraph above it and cannot be followed.
> h3. The build still asks for the static runtime
> {{-DWITH_MT=ON}} is still passed by {{build/docker/msvc/build-compiler.bat}}
> and by the manual recipe in the same document. {{WITH_MT}} is the option
> whose whole purpose is to select the static runtime.
> It happens to do nothing. It is implemented by rewriting {{/MD}} to {{/MT}}
> in the per configuration compiler flag variables, and policy
> [CMP0091|https://cmake.org/cmake/help/latest/policy/CMP0091.html] took the
> runtime library out of those variables and moved it to the
> {{MSVC_RUNTIME_LIBRARY}} target property. That policy is NEW whenever a
> project requires CMake 3.15 or newer, and the top level {{CMakeLists.txt}}
> requires 3.16, so there is no {{/MD}} left to replace.
> The released compiler therefore links the shared runtime, which is what is
> wanted - but it is reached by accident. {{WITH_MT}} looks like a plain bug,
> and anyone repairing it would silently turn the release build back into the
> statically linked one the project deliberately moved away from.
> h2. Change
> * Drop {{-DWITH_MT=ON}} from {{build/docker/msvc/build-compiler.bat}} and
> from the manual recipe in {{doc/ReleaseManagement.md}}, with a note saying
> why it is not wanted.
> * Replace the "only depends on kernel32.dll" step with what is actually
> expected of the executable.
> Neither recipe builds any library ({{BUILD_LIBRARIES=OFF}} and
> {{WITH_CPP=OFF}} respectively), so the {{THRIFT_RUNTIME_POSTFIX}} that
> {{WITH_MT}} also sets renames nothing.
> _Drafted with AI assistance (Claude Opus 5); reviewed and posted by Jens
> Geyer._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)