Skip to content

Commit 2ac9734

Browse files
committed
Use -lresolv in LIBS with rust on OSX.
This fixes issue #24652, and is a workaround for Rust issue rust-lang/rust#46797 .
1 parent 9ef97a2 commit 2ac9734

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT)
2626
endif
2727

2828
if USE_RUST
29-
rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@
29+
rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@ \
30+
@TOR_RUST_EXTRA_LIBS@
3031
else
3132
rust_ldadd=
3233
endif

changes/bug24652

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
o Minor bugfixes (build, compatibility, rust, OSX):
2+
3+
- When building with Rust on OSX, link against libresolv, to
4+
work around the issue at
5+
https://github.com/rust-lang/rust/issues/46797. Fixes bug
6+
24652; bugfix on 0.3.1.1-alpha.

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,15 @@ if test "x$enable_rust" = "xyes"; then
436436
fi
437437
fi
438438

439+
dnl This is a workaround for #46797
440+
dnl (a.k.a https://github.com/rust-lang/rust/issues/46797 ). Once the
441+
dnl upstream bug is fixed, we can remove this workaround.
442+
case "$host_os" in
443+
darwin*)
444+
TOR_RUST_EXTRA_LIBS="-lresolv"
445+
;;
446+
esac
447+
439448
dnl For now both MSVC and MinGW rust libraries will output static libs with
440449
dnl the MSVC naming convention.
441450
if test "$bwin32" = "true"; then
@@ -460,6 +469,8 @@ if test "x$enable_rust" = "xyes"; then
460469
fi
461470
fi
462471

472+
AC_SUBST(TOR_RUST_EXTRA_LIBS)
473+
463474
AC_SEARCH_LIBS(socket, [socket network])
464475
AC_SEARCH_LIBS(gethostbyname, [nsl])
465476
AC_SEARCH_LIBS(dlopen, [dl])

0 commit comments

Comments
 (0)