From 1d715f059d7e50cd4c5c78793562de7933b7132a Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Mon, 27 Apr 2026 21:42:11 +0800 Subject: [PATCH] fix macOS local build --- crates/openconnect/build.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/openconnect/build.rs b/crates/openconnect/build.rs index 346edd0..15ad7a2 100644 --- a/crates/openconnect/build.rs +++ b/crates/openconnect/build.rs @@ -121,7 +121,8 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf { // We explicitly enable static and disable shared to ensure we get a .a file. // .reconf("-ivf") is CRITICAL for git submodules because 'configure' // usually doesn't exist yet and needs to be generated. - let dst = autotools::Config::new(&build_src) + let mut config = autotools::Config::new(&build_src); + config .reconf("-ivf") .enable_static() .disable_shared() @@ -134,8 +135,15 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf { .without("libpskc", None) .without("gssapi", None) .with("gnutls-tss2", Some("no")) - .with("vpnc-script", Some("/etc/vpnc/vpnc-script")) // Specify vpnc-script, otherwise it will fail on macOS - .build(); + .with("vpnc-script", Some("/etc/vpnc/vpnc-script")); // Specify vpnc-script, otherwise it will fail on macOS + + #[cfg(target_os = "macos")] + { + config.ldflag("-liconv"); + config.env("LIBS", "-liconv"); + } + + let dst = config.build(); let lib_dir = dst.join("lib"); let include_dir = dst.join("include");