Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build with a custom libstd?

Tags:

rust

I want to make some changes in libstd and then test them with a toy program. It looks like I can build libstd.so by going to rust/src/libstd and doing a (nightly) cargo build. Once I've done that, how do I get a toy program to build with that libstd instead of the regular version installed on my system?

like image 911
Jack O'Connor Avatar asked Aug 22 '16 18:08

Jack O'Connor


1 Answers

There are two possibilities in my mind.

Build the compiler from source everytime

  1. Download the Rust source
  2. Make your changes to std
  3. Follow the steps for building from source

Pass an option to rustc that modifies it search path

  1. Run rustc --help
  2. The first two options (--cfg SPEC or -L [KIND=]PATH) are probably were you would point rustc to your version of the std.

I am not very sure how this would work. Ideally someone more knowledgeable could answer this part, because I think it is the preferred solution and way easier.

like image 84
adrian Avatar answered Oct 11 '22 12:10

adrian