Hello,

I've been trying to see if a tool like tup [1] could be used to build rust 
crates and executables.  In order for this to be useful I would like to compile 
.rs files individually to .o files and then link them together into their 
enclosing executable (or library).  My initial (perhaps incorrect) impression 
is that currently rustc requires that all .rs files must be compiled in a 
single command.

I've been able to generate the .o file using rustc -c, but I haven't been able 
to determine the correct link command.  I ran into some symbol conflicts (I 
think related to more_stack) and also was unsure the correct libraries to use.  
Given that the library names are hashed, it seems difficult to build a 
traditional link rule.

(rustc commands that produced library' with hashed names are also an issue for 
tup, but it may be possible to enhance it to support this case.  Currently tup 
requires deterministic outputs from commands.)

Can anyone give me any pointers where to look for linking information?  Would 
it be possible/acceptable to add a --link option to rustc to perform the link 
or output correct link flags?

One of my motivations for looking at this was the long build times required to 
compile larger crates.  For example, if you touch a single file in libstd then 
rustc currently has to rebuild the entire crate which takes 45 seconds on my 
laptop:

[xykon-2:~/devel/git/rust] bkelly% time x86_64-apple-darwin/stage2/bin/rustc 
--cfg stage2 -O --target=x86_64-apple-darwin -o 
x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd.dylib 
/Users/bkelly/devel/git/rust/src/libstd/std.rc && touch 
x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib/libstd.dylib
warning: no debug symbols in executable (-arch x86_64)
43.953u 0.674s 0:45.82 97.3%    0+0k 0+8io 691pf+0w

Thanks!

Ben

[1]: http://gittup.org/tup/
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to