Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#22818 closed enhancement (implemented)

Improve documentation for building Tor with Rust

Reported by: chelseakomlo Owned by:
Priority: Medium Milestone: Tor: 0.3.2.x-final
Component: Core Tor/Tor Version: Tor: 0.3.1.2-alpha
Severity: Normal Keywords: rust tor-build docs rust-pilot
Cc: isis, Sebastian, acrichton@… Actual Points:
Parent ID: Points: 1
Reviewer: Sponsor: SponsorZ

Description

We have documentation that has thus far been a work in progress at https://trac.torproject.org/projects/tor/wiki/RustInTor and https://trac.torproject.org/projects/tor/wiki/RustInTor/Hacking

However, we should create a doc/HACKING/RustInTor.md with basic information to get people started, as it isn't obvious to look at the above wiki pages. Also, there is still missing information, such as which dependencies are necessary if someone chooses to build using a specified local directory for Rust dependencies.

For example, we should have:

  1. Which dependencies are needed if someone wants to build using local Rust dependencies.
  2. Basic information about how to build and run tests
  3. Links to wiki pages that are still a work in progress

Child Tickets

Change History (8)

comment:1 Changed 2 years ago by isis

I added documentation on which dependencies are needed and how to get them here: https://trac.torproject.org/projects/tor/wiki/RustInTor#Usingalocaldependencycache

But now I have a problem in that the build doesn't complete and the relevant part of the output is:

  AR       src/trace/libor-trace.a
  CC       src/or/tor_main.o
/usr/bin/gcc-4.9.real -fstack-protector-strong -fPIE -Wformat -Wformat-security -Werror=format-security -std=gnu99 -DHAVE_CONFIG_H -I. -I./src/ext -Isrc/ext -I./src/ext/trunnel -I./src/trunnel -I./src/common -Isrc/common -I./src/ext/trunnel -I./src/trunnel -I./src/or -Isrc/or -DSHARE_DATADIR="/usr/local/share" -DLOCALSTATEDIR="/usr/local/var" -DBINDIR="/usr/local/bin" -I./src -I./src/common -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -Waddress -Warray-bounds -Wdate-time -Wdouble-promotion -Wextra -Wfloat-conversion -Winit-self -Wlogical-op -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wnormalized=id -Woverlength-strings -Woverride-init -Wshadow -Wstrict-overflow=1 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsync-nand -Wtrampolines -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-local-typedefs -Wvariadic-macros -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wnested-externs -Wbad-function-cast -Wswitch-enum -Waggregate-return -Wpacked -Wunused -Wunused-parameter -Wold-style-definition -Wmissing-declarations -MT src/or/tor_main.o -MD -MP -MF src/or/.deps/tor_main.Tpo -c -o src/or/tor_main.o src/or/tor_main.c
( cd "/home/user/code/torproject/tor/src/rust/tor_util" ; \
	CARGO_TARGET_DIR="/home/user/code/torproject/tor/src/rust/target" \
	HOME="/home/user/code/torproject/tor/src/rust" \
	cargo build --release --quiet --frozen )
error: no default toolchain configured
Makefile:10756: recipe for target 'src/rust/target/release/libtor_util.a' failed
make[1]: *** [src/rust/target/release/libtor_util.a] Error 1
make[1]: Leaving directory '/home/user/code/torproject/tor'
Makefile:3093: recipe for target 'all' failed
make: *** [all] Error 2
∃!user(A)rustup:(master=)~/code/torproject/tor ∴ 

I don't know what "no default toolchain configured" is referring to, but building other (pure-)Rust projects in that Qube works fine, and it's using just the normal nightly rustc and cargo which rustup gives you.

comment:2 in reply to:  1 ; Changed 2 years ago by chelseakomlo

Replying to isis:

I added documentation on which dependencies are needed and how to get them here: https://trac.torproject.org/projects/tor/wiki/RustInTor#Usingalocaldependencycache

Awesome. Do you think it is time to add this and other info on building/testing with Rust to docs/HACKING?


But now I have a problem in that the build doesn't complete and the relevant part of the output is:

  AR       src/trace/libor-trace.a
  CC       src/or/tor_main.o
/usr/bin/gcc-4.9.real -fstack-protector-strong -fPIE -Wformat -Wformat-security -Werror=format-security -std=gnu99 -DHAVE_CONFIG_H -I. -I./src/ext -Isrc/ext -I./src/ext/trunnel -I./src/trunnel -I./src/common -Isrc/common -I./src/ext/trunnel -I./src/trunnel -I./src/or -Isrc/or -DSHARE_DATADIR="/usr/local/share" -DLOCALSTATEDIR="/usr/local/var" -DBINDIR="/usr/local/bin" -I./src -I./src/common -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -Waddress -Warray-bounds -Wdate-time -Wdouble-promotion -Wextra -Wfloat-conversion -Winit-self -Wlogical-op -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wnormalized=id -Woverlength-strings -Woverride-init -Wshadow -Wstrict-overflow=1 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsync-nand -Wtrampolines -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-local-typedefs -Wvariadic-macros -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wnested-externs -Wbad-function-cast -Wswitch-enum -Waggregate-return -Wpacked -Wunused -Wunused-parameter -Wold-style-definition -Wmissing-declarations -MT src/or/tor_main.o -MD -MP -MF src/or/.deps/tor_main.Tpo -c -o src/or/tor_main.o src/or/tor_main.c
( cd "/home/user/code/torproject/tor/src/rust/tor_util" ; \
	CARGO_TARGET_DIR="/home/user/code/torproject/tor/src/rust/target" \
	HOME="/home/user/code/torproject/tor/src/rust" \
	cargo build --release --quiet --frozen )
