From 8a045af255a7cb0d1516fe8c21fdf73f704d3548 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Thu, 6 Oct 2022 21:05:29 -0700 Subject: [PATCH] Don't link against iconv on apple targets when used by `std` --- src/unix/bsd/apple/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(