In helping to debug https://trac.torproject.org/projects/tor/ticket/25386 I've found that a number of the link errors are attributable to the linker invocation on Travis. The recent link_rust.sh script is definitely necessary I think, except that I believe it needs a few tweaks:
The -lasan argument should be replaced with -fsanitizer=address I believe to ensure that the C compiler links all of its relevant libraries (as they may have different names and different numbers of libs on some platforms I think).
Second, the Rust compiler by default passes -nodefaultlibs to the linker which means that the linker script also passes this along. It looks, however, like this is incompatible with -fsanitizer=address, causing link errors. This argument should be safe to strip out though.
The first bullet was easy enough to fix locally and the second bullet was fixable by changing link_rust.sh to a bash script and then using something like:
Some systems don't have bash installed. Do we require bash for other build steps?
If not, we should list it as a dependency.
Also, some distros install bash in /usr/local/bin, so we should use env to find it.
Is there an argument that's the opposite of -nodefaultlibs? If so, we could add it to the command-line using any shell.
There doesn't seem to be a -defaultlibs in gcc, although there may be some command-line code that gives every option a negated form.
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
Ah yeah I tried to pass -defaultlibs in the hopes that it would work, but unfortunately I also was unable to get it working. We also unfortunately don't have a way to disable this behavior in rustc (passing -nodefaultlibs), but we probably should...
Ah yeah I tried to pass -defaultlibs in the hopes that it would work, but unfortunately I also was unable to get it working. We also unfortunately don't have a way to disable this behavior in rustc (passing -nodefaultlibs), but we probably should...
Thinking about this again though, it may be the case that -nodefaultlibs is a red herring in the sense that the link errors may just be fixable by linking the libraries that otherwise wouldn't be linked. I'd have to dig more into the precise linker errors though which I sort of forget at this point :(
Okay -- Teor is swamped, so I'll try to do initial review. I've looked over this branch and re-tested it... and I think it is good to merge. I have just one question and a few TODOs before I go ahead:
The question:
When can we switch back from "nightly" to "stable"? I don't want tor to start depending on nightly, so if there's going to be a long interval, we should add another build for rust stable (with no sanitizers).
The TODOs: (Alex, you don't need to do any of these unless you are super-psyched to participate in the minutiae of our development process)
Add a changes file (see doc/HACKING/CodingStandards.md)
For the " Remove the link_rust.sh.in script" commit, add a bunch of comments to include.am to explain exactly what the new RUSTFLAGS stuff does and why it's there.
This'll be able to work on stable starting with the 1.31.0 release, happening in early December. The bug fixes should be riding the trains soon to beta (happening in the next day or so). Once that happens you can switch to beta to ensure nightly features don't slip in by accident!
I'll look to see if I can tweak the commits in the coming days, but don't block on me! I probably won't be able to get to this until next Monday at the earliest
This'll be able to work on stable starting with the 1.31.0 release, happening in early December. The bug fixes should be riding the trains soon to beta (happening in the next day or so). Once that happens you can switch to beta to ensure nightly features don't slip in by accident!
I think we might benefit from always building with stable, beta and nightly rust:
If we always build Mac and Linux with nightly, we'll catch rust bugs early, before they ride the trains.
If we always build Linux with beta and stable, then we'll catch nightly features, and also catch any bugs that slip into beta while there's still a chance to fix them. (We try to minimise our Mac builds, because they're slow.)
We currently have the following rust builds:
Linux, rust stable, frozen rust dependencies, no hardening
Mac, rust stable, frozen rust dependencies, no hardening
Linux, rust stable, online rust dependencies, no hardening, distcheck
Oops sorry about that, the issue of working with 1.29/1.30 should be fixed now in the latest commit I've pushed to the PR
I also don't mind rejiggering versions being tested and such, I think it definitely makes sense to test on stable and then just have a handful of nightly builders for now with hardening until that support stabilizes.
I've added a changes file and merged it to 0.3.5 and later, since it's a clear improvement over what we have now. I've opened a new ticket #28244 (moved) for the followup items that we identified above. Thank you!
Trac: Status: needs_revision to closed Resolution: N/Ato fixed