pq
pq copied to clipboard
Build fails on Windows
Running cargo install --no-default-features pq as it says in the readme fails because I don't have Perl installed:
error: failed to run custom build command for `openssl-sys v0.9.102`
Caused by:
process didn't exit successfully: `C:\Users\Sean\AppData\Local\Temp\cargo-installd9xwa7\release\build\openssl-sys-b8dbedb3f6d2712d\build-script-main` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
running "perl" "./Configure" "--prefix=C:/Users/Sean/AppData/Local/Temp/cargo-installd9xwa7/release/build/openssl-sys-1bd94b2fc2c3dd8d/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-capieng" "no-asm" "VC-WIN64A"
--- stderr
thread 'main' panicked at C:\Users\Sean\.cargo\registry\src\index.crates.io-6f17d22bba15001f\openssl-src-300.2.3+3.2.1\src\lib.rs:611:9:
Error configuring OpenSSL build:
Command: "perl" "./Configure" "--prefix=C:/Users/Sean/AppData/Local/Temp/cargo-installd9xwa7/release/build/openssl-sys-1bd94b2fc2c3dd8d/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-capieng" "no-asm" "VC-WIN64A"
Failed to execute: program not found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `pq v1.4.3`, intermediate artifacts can be found at `C:\Users\Sean\AppData\Local\Temp\cargo-installd9xwa7`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
I got it to build by applying this patch:
diff --git a/Cargo.toml b/Cargo.toml
index 89bca6c..0cbb396 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ exclude = ["pq-bin.tar.gz", "pq", "target/**"]
edition = "2021"
[dependencies]
-openssl = { version = "0.10", features = ["vendored"] }
serde = "1.0"
erased_serde_json = { path = "erased-serde-json", version = "0.1.3" }
serde_json = "1.0"
That patch fails the build unless kafka is disabled though. This is probably better, tying the use of openssl to the use of kafka:
diff --git a/Cargo.toml b/Cargo.toml
index 89bca6c..0cbb396 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ exclude = ["pq-bin.tar.gz", "pq", "target/**"]
edition = "2021"
[dependencies]
-openssl = { version = "0.10", features = ["vendored"] }
serde = "1.0"
erased_serde_json = { path = "erased-serde-json", version = "0.1.3" }
serde_json = "1.0"
diff --git a/stream-delimit/Cargo.toml b/stream-delimit/Cargo.toml
index 7de208a..ec35235 100644
--- a/stream-delimit/Cargo.toml
+++ b/stream-delimit/Cargo.toml
@@ -11,9 +11,10 @@ keywords = ["protobuf", "serde"]
edition = "2018"
[dependencies]
+openssl = { version = "0.10", features = ["vendored"], optional = true }
kafka = { version = "0.8", optional = true }
byteorder = "1.3"
[features]
default = []
-with_kafka = ["kafka"]
+with_kafka = ["kafka", "openssl"]
See also https://github.com/sfackler/rust-openssl/issues/2149 for the perl-on-windows issue.
I'm not big on Windows so whoever has a good fix for this, feel free to make a PR