error: no default toolchain configured
Makefile:10756: recipe for target 'src/rust/target/release/libtor_util.a' failed
make[1]: *** [src/rust/target/release/libtor_util.a] Error 1
make[1]: Leaving directory '/home/user/code/torproject/tor'
Makefile:3093: recipe for target 'all' failed
make: *** [all] Error 2
∃!user(A)rustup:(master=)~/code/torproject/tor ∴ 

I don't know what "no default toolchain configured" is referring to, but building other (pure-)Rust projects in that Qube works fine, and it's using just the normal nightly rustc and cargo which rustup gives you.

I also have seen this issue. We should probably open a separate bug for it?

comment:3 in reply to:  2 Changed 2 years ago by isis

Replying to chelseakomlo:

Replying to isis:

I added documentation on which dependencies are needed and how to get them here: https://trac.torproject.org/projects/tor/wiki/RustInTor#Usingalocaldependencycache

Awesome. Do you think it is time to add this and other info on building/testing with Rust to docs/HACKING?


Yeah, I think we should probably make the documentation easier to find than a wiki page that we don't tell anyone where it is. :)

Perhaps if it's going into doc/HACKING/ we should just note that building with non-cargo-obtained dependencies is not currently supported?

But now I have a problem in that the build doesn't complete and the relevant part of the output is:

  AR       src/trace/libor-trace.a
  CC       src/or/tor_main.o
/usr/bin/gcc-4.9.real -fstack-protector-strong -fPIE -Wformat -Wformat-security -Werror=format-security -std=gnu99 -DHAVE_CONFIG_H -I. -I./src/ext -Isrc/ext -I./src/ext/trunnel -I./src/trunnel -I./src/common -Isrc/common -I./src/ext/trunnel -I./src/trunnel -I./src/or -Isrc/or -DSHARE_DATADIR="/usr/local/share" -DLOCALSTATEDIR="/usr/local/var" -DBINDIR="/usr/local/bin" -I./src -I./src/common -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector --param ssp-buffer-size=1 -fPIE -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -Waddress -Warray-bounds -Wdate-time -Wdouble-promotion -Wextra -Wfloat-conversion -Winit-self -Wlogical-op -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wnormalized=id -Woverlength-strings -Woverride-init -Wshadow -Wstrict-overflow=1 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsync-nand -Wtrampolines -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-local-typedefs -Wvariadic-macros -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wnested-externs -Wbad-function-cast -Wswitch-enum -Waggregate-return -Wpacked -Wunused -Wunused-parameter -Wold-style-definition -Wmissing-declarations -MT src/or/tor_main.o -MD -MP -MF src/or/.deps/tor_main.Tpo -c -o src/or/tor_main.o src/or/tor_main.c
( cd "/home/user/code/torproject/tor/src/rust/tor_util" ; \
	CARGO_TARGET_DIR="/home/user/code/torproject/tor/src/rust/target" \
	HOME="/home/user/code/torproject/tor/src/rust" \
	cargo build --release --quiet --frozen )
error: no default toolchain configured
Makefile:10756: recipe for target 'src/rust/target/release/libtor_util.a' failed
make[1]: *** [src/rust/target/release/libtor_util.a] Error 1
make[1]: Leaving directory '/home/user/code/torproject/tor'
Makefile:3093: recipe for target 'all' failed
make: *** [all] Error 2
∃!user(A)rustup:(master=)~/code/torproject/tor ∴ 

I don't know what "no default toolchain configured" is referring to, but building other (pure-)Rust projects in that Qube works fine, and it's using just the normal nightly rustc and cargo which rustup gives you.

I also have seen this issue. We should probably open a separate bug for it?


#22830

comment:4 Changed 2 years ago by nickm

Keywords: tor-build docs added

comment:5 Changed 2 years ago by alexcrichton

Cc: acrichton@… added

comment:6 Changed 2 years ago by isis

Keywords: rust-pilot added
Milestone: Tor: unspecifiedTor: 0.3.1.x-final
Points: 1
Sponsor: SponsorZ
Status: newneeds_review
Version: Tor: unspecifiedTor: 0.3.1.2-alpha

I added a doc/HACKING/CodingStandardsRust.md and a doc/HACKING/GettingStartedRust.md in my bug22818 branch.

I probably missed or didn't think of plenty of things, so if you think of something please let me know. (I don't think we need to think of everything now… we can add more stuff as we realise it.)

comment:7 Changed 2 years ago by nickm

Milestone: Tor: 0.3.1.x-finalTor: 0.3.2.x-final
Resolution: implemented
Status: needs_reviewclosed

Thanks! I'm merging this in 0.3.2. We can take more patches here as we find issues. :)

comment:8 in reply to:  7 Changed 2 years ago by isis

Replying to nickm:

Thanks! I'm merging this in 0.3.2. We can take more patches here as we find issues. :)


Cool, thanks! I removed the info from the wiki pages and put links to the documentation in the repo so that we don't end up with conflicting docs.

Note: See TracTickets for help on using tickets.