Chris H-C: Doubling the Speed of Windows Firefox Builds using sccache-dist |
I’m one of the many users but few developers of Firefox on Windows. One of the biggest obstacles stopping me from doing more development on Windows instead of this beefy Linux desktop I have sitting under my table is how slow builds are.
Luckily, distributed compilation (and caching) using sccache is here to help. This post is a step-by-step version of the rather-more-scattered docs I found on the github repo and in Firefox’s documentation. Those guides are excellent and have all of the same information (though they forgot to remind me to put the ports on the url config variables), but they have to satisfy many audiences with many platforms and many use cases so I found myself having to switch between all three to get myself set up.
To synthesize what I learned all in one place, I’m writing my Home Office Version to be specific to “using a Linux machine to help your Windows machine compile Firefox on a local network”. Here’s how it goes:
# Don't forget the port, and don't use an internal iface address like 127.0.0.1. # This is where the Clients and Servers should find the Scheduler public_addr = "192.168.1.1:10600" [client_auth] type = "token" # You can use whatever source of random, long, hard-to-guess token you'd like. # But chances are you have openssl anyway, and it's good enough unless you're in # a VM or other restrained-entropy situation. token = "" [server_auth] type = "jwt_hs256" secret_key = " "
# Toolchains are how a Linux Server can build for a Windows Client. # The Server needs a place to cache these so Clients don’t have to send them along each time. cache_dir = "/tmp/toolchains" # You can also config the cache size with toolchain_cache_size, but the default of 10GB is fine. # This is where the Scheduler can find the Server. Don’t forget the port. public_addr = "192.168.1.1:10501" # This is where the Server can find the Scheduler. Don’t forget http. Don’t forget the port. # Ideally you’d have an https server in front that’d add a layer of TLS and # redirect to the port for you, but this is Home Office Edition. scheduler_url = "http://192.168.1.1:10600" [builder] type = "overlay" # I don’t know what this means build_dir = "/tmp/build" # Where on the fs you want that sandbox of build jobs to live bwrap_path = "/usr/bin/bwrap" # Where the bubblewrap 0.3.0+ binary lives [scheduler_auth] type = "jwt_token" token = "--server "
[dist] scheduler_url = "http://192.168.1.1:10600" # Don’t forget the protocol or port toolchain_cache_size = 5368709120 # The default of 10GB is at least twice as big as you need. # Gonna need two toolchains, one for C++ and one for Rust # Remember to replace allwith your user name on disk [[dist.toolchains]] type = "path_override" compiler_executable = "C:/Users/ /.mozbuild/clang/bin/clang-cl.exe" archive = "C:/Users/ /.mozbuild/clang-dist-toolchain.tar.xz" archive_compiler_executable = "/builds/worker/toolchains/clang/bin/clang" [[dist.toolchains]] type = "path_override" compiler_executable = "C:/Users/ /.rustup/toolchains/stable-x86_64-pc-windows-msvc/bin/rustc.exe" archive = "C:/Users/ /.mozbuild/rustc-dist-toolchain.tar.xz" archive_compiler_executable = "/builds/worker/toolchains/rustc/bin/rustc" # Near as I can tell, these dist.toolchains blocks tell sccache # that if a job requires a tool at `compiler_executable` then it should instead # distribute the job to be compiled using the tool present in `archive` at # the path within the archive of `archive_compiler_executable`. # You’ll notice that the `archive_compiler_executable` binaries do not end in `.exe`. [dist.auth] type = "token" token = " "
# Remember to replace allwith your user name on disk ac_add_options CCACHE="C:/Users/ /.mozbuild/sccache/sccache.exe" export CC="C:/Users/ /.mozbuild/clang/bin/clang-cl.exe --driver-mode=cl" export CXX="C:/Users/ /.mozbuild/clang/bin/clang-cl.exe --driver-mode=cl" export HOST_CC="C:/Users/ /.mozbuild/clang/bin/clang-cl.exe --driver-mode=cl" export HOST_CXX="C:/Users/ /.mozbuild/clang/bin/clang-cl.exe --driver-mode=cl"
Oh, dang, I should manufacture a final step so it’s How To Speed Up Windows Firefox Builds In Ten Easy Steps (if you have a fast Linux machine and network). Oh well.
Anyhoo, I’m not sure if this is useful to anyone else, but I hope it is. No doubt your setup is less weird than mine somehow so you’ll be better off reading the general docs instead. Happy Firefox developing!
:chutten
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |