Skip to content

Commit 99202f7

Browse files
committed
Link iconv on macOS via build.rs
1 parent 3553014 commit 99202f7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ fn main() {
1010
let const_extern_fn_cargo_feature =
1111
env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
1212
let libc_ci = env::var("LIBC_CI").is_ok();
13+
let target = env::var("TARGET").unwrap();
1314

1415
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
1516
println!(
@@ -82,6 +83,10 @@ fn main() {
8283
}
8384
println!("cargo:rustc-cfg=libc_const_extern_fn");
8485
}
86+
87+
if target.contains("-apple-") {
88+
println!("cargo:rustc-link-lib=iconv");
89+
}
8590
}
8691

8792
fn rustc_minor_nightly() -> Option<(u32, bool)> {

src/unix/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,8 @@ cfg_if! {
297297
if #[cfg(target_os = "l4re")] {
298298
// required libraries for L4Re are linked externally, ATM
299299
} else if #[cfg(feature = "std")] {
300-
// cargo build. Most libraries are already pulled in by libstd dep
301-
#[cfg_attr(
302-
any(target_os = "macos", target_os = "ios"),
303-
link(name = "iconv"))]
300+
// cargo build, don't pull in anything extra as the libstd dep
301+
// already pulls in all libs.
304302
extern {}
305303
} else if #[cfg(all(target_os = "linux",
306304
target_env = "gnu",

0 commit comments

Comments
 (0)