Re: [rust-dev] Cargo multiple targets

2014-07-03 Thread Thad Guidry
The links for FAQ and Manifest Format on http://crates.io should be
rearranged to be at the top of the homepage...instead of the bottom, in my
opinion.



On Wed, Jul 2, 2014 at 7:38 AM, Isak Andersson cont...@bitpuffin.com
wrote:

 Hi!

 Wow I didn't know about the manifest page, I was under the impression that
 the docs were very lacking. But this is pretty great.

 Thanks a bunch that was super helpful!


 On Wed, Jul 2, 2014 at 2:09 PM, Vladimir Matveev dpx.infin...@gmail.com
 wrote:

 Hi, Isak!

 According to manifest documentation [1] you can specify crate type
 (dynamic or static lib or rlib) using crate_type option:

 [[lib]]
 …
 crate_type = [dylib, staticlib]

 The above configuration should build you both .a and .so files.

 [1]: http://crates.io/manifest.html, search for crate_type w/o
 quotes

 On 02 июля 2014 г., at 15:58, Isak Andersson cont...@bitpuffin.com
 wrote:

  Hi!
 
  Thanks for the reply!
 
  Apparently multiple targets does in fact work. Just that you can't rely
 on the
  default path anymore, so I had to add the path = ... to both the
 [[lib]] and [[bin]].
  Not sure if this is a bug or not.
 
  However the library compiles as an rlib and I'm not sure how to change
 it to build
  a C library instead (a .a or .so on *nix or .lib I think on windows).
 
  Actually I'm not even sure how to make rustc build a C library so I
 guess that's what
  I will start looking at.
 
 
  On Wed, Jul 2, 2014 at 1:37 PM, Sebastian Gesemann 
 s.gesem...@gmail.com wrote:
  On Wed, Jul 2, 2014 at 12:49 PM, Isak Andersson wrote:
   Hello Rust folks!
  
   I am using Cargo and I am trying to specify mulitple targets in my
   Cargo.toml file.
   First of all is this even possible?
   ...
   [package]
   name = hmproof
   version = 0.1.0
   authors = [ i...@houstonmedia.se ]
   [[bin]]
   name = hmwhoami
   [[lib]]
   name = proof
   (I also tried adding a path)
   path = src/proof.rs
   [dependencies.rust-http]
   git = https://github.com/chris-morgan/rust-http.git;
  
   I also tried putting the [[lib]] part after the dependencies part.
 The error
   I get is this:
   error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no
 such file
   or directory [...]
   Whiich doesn't make any sense at all to me. Why does it suddenly start
   looking in src/bin?
 
  According to http://crates.io/manifest.html the default path for a
  binary is src (if there is no other lib) and src/bin (if there is also
  a lib target). You should be able to override this with path =
  src/hmwhoami.
 
   Do I have to put my bin code in src/bin and my lib code in src lib or
 what?
 
  Currently, only a single lib per package is supported and it seems,
  judging by the document about the manifest format, that Cargo always
  looks for src/lib.rs for a library unless you override this using a
  path=something.
 
  As for how to tell Cargo to invoke rustc with the appropriate -L
  option: I don't know.
 
  HTH,
  sg
  ___
  Rust-dev mailing list
  Rust-dev@mozilla.org
  https://mail.mozilla.org/listinfo/rust-dev
 
  ___
  Rust-dev mailing list
  Rust-dev@mozilla.org
  https://mail.mozilla.org/listinfo/rust-dev



 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev




-- 
-Thad
+ThadGuidry https://www.google.com/+ThadGuidry
Thad on LinkedIn http://www.linkedin.com/in/thadguidry/
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


[rust-dev] Cargo multiple targets

2014-07-02 Thread Isak Andersson
Hello Rust folks!

I am using Cargo and I am trying to specify mulitple targets in my
Cargo.toml file.
First of all is this even possible?

The way I have set things up is that I have src/hmwhoami.rs which builds to
a binary,
and uses src/proof.rs and that builds totally fine.

My Cargo file looks like this:
[package]

name = hmproof
version = 0.1.0
authors = [ i...@houstonmedia.se ]

[[bin]]

name = hmwhoami

[dependencies.rust-http]

git = https://github.com/chris-morgan/rust-http.git;


Now what I also want to do is to build src/proof.rs as a library (that is
linkable with C programs
so they can call the extern fn's). My initial approach was this:

[package]

name = hmproof
version = 0.1.0
authors = [ i...@houstonmedia.se ]

[[bin]]

name = hmwhoami

[[lib]]

name = proof
(I also tried adding a path)
path = src/proof.rs

[dependencies.rust-http]

git = https://github.com/chris-morgan/rust-http.git;

I also tried putting the [[lib]] part after the dependencies part. The
error I get is this:
error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no such file
or directory (No such file or directory); path=src/bin/hmwhoami.rs;
mode=open; access=read)

