Rust needs CMake 3.4.3 at least + LLVM 3.9, and some compiler that supports C++-11. It turns out we want the first two anyway during the update of our macOS toolchain and g++4.7 is the minimum requirement outlined on the rust-lang website. So, we should be good, right? Alas, it turns our that's not the case. For one, not all parts we need to build are happy with g++ 4.7.2 which Wheezy ships, so we need our own compiler. But, two, even salvaging some of our LLVM build efforts are failing: using LLVM 3.9 crashes the compiler during the cargo build step. See e.g.:
So, I worked around that by building LLVM during the rust compilation (which make the whole process taking significantly more time) using that version in turn.
The current setup is building basically all the tools which come with the rustc source tarball. We might only need rustc and cargo, and one way to achieve that might be to split both and build them in separate projects. I am fine if we want to pursue this option later on after we got the basics working.
There is a bunch of documentation that is getting built during normal compilation. I guess we can optimize that away later on and find other knobs to produce a smaller toolchain faster.
So, I worked around that by building LLVM during the rust compilation (which make the whole process taking significantly more time) using that version in turn.
I don't see LLVM being built in your patch. Is it done internally by the rust build system?
The extracting of gcc and update of the PATH/LD_LIBRARY_PATH could be replaced by:
So, I worked around that by building LLVM during the rust compilation (which make the whole process taking significantly more time) using that version in turn.
I don't see LLVM being built in your patch. Is it done internally by the rust build system?
Yes, it uses the LLVM code that is shipped with the Rust source.
The extracting of gcc and update of the PATH/LD_LIBRARY_PATH could be replaced by:
{{{
[% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc') }) %]
}}}
However it will also set hardened-cc links. Is it because the build doesn't work with hardened-cc that you didn't use it?
No, I originally wanted to avoid using our own GCC as this adds complexity but piece by piece I realized that this is not realistic and added workarounds which resulted in the final patch, forgetting about this macro. This is fixed now.
For the ln -s gcc cc link, I am wondering if we should add it directly in projects/gcc/build, or if there are cases where we might not want this link.
I can avoid this clumsy symlink by using a configure option which seems neat and which we probably need to use anyway when actually cross-compiling. So, I think we should go with that.
In projects/tor/build, I think the lines after the IF c("var/linux") && c("var/nightly") can be indented.
Fixed.
The updated patch is at bug_25481_v4 (https://gitweb.torproject.org/user/gk/tor-browser-build.git/commit/?h=bug_25481_v4&id=fde93d07ca425ee884930cf01fd435b31ace48b8) in my public tor-browser-build repo. Note: I tested the x86_64 tor and it is running fine for me. I even checked whether tor built from the same revision twice is identical, and it is! Moreover, I verified that the hardening properties on the tor binary are still the ones we want to have (with the checksec script). So, we are good here. I guess the 32bit tor could get tested, though, which I did not do yet.
Trac: Status: needs_revision to needs_review Keywords: TorBrowserTeam201804 deleted, TorBrowserTeam201804R added
One small thing: the prev_version variable in projects/rust/config should be named var/prev_version instead, as it is not a variable that has a specific meaning for rbm.
Other than this the patch looks good to me.
I tried a 32bit build of Tor, ran checksec on it, and have been able to bootstrap with it.