Opened 7 months ago

Closed 6 months ago

#25975 closed defect (fixed)

Get a rust cross-compiler for macOS

Reported by: gk Owned by: tbb-team
Priority: Very High Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-rbm, ff60-esr, TorBrowserTeam201805R, GeorgKoppen201805R, boklm201805
Cc: boklm Actual Points:
Parent ID: #25779 Points:
Reviewer: Sponsor:

Description

We want to build our own rust compiler for building the Firefox and tor rust parts.

Child Tickets

Change History (8)

comment:1 Changed 7 months ago by gk

Keywords: TorBrowserTeam201805R added; TorBrowserTeam201804 removed
Priority: MediumHigh
Status: newneeds_review

comment:2 Changed 7 months ago by boklm

Keywords: boklm201805 added; boklm201804 removed

boklm201804 -> boklm201805

comment:3 Changed 6 months ago by gk

Keywords: GeorgKoppen201805 added; GeorgKoppen201804 removed
Status: needs_reviewneeds_revision

Okay, this likely needs a revision as using a so-created Rust cross-compiler leads to:

 8:36.74 error[E0433]: failed to resolve. Could not find `__FastLocalKeyInner` in `thread`
 8:36.74   --> third_party/rust/futures/src/task_impl/std/mod.rs:28:1
 8:36.74    |
 8:36.74 28 | thread_local!(static CURRENT_TASK: Cell<*mut u8> = Cell::new(ptr::null_mut()));
 8:36.74    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `__FastLocalKeyInner` in `thread`
 8:36.74    |
 8:36.74    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 8:36.74 
 8:36.75 error[E0433]: failed to resolve. Could not find `__FastLocalKeyInner` in `thread`
 8:36.75    --> third_party/rust/futures/src/task_impl/std/mod.rs:494:1
 8:36.75     |
 8:36.75 494 | / thread_local! {
 8:36.75 495 | |     static CURRENT_THREAD_NOTIFY: Arc<ThreadNotify> = Arc::new(ThreadNotify {
 8:36.75 496 | |         state: AtomicUsize::new(IDLE),
 8:36.75 497 | |         mutex: Mutex::new(()),
 8:36.75 498 | |         condvar: Condvar::new(),
 8:36.75 499 | |     });
 8:36.75 500 | | }
 8:36.75     | |_^ Could not find `__FastLocalKeyInner` in `thread`
 8:36.75     |
 8:36.75     = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
 8:36.75 

comment:4 Changed 6 months ago by gk

__FastLocalKeyInner seems to be missing in our libstd .rlib, hm, yet I can see

thread :: __FastLocalKeyInner < $ t > = $ crate :: thread ::
__FastLocalKeyInner :: new (  ) ; # [ cfg ( not ( target_thread_local ) ) ]
static __KEY : $ crate :: thread :: __OsLocalKeyInner < $ t > = $ crate ::
thread :: __OsLocalKeyInner :: new (  ) ; __KEY . get (  ) } unsafe {

as in the lib downloaded via rustup.

comment:5 Changed 6 months ago by gk

Cc: boklm added
Keywords: GeorgKoppen201805R added; GeorgKoppen201805 removed
Status: needs_revisionneeds_review

Actually, we are good. The reason for this problem is that we are setting MACOSXDEPLOYMENT_TARGET=10.6 which fits to the current toolchain we use. thread_local is not supported for 10.6 but it is for 10.7 onward. Thus, we are good for now and will be later on when switching to our new toolchain. I just tested that and could successfully build esr60.

I've rebased my patch on master and pushed an update to bug_25975_v2 (https://gitweb.torproject.org/user/gk/tor-browser-build.git/commit/?h=bug_25975_v2&id=040cc0560eb21cf09dbdbbd33d501b805a28d6bd).

boklm could you review that one?

comment:6 Changed 6 months ago by boklm

I didn't try to build it, but the patch looks good to me.

One minor thing: the line cat > $distdir/helper/x86_64-apple-darwin-clang << 'EOF' and the comment before can be indented.

comment:7 Changed 6 months ago by gk

Priority: HighVery High

Adjusting prios of some tickets.

comment:8 in reply to:  6 Changed 6 months ago by gk

Resolution: fixed
Status: needs_reviewclosed

Replying to boklm:

I didn't try to build it, but the patch looks good to me.

One minor thing: the line cat > $distdir/helper/x86_64-apple-darwin-clang << 'EOF' and the comment before can be indented.

I fixed that and pushed the result to master as commit e7f9f6f11e45d1ba15fbbb183ef1ae8b0c3b20c5, thanks.

Note: See TracTickets for help on using tickets.