diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index a9438ef57a3c2..0662e81fc60a9 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -5873,7 +5873,10 @@ cfg_if! { } } -#[link(name = "iconv")] +// These require a dependency on `libiconv`, and including this when built as +// part of `std` means every Rust program gets it. Ideally we would have a link +// modifier to only include these if they are used, but we do not. +#[cfg_attr(not(feature = "rustc-dep-of-std"), link(name = "iconv"))] extern "C" { pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t; pub fn iconv(