Skip to content

Instantly share code, notes, and snippets.

@jethrogb
Created January 13, 2015 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethrogb/72e1325b8b63cd072cd6 to your computer and use it in GitHub Desktop.
Save jethrogb/72e1325b8b63cd072cd6 to your computer and use it in GitHub Desktop.
Script to build librustc only
#!/bin/bash
# Just rebuild librustc and friends from the rust source.
# This probably works as long as you use the same source tree your binaries
# were built from and you don't modify anything outside of src/librustc*
echo If rustc fails with '"multiple dylib candidates for `rustc_...` found"' you
echo should move away '"librustc_llvm-*.so"' from the '"candidate #1"' directory.
echo
# Grab these from `make -pn`
export CFG_FILENAME_EXTRA=4e7c5e5c
export CFG_BOOTSTRAP_KEY=242588639
export CFG_COMPILER_HOST_TRIPLE=x86_64-unknown-linux-gnu
export CFG_LIBDIR_RELATIVE=lib
export CFG_PREFIX=/usr/local
export CFG_RELEASE=1.0.0-dev
export CFG_RELEASE_CHANNEL=dev
export CFG_RELEASE_NUM=1.0.0
export CFG_VERSION=1.0.0-dev
ln -sf /usr/lib/rust/rust-nightly/lib/librustc_back-$CFG_FILENAME_EXTRA.so
ln -sf /usr/lib/rust/rust-nightly/lib/librustc_llvm-$CFG_FILENAME_EXTRA.so
rustclib()
{
echo rustc -L. -O -A unstable ${CFG_FILENAME_EXTRA:+-C extra-filename=-$CFG_FILENAME_EXTRA} $1/lib.rs
rustc -L. -O -A unstable ${CFG_FILENAME_EXTRA:+-C extra-filename=-$CFG_FILENAME_EXTRA} $1/lib.rs
echo done $1
}
rustclib librustc
rustclib librustc_borrowck &
rustclib librustc_trans &
rustclib librustc_resolve &
rustclib librustc_typeck &
wait
rustclib librustc_driver
echo rustc -L. -O -A unstable --cfg rustc -o rustc driver/driver.rs
rustc -L. -O -A unstable --cfg rustc -o rustc driver/driver.rs
echo done rustc
echo
echo Run with:
echo LD_LIBRARY_PATH=$(pwd) $(pwd)/rustc -L$(rustc --print sysroot)/lib/rustlib/$CFG_COMPILER_HOST_TRIPLE/lib/
@jethrogb
Copy link
Author

This would probably work better with rust-lang/rust#16402 fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment