Link MSVC runtime library statically#276
Conversation
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Testing: checked locally that `duckdb-httpfs` can successfully fetch HTTP(S) resources with this and `extension-ci-tools` changes applied. Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb/duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 described in duckdb/duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb/duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change replaces the use of `x64-windows-static-md-release-vs2019comp` vcpkg toolchain to `x64-windows-static-release` for Windows MSVC builds. With this change the MSVC runtime library (both C and C++ stdlibs) is linked statically to every extension. Thus extensions no longer rely on the MSVC runtime shared libs used by the host process and the VS2019-specific changes added in duckdb#229 are no longer necessary. To make the build working a change is also required to the `duckdb/duckdb` repo - will file a PR there shortly. Testing: checked locally on `duckdb-aws` that resulting extension binaries no longer depend on MSVC runtime shared libs. Ref: duckdblabs/duckdb-internal#2036 Upd: the same change is applied to `windows_arm64`.
b843e4d to
cd7a046
Compare
|
Rebased the PR on the latest main applying the same changes to |
|
This looks like duckdblabs/duckdb-internal#6877 |
|
I don't have merge access here, can you have a look @carlopi ? Feel free to rerun CI if you think it's necessary |
|
One thing I am wary connected to merging this is what are the wider implications of having some CI/extensions being built with this change, while other are built the other way. Also I am not sure how statically linking MSVC work for example with cross extension throws, those Exception will be the same type (and so caught) or not? Or similar issues at the border. I would need to think a bit more what is the proper path here, and would prefer to double check with @samansmink before proceding. |
|
On the CI failures: Rust extension loading is supposed to be fixed by duckdb/extension-template-rs#37, WASM failure is a generic download failure (networking error). |
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in #17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Testing: checked locally that `duckdb-httpfs` can successfully fetch HTTP(S) resources with this and `extension-ci-tools` changes applied. Ref: duckdblabs/duckdb-internal#2036
This PR adds an option `vcpkg_triplets_override` to the
`_extension_distribution.yml` that can be used to override vcpkg
triplets specified in the `distribution_matrix.json`.
Example:
```yaml
uses: ./.github/workflows/_extension_distribution.yml
with:
...
vcpkg_triplets_override: 'windows_amd64:x64-windows-static-md-release-vs2019comp;windows_arm64:arm64-windows-static-md-release-vs2019comp;'
```
It also restores the custom triplets removed in duckdb#276 so they can be
requested by caller workflows.
Testing: added example usage of the new option to `TestCITools.yml`
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb/duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb#169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in #169 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 added in duckdb/duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
This change makes all CMake targets to use `-MT`/`-MTd` compilation flags for Windows MSVC builds. This way the MSVC runtime library is linked statically and the workaround for VS2019 described in duckdb/duckdb#17991 is no longer necessary. `extension-ci-tools` PR: duckdb/extension-ci-tools#276 Ref: duckdblabs/duckdb-internal#2036
Due to the integration of duckdb/duckdb#19415 and duckdb/extension-ci-tools#276 the `1.4-andium` branch of Spatial extension can no longer be built with `main` branch of `extension-ci-tools`. This PR pins the version of `extension-ci-tools` used for CI builds. It should fix the following build problem on Windows: ``` error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' ``` Ref: duckdblabs/duckdb-internal#2036
This change replaces the use of
x64-windows-static-md-release-vs2019compvcpkg toolchain tox64-windows-static-releasefor Windows MSVC builds.With this change the MSVC runtime library (both C and C++ stdlibs) is linked statically to every extension. Thus extensions no longer rely on the MSVC runtime shared libs used by the host process and the VS2019-specific changes added in #229 are no longer necessary.
To make the build working a change is also required to the
duckdb/duckdbrepo - will file a PR there shortly.Testing: checked locally on
duckdb-awsthat resulting extension binaries are no longer depend on MSVC runtime shared libs.Ref: duckdblabs/duckdb-internal#2036
Upd: the same change is applied to
windows_arm64.