Okay slight annoyance:

I'm compiling a component (shells_lain_commands_dirname) which uses
the contracts/command/default.nix contract:

{stdenv, buildFractalideContract, upkeepers
  , tuple
  , ...}:

buildFractalideContract rec {
  src = ./.;
  contract = ''
  @0xdfa17455eb3bee21;

    using Tuple = import "${tuple}/src/contract.capnp";

    struct Command {
      name @0 : Text;
      singles @1 : List(Text);
      kvs @2 : List(Tuple.Tuple);
    }
  '';
}

when I compile the shells_lain_commands_dirname I get this error:

[stewart@rivergod:~/dev/fractalide/fractalide]$ nix-build  --argstr
debug true --argstr cache $(./support/buildCache.sh)  -I
nixpkgs=/home/stewart/dev/fractalide/nixpkgs/  --argstr test true
--argstr subnet shells_lain_commands_dirname

...

*********************************************************************
****** building: shells_lain_commands_dirname
*********************************************************************
Running cargo build
   Compiling byteorder v0.4.2 (registry file:///dev/null)
   Compiling lazy_static v0.2.1 (registry file:///dev/null)
   Compiling threadpool v1.3.2 (registry file:///dev/null)
   Compiling dtoa v0.2.2 (registry file:///dev/null)
   Compiling serde v0.8.4 (registry file:///dev/null)
   Compiling num-traits v0.1.35 (registry file:///dev/null)
   Compiling itoa v0.1.1 (registry file:///dev/null)
   Compiling capnp v0.7.3 (registry file:///dev/null)
   Compiling capnpc v0.7.2 (registry file:///dev/null)
   Compiling serde_json v0.8.1 (registry file:///dev/null)
   Compiling target_build_utils v0.1.1 (registry file:///dev/null)
   Compiling libloading v0.2.4 (registry file:///dev/null)
   Compiling rustfbp v0.3.17 (registry file:///dev/null)
   Compiling component v0.1.0
(file:///tmp/nix-build-shells_lain_commands_dirname.drv-0/dirname)
src/command.rs:73:59: 73:91 error: failed to resolve. Could not find
`tuple` in `contract_capnp` [E0433]
src/command.rs:73     pub fn get_kvs(self) ->
Result<struct_list::Reader<'a,::contract_capnp::tuple::Owned<>>> {

     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<rustfbp macros>:21:5: 21:68 note: in this expansion of include!
src/lib.rs:6:1: 39:2 note: in this expansion of component! (defined in
<rustfbp macros>)
src/command.rs:73:59: 73:91 help: run `rustc --explain E0433` to see a
detailed explanation
src/command.rs:167:60: 167:92 error: failed to resolve. Could not find
`tuple` in `contract_capnp` [E0433]
src/command.rs:167     pub fn get_kvs(self) ->
Result<struct_list::Builder<'a,::contract_capnp::tuple::Owned<>>> {

       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<rustfbp macros>:21:5: 21:68 note: in this expansion of include!
src/lib.rs:6:1: 39:2 note: in this expansion of component! (defined in
<rustfbp macros>)
src/command.rs:167:60: 167:92 help: run `rustc --explain E0433` to see
a detailed explanation
src/command.rs:171:62: 171:94 error: failed to resolve. Could not find
`tuple` in `contract_capnp` [E0433]
src/command.rs:171     pub fn set_kvs(&mut self, value :
struct_list::Reader<'a,::contract_capnp::tuple::Owned<>>) ->
Result<()> {

         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<rustfbp macros>:21:5: 21:68 note: in this expansion of include!
src/lib.rs:6:1: 39:2 note: in this expansion of component! (defined in
<rustfbp macros>)
src/command.rs:171:62: 171:94 help: run `rustc --explain E0433` to see
a detailed explanation
src/command.rs:175:66: 175:98 error: failed to resolve. Could not find
`tuple` in `contract_capnp` [E0433]
src/command.rs:175     pub fn init_kvs(self, size : u32) ->
struct_list::Builder<'a,::contract_capnp::tuple::Owned<>> {

             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<rustfbp macros>:21:5: 21:68 note: in this expansion of include!
src/lib.rs:6:1: 39:2 note: in this expansion of component! (defined in
<rustfbp macros>)
src/command.rs:175:66: 175:98 help: run `rustc --explain E0433` to see
a detailed explanation
src/lib.rs:20:23: 20:47 error: the type of this value must be known in
this context
src/lib.rs:20             for kv in reader.get_kvs()?.iter() {
                                    ^~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:6:1: 39:2 note: in this expansion of component! (defined in
<rustfbp macros>)
error: aborting due to previous error
error: Could not compile `component`.

To learn more, run the command again with --verbose.
builder for 
‘/nix/store/aklg8g1g98pjxp1fc8xvi7ysh8izan61-shells_lain_commands_dirname.drv’
failed with exit code 101
cannot build derivation
‘/nix/store/grl1bxmnmp44y1kzdh55f73p8irv1x9f-shells_lain_commands_dirname.drv’:
1 dependencies couldn't be built
error: build of
‘/nix/store/grl1bxmnmp44y1kzdh55f73p8irv1x9f-shells_lain_commands_dirname.drv’
failed

*****************

but as soon as I remove the import from contracts/command/default.nix

{stdenv, buildFractalideContract, upkeepers
  , ...}:

buildFractalideContract rec {
  src = ./.;
  contract = ''
  @0xdfa17455eb3bee21;

    struct Tuple {
      first @0 : Text;
      second @1 : Text;
    }

    struct Command {
      name @0 : Text;
      singles @1 : List(Text);
      kvs @2 : List(Tuple);
    }
  '';
}

The program compiles perfectly well:

[stewart@rivergod:~/dev/fractalide/fractalide]$ nix-build  --argstr
debug true --argstr cache $(./support/buildCache.sh)  -I
nixpkgs=/home/stewart/dev/fractalide/nixpkgs/  --argstr test true
--argstr subnet shells_lain_commands_dirname
/nix/store/g62lg838n9sdhcl7qpi0yq311srmdaqc-shells_lain_commands_dirname

This is what shells_lain_commands_dirname looks like atm:

#![feature(question_mark)]
#[macro_use]
extern crate rustfbp;
extern crate capnp;

component! {
    shells_lain_commands_dirname, contracts(generic_text, command)
    inputs(stdin: generic_text),
    inputs_array(),
    outputs(stdout: generic_text),
    outputs_array(),
    option(command),
    acc(),
    fn run(&mut self) -> Result<()> {
        let mut opt = self.recv_option();
        {
            let reader: command::Reader = opt.get_root()?;
            let name = reader.get_name();
            println!("the name: {}", name?);
            for kv in reader.get_kvs()?.iter() {
                let first = kv.get_first();
                let second = kv.get_second();
                println!("first: {}, second: {}", first?, second?);
            }
            for single in reader.get_singles()?.iter() {
                println!("arg: {}", single?);
            }
        }
        let mut ip_a = try!(self.ports.recv("stdin"));
        {
            let a_reader: generic_text::Reader = try!(ip_a.get_root());
            let a = a_reader.get_text();

            println!("{}", a?);
        }
        self.ports.send("stdout", ip_a);
        Ok(())
    }
}

Please advise.

kr/sjm

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to