Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustpkg needs to support building multiple interdependent crates #5808

Closed
mzabaluev opened this issue Apr 9, 2013 · 10 comments
Closed

Rustpkg needs to support building multiple interdependent crates #5808

mzabaluev opened this issue Apr 9, 2013 · 10 comments

Comments

@mzabaluev
Copy link
Contributor

To truly support building packages containing multiple crates, rustpkg should have a way to link the constituent crates against one another as they are being built. A branch of my pet project captures what I was trying to do with a pkg.rs.

@ghost ghost assigned catamorphism Apr 9, 2013
@catamorphism
Copy link
Contributor

Perhaps I'm misunderstanding, but as long as there are no cyclic dependencies between the crates, you should be able to just sequentially build and install each crate. Rust doesn't allow cyclic dependencies between crates.

@catamorphism
Copy link
Contributor

(This may be different from what I said the other day -- I think I didn't get it the first time you asked this question.)

@mzabaluev
Copy link
Contributor Author

No, there are no cyclic dependencies.

This is what happens when building my pkg.rs from mzabaluev/rust@7ec07e5:

note: compiling /home/mzabaluev/work/open/grust/grust/grust.rc
note: compiling /home/mzabaluev/work/open/grust/glib.rc
/home/mzabaluev/work/open/grust/glib.rc:26:0: 26:44 error: can't find crate for `grust`
/home/mzabaluev/work/open/grust/glib.rc:26 extern mod grust (name="grust", vers="0.1");
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@jbclements
Copy link
Contributor

Forgive me if this is obvious, but have you used a "-L" directive to tell rust where to find the compiled crate? I believe rust's usage follows the lead of most C linkers, here.

@mzabaluev
Copy link
Contributor Author

Forgive me if this is obvious, but have you used a "-L" directive to tell rust where to find the compiled crate?

What directive? I couldn't find it documented anywhere. Grepping "-L" through Rust source does not reveal anything relevant either.

@huonw
Copy link
Member

huonw commented Apr 12, 2013

@mzabaluev, it's described in rustc --help: -L PATH Add a directory to the library search path.

@mzabaluev
Copy link
Contributor Author

A more specific question would be: is there a way to pass linker flags in the context of pkg.rs and/or crate files?

@catamorphism
Copy link
Contributor

@mzabaluev I understand what the problem is now. I think with rustpkg we'll want to make it so that you don't need to specify -L flags explicitly, at least not for system libraries. See #5219 , for example.

@mzabaluev
Copy link
Contributor Author

It could be as simple as:

#[pkg_crate(file = "foo/foo.rc")];
#[pkg_crate(file = "bar/bar.rc")];
#[pkg_crate(file = "baz.rc",
                    link_opts(dir = "foo", dir = "bar"))];
                    // a rustc command line equivalent is -L foo -L bar

@catamorphism
Copy link
Contributor

I'm looking over the rustpkg bugs and I think #5681 covers this. Comment if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants