Opened 6 months ago

Closed 5 months ago

#24652 closed defect (fixed)

Rust builds fail on macOS with linker error

Reported by: teor Owned by: nickm
Priority: Medium Milestone: Tor: 0.3.2.x-final
Component: Core Tor/Tor Version: Tor: 0.3.2.1-alpha
Severity: Normal Keywords: rust, 032-backport, review-group-29
Cc: Actual Points:
Parent ID: Points: 0.1
Reviewer: Sponsor:

Description

Both my gcc and clang builds get this error:
https://travis-ci.org/teor2345/tor/jobs/316748503
https://travis-ci.org/teor2345/tor/jobs/316748509

Undefined symbols for architecture x86_64:

  "_res_9_init", referenced from:

      std::sys::unix::net::res_init_if_glibc_before_2_26::h5cce5181e3d1daee in libtor_rust.a(std-af00cffd9617c4f1.std13-3c37598e0257c2e4b7713b0956fa5bab.rs.rcgu.o)

ld: symbol(s) not found for architecture x86_64

The Linux builds are fine, as are the non-Rust macOS builds.

Child Tickets

Change History (9)

comment:1 Changed 6 months ago by teor

This is an upstream issue:
https://github.com/rust-lang/rust/issues/46797

We can fix it by linking our rust builds to -lresolv.

comment:2 Changed 6 months ago by teor

Points: 0.1

Adding LIBS=-lresolv to configure fixes this issue.
But I'm not sure how to modify Makefile.am so it's just added as a rust dependency.

comment:3 Changed 6 months ago by teor

Keywords: 032-backport added

comment:4 Changed 6 months ago by nickm

Owner: set to nickm
Status: newaccepted

comment:5 Changed 6 months ago by nickm

My branch bug24652_032 has a fix here that I think we should merge. It will have minor conflicts on master.

FWIW though when I run it, stuff builds, but the unit tests fail on OSX for me. I think that's a separate bug from this one, though. I've opened another ticket for that as #24795 .

comment:6 Changed 6 months ago by nickm

Status: acceptedneeds_review

comment:7 Changed 5 months ago by nickm

Keywords: review-group-29 added

comment:8 Changed 5 months ago by ahf

Status: needs_reviewmerge_ready

I haven't tested it locally, but the patch looks good to me.

comment:9 Changed 5 months ago by nickm

Resolution: fixed
Status: merge_readyclosed

merged it to 0.3.2 and forward!

Note: See TracTickets for help on using tickets.