Cadence,

If the library's main source file is in src/pcre/lib.rs and the the demo
application's main source file is in src/pcredemo/main.rs, then I believe
that executing "rustpkg install pcre" and then "rustpkg install pcrememo"
will build and install the library and executable into the "lib" and "bin"
directories, respectively.

>From within src/pcredemo/main.rs, you should be able to write "extern mod
pcre" and everything will be found correctly.

I wrote a very small Rust tcp server to figure this out for myself which
also consists of a workspace with multiple packages. You may find it useful
as an example for managing the rustpkg layout:
https://github.com/hakuch/LampShade (assuming that I'm following the
recommended conventions correctly).
--
Jesse


On Thu, Oct 3, 2013 at 12:31 PM, Corey Richardson <[email protected]> wrote:

> It looks like you setup your workspace wrong. A quick fix is:
>
>     cd ~/.rust; rustpkg init; cd src; mkdir -p
> github.com/cadencemarseille; cd github.com/cadencemarseille; git clone
> https://github.com/cadencemarseille/rust-pcre.git; rustpkg build
> rust-pcre;
>
>
>
> On Thu, Oct 3, 2013 at 8:32 AM, Cadence Marseille
> <[email protected]> wrote:
> > Hello,
> >
> > I just switched over the rust-pcre project's directory structure to a
> > rustpkg workspace (as documented at
> > http://static.rust-lang.org/doc/master/rustpkg.html).  Now I am trying
> to
> > run a simple Rust program using the pcre module, but I am experiencing
> some
> > trouble.
> >
> > Both:
> >
> > extern mod pcre;
> >
> > and:
> >
> > extern mod pcre = "github.com/cadencemarseille/rust-pcre";
> >
> > result in the error message:
> > error: can't find crate for `pcre`
> >
> > To compile, I need to supply an -L flag to the full rustpkg library
> output
> > folder like so:
> >
> > rustc -L ~/.rust/pcre/lib/x86_64-apple-darwin -o pcredemo~ pcredemo.rs
> >
> > How do I set up my local dev env so that this "just works"?
> >
> > Cadence
> >
> > _______________________________________________
> > Rust-dev mailing list
> > [email protected]
> > https://mail.mozilla.org/listinfo/rust-dev
> >
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to