From 1c7e15dfa08ad349386775dc4e9435f0effbec96 Mon Sep 17 00:00:00 2001 From: Slach Date: Wed, 31 Jan 2024 21:37:06 +0400 Subject: [PATCH 1/3] try to add statically linked windows binary --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d64bda7..1b60ee5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,10 @@ tls = ["clickhouse-rs/tls-rustls"] [target.'cfg(not(target_family = "windows"))'.dependencies] cursive = { version = "*", default-features = false, features = ["termion-backend"] } skim = "*" + +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] + [target.'cfg(target_family = "windows")'.dependencies] # crossterm backend does not support Alt- bindings (interpret as just ) cursive = { version = "*", default-features = false, features = ["crossterm-backend"] } From 426a3ac7766c8b562afef8dbef78563dcbc3d93a Mon Sep 17 00:00:00 2001 From: Slach Date: Wed, 31 Jan 2024 21:55:52 +0400 Subject: [PATCH 2/3] move windows static build flags from Cargo.toml to workflow/build.yml --- .github/workflows/build.yml | 2 ++ Cargo.toml | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 661cee4..dd57008 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,6 +190,8 @@ jobs: pip3 install PyOxidizer - name: Build + env: + RUSTFLAGS: -C target-feature=+crt-static run: | make deploy-binary cp target/chdig.exe chdig-windows.exe diff --git a/Cargo.toml b/Cargo.toml index 1b60ee5..f9c9b10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,9 +20,6 @@ tls = ["clickhouse-rs/tls-rustls"] cursive = { version = "*", default-features = false, features = ["termion-backend"] } skim = "*" -[target.x86_64-pc-windows-msvc] -rustflags = ["-C", "target-feature=+crt-static"] - [target.'cfg(target_family = "windows")'.dependencies] # crossterm backend does not support Alt- bindings (interpret as just ) cursive = { version = "*", default-features = false, features = ["crossterm-backend"] } From 9a8995906701b4257d23cba97f0da513b0a77f02 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Thu, 1 Feb 2024 09:12:22 +0100 Subject: [PATCH 3/3] Switch default python distribution to standalone_static Refs: https://pyoxidizer.readthedocs.io/en/stable/pyoxidizer_packaging_static_linking.html#building-statically-linked-binaries-on-windows --- contrib/flameshow/pyoxidizer.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/flameshow/pyoxidizer.bzl b/contrib/flameshow/pyoxidizer.bzl index 2a2ba5d..121a5f3 100644 --- a/contrib/flameshow/pyoxidizer.bzl +++ b/contrib/flameshow/pyoxidizer.bzl @@ -2,7 +2,7 @@ def make_exe(): # Obtain the default PythonDistribution for our build target. We link # this distribution into our produced executable and extract the Python # standard library from it. - dist = default_python_distribution() + dist = default_python_distribution(flavor = "standalone_static") # This function creates a `PythonPackagingPolicy` instance, which # influences how executables are built and how resources are added to