Whiich doesn't make any sense at all to me. Why does it suddenly start
looking in src/bin?
Do I have to put my bin code in src/bin and my lib code in src lib or what?
That would probably break the hmwhoami executable because I'd have to make
the proof library an extern crate, at least I think I would have to do that.

Thanks!
Isak Andersson
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Cargo multiple targets

2014-07-02 Thread Sebastian Gesemann
On Wed, Jul 2, 2014 at 12:49 PM, Isak Andersson wrote:
 Hello Rust folks!

 I am using Cargo and I am trying to specify mulitple targets in my
 Cargo.toml file.
 First of all is this even possible?
 ...
 [package]
 name = hmproof
 version = 0.1.0
 authors = [ i...@houstonmedia.se ]
 [[bin]]
 name = hmwhoami
 [[lib]]
 name = proof
 (I also tried adding a path)
 path = src/proof.rs
 [dependencies.rust-http]
 git = https://github.com/chris-morgan/rust-http.git;

 I also tried putting the [[lib]] part after the dependencies part. The error
 I get is this:
 error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no such file
 or directory [...]
 Whiich doesn't make any sense at all to me. Why does it suddenly start
 looking in src/bin?

According to http://crates.io/manifest.html the default path for a
binary is src (if there is no other lib) and src/bin (if there is also
a lib target). You should be able to override this with path =
src/hmwhoami.

 Do I have to put my bin code in src/bin and my lib code in src lib or what?

Currently, only a single lib per package is supported and it seems,
judging by the document about the manifest format, that Cargo always
looks for src/lib.rs for a library unless you override this using a
path=something.

As for how to tell Cargo to invoke rustc with the appropriate -L
option: I don't know.

HTH,
sg
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Cargo multiple targets

2014-07-02 Thread Isak Andersson
Hi!

Thanks for the reply!

Apparently multiple targets does in fact work. Just that you can't rely on
the
default path anymore, so I had to add the path = ... to both the [[lib]]
and [[bin]].
Not sure if this is a bug or not.

However the library compiles as an rlib and I'm not sure how to change it
to build
a C library instead (a .a or .so on *nix or .lib I think on windows).

Actually I'm not even sure how to make rustc build a C library so I guess
that's what
I will start looking at.


On Wed, Jul 2, 2014 at 1:37 PM, Sebastian Gesemann s.gesem...@gmail.com
wrote:

 On Wed, Jul 2, 2014 at 12:49 PM, Isak Andersson wrote:
  Hello Rust folks!
 
  I am using Cargo and I am trying to specify mulitple targets in my
  Cargo.toml file.
  First of all is this even possible?
  ...
  [package]
  name = hmproof
  version = 0.1.0
  authors = [ i...@houstonmedia.se ]
  [[bin]]
  name = hmwhoami
  [[lib]]
  name = proof
  (I also tried adding a path)
  path = src/proof.rs
  [dependencies.rust-http]
  git = https://github.com/chris-morgan/rust-http.git;
 
  I also tried putting the [[lib]] part after the dependencies part. The
 error
  I get is this:
  error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no such
 file
  or directory [...]
  Whiich doesn't make any sense at all to me. Why does it suddenly start
  looking in src/bin?

 According to http://crates.io/manifest.html the default path for a
 binary is src (if there is no other lib) and src/bin (if there is also
 a lib target). You should be able to override this with path =
 src/hmwhoami.

  Do I have to put my bin code in src/bin and my lib code in src lib or
 what?

 Currently, only a single lib per package is supported and it seems,
 judging by the document about the manifest format, that Cargo always
 looks for src/lib.rs for a library unless you override this using a
 path=something.

 As for how to tell Cargo to invoke rustc with the appropriate -L
 option: I don't know.

 HTH,
 sg
 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev

___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Cargo multiple targets

2014-07-02 Thread Vladimir Matveev
Hi, Isak!

According to manifest documentation [1] you can specify crate type (dynamic or 
static lib or rlib) using crate_type option:

[[lib]]
…
crate_type = [dylib, staticlib]

The above configuration should build you both .a and .so files.

[1]: http://crates.io/manifest.html, search for crate_type w/o quotes

On 02 июля 2014 г., at 15:58, Isak Andersson cont...@bitpuffin.com wrote:

 Hi!
 
 Thanks for the reply!
 
 Apparently multiple targets does in fact work. Just that you can't rely on the
 default path anymore, so I had to add the path = ... to both the [[lib]] and 
 [[bin]].
 Not sure if this is a bug or not.
 
 However the library compiles as an rlib and I'm not sure how to change it to 
 build
 a C library instead (a .a or .so on *nix or .lib I think on windows).
 
 Actually I'm not even sure how to make rustc build a C library so I guess 
 that's what
 I will start looking at.
 
 
 On Wed, Jul 2, 2014 at 1:37 PM, Sebastian Gesemann s.gesem...@gmail.com 
 wrote:
 On Wed, Jul 2, 2014 at 12:49 PM, Isak Andersson wrote:
  Hello Rust folks!
 
  I am using Cargo and I am trying to specify mulitple targets in my
  Cargo.toml file.
  First of all is this even possible?
  ...
  [package]
  name = hmproof
  version = 0.1.0
  authors = [ i...@houstonmedia.se ]
  [[bin]]
  name = hmwhoami
  [[lib]]
  name = proof
  (I also tried adding a path)
  path = src/proof.rs
  [dependencies.rust-http]
  git = https://github.com/chris-morgan/rust-http.git;
 
  I also tried putting the [[lib]] part after the dependencies part. The error
  I get is this:
  error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no such file
  or directory [...]
  Whiich doesn't make any sense at all to me. Why does it suddenly start
  looking in src/bin?
 
 According to http://crates.io/manifest.html the default path for a
 binary is src (if there is no other lib) and src/bin (if there is also
 a lib target). You should be able to override this with path =
 src/hmwhoami.
 
  Do I have to put my bin code in src/bin and my lib code in src lib or what?
 
 Currently, only a single lib per package is supported and it seems,
 judging by the document about the manifest format, that Cargo always
 looks for src/lib.rs for a library unless you override this using a
 path=something.
 
 As for how to tell Cargo to invoke rustc with the appropriate -L
 option: I don't know.
 
 HTH,
 sg
 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev
 
 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev

___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Cargo multiple targets

2014-07-02 Thread Isak Andersson
Hi!

Wow I didn't know about the manifest page, I was under the impression that
the docs were very lacking. But this is pretty great.

Thanks a bunch that was super helpful!


On Wed, Jul 2, 2014 at 2:09 PM, Vladimir Matveev dpx.infin...@gmail.com
wrote:

 Hi, Isak!

 According to manifest documentation [1] you can specify crate type
 (dynamic or static lib or rlib) using crate_type option:

 [[lib]]
 …
 crate_type = [dylib, staticlib]

 The above configuration should build you both .a and .so files.

 [1]: http://crates.io/manifest.html, search for crate_type w/o
 quotes

 On 02 июля 2014 г., at 15:58, Isak Andersson cont...@bitpuffin.com
 wrote:

  Hi!
 
  Thanks for the reply!
 
  Apparently multiple targets does in fact work. Just that you can't rely
 on the
  default path anymore, so I had to add the path = ... to both the [[lib]]
 and [[bin]].
  Not sure if this is a bug or not.
 
  However the library compiles as an rlib and I'm not sure how to change
 it to build
  a C library instead (a .a or .so on *nix or .lib I think on windows).
 
  Actually I'm not even sure how to make rustc build a C library so I
 guess that's what
  I will start looking at.
 
 
  On Wed, Jul 2, 2014 at 1:37 PM, Sebastian Gesemann s.gesem...@gmail.com
 wrote:
  On Wed, Jul 2, 2014 at 12:49 PM, Isak Andersson wrote:
   Hello Rust folks!
  
   I am using Cargo and I am trying to specify mulitple targets in my
   Cargo.toml file.
   First of all is this even possible?
   ...
   [package]
   name = hmproof
   version = 0.1.0
   authors = [ i...@houstonmedia.se ]
   [[bin]]
   name = hmwhoami
   [[lib]]
   name = proof
   (I also tried adding a path)
   path = src/proof.rs
   [dependencies.rust-http]
   git = https://github.com/chris-morgan/rust-http.git;
  
   I also tried putting the [[lib]] part after the dependencies part. The
 error
   I get is this:
   error: couldn't read src/bin/hmwhoami.rs: couldn't open file (no such
 file
   or directory [...]
   Whiich doesn't make any sense at all to me. Why does it suddenly start
   looking in src/bin?
 
  According to http://crates.io/manifest.html the default path for a
  binary is src (if there is no other lib) and src/bin (if there is also
  a lib target). You should be able to override this with path =
  src/hmwhoami.
 
   Do I have to put my bin code in src/bin and my lib code in src lib or
 what?
 
  Currently, only a single lib per package is supported and it seems,
  judging by the document about the manifest format, that Cargo always
  looks for src/lib.rs for a library unless you override this using a
  path=something.
 
  As for how to tell Cargo to invoke rustc with the appropriate -L
  option: I don't know.
 
  HTH,
  sg
  ___
  Rust-dev mailing list
  Rust-dev@mozilla.org
  https://mail.mozilla.org/listinfo/rust-dev
 
  ___
  Rust-dev mailing list
  Rust-dev@mozilla.org
  https://mail.mozilla.org/listinfo/rust-dev


___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev