Skip to content

Commit ae5cf30

Browse files
committed
res_init is __res_init; doesn't need -lresolv
glibc 2.2 deprecated res_init, and renamed it as __res_init: https://bugzilla.redhat.com/show_bug.cgi?id=43822#c6 res_init keeps working in C for programs that directly use resolv.h, since it redefines the symbol in a macro, but this won't work in Rust land.
1 parent 35c5b2e commit ae5cf30

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/unix/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ cfg_if! {
229229
target_os = "bitrig"))] {
230230
#[link(name = "c")]
231231
#[link(name = "m")]
232-
#[link(name = "resolv")]
233232
extern {}
234233
} else if #[cfg(target_os = "haiku")] {
235234
#[link(name = "root")]
@@ -243,7 +242,6 @@ cfg_if! {
243242
#[link(name = "c")]
244243
#[link(name = "m")]
245244
#[link(name = "rt")]
246-
#[link(name = "resolv")]
247245
#[link(name = "pthread")]
248246
extern {}
249247
}
@@ -696,6 +694,7 @@ extern {
696694
res: *mut *mut addrinfo) -> ::c_int;
697695
pub fn freeaddrinfo(res: *mut addrinfo);
698696
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
697+
#[link_name = "__res_init"]
699698
pub fn res_init() -> ::c_int;
700699

701700
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]

0 commit comments

Comments
 (0)