Problem specifying output directory

261 views
Skip to first unread message

allpow...@gmail.com

unread,
Sep 9, 2013, 10:24:13 PM9/9/13
to capn...@googlegroups.com
Hi,

I'm testing out capnproto 0.3.0 (looks awesome!), but I'm having trouble getting the -oc++:<directory> syntax to work.

If I run:

capnp compile -oc++ Test.capnp

I get Test.capnp.c++ and Test.capnp.h in the current directory.  However, if I run:

mkdir -p build/capnp/ && capnp compile -oc++:build/capnp/ Test.capnp

I get nothing, either in the current directory or the 'test' directory.

Looking at the code, (capnpc-c++.c++:1654), I wonder how it would respect the directory parameter.  Is this a known issue?  Ideas?

Thanks,
Joshua

Kenton Varda

unread,
Sep 9, 2013, 11:28:36 PM9/9/13
to allpow...@gmail.com, capnproto
Hi Joshua,

This seems to work for me:

$ ls build/capnp
ls: cannot access build/capnp: No such file or directory
$ mkdir -p build/capnp/ && capnp compile -oc++:build/capnp/ Test.capnp
$ ls build/capnp
Test.capnp.c++  Test.capnp.h
$ capnp --version
Cap'n Proto version 0.3.0
$

Are you sure you're looking in the right place?  You mention a "test" directory, but nothing in your example seems to mention a directory with this name.

You don't see this handled in capnpc-c++.c++ because the compiler actually changes the working directory before invoking the plugin.

-Kenton

--
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 capnproto+...@googlegroups.com.
Visit this group at http://groups.google.com/group/capnproto.

Nathan Yospe

unread,
Aug 11, 2014, 11:59:24 PM8/11/14
to capn...@googlegroups.com, allpow...@gmail.com
I found a scenario this doesn't work.

If Test.capnp is not local to the build directive, and specified with an absolute path it appears to chdir into the location of Test.capnp after the chdir into the output directory.

$ ls build/capnp
ls: cannot access build/capnp: No such file or directory
$ mkdir -p build/capnp/ && capnp compile -oc++:build/capnp/ /home/self/project/src/Test.capnp
$ ls build/capnp
$ ls /home/self/project/src/
Test.capnp Test.capnp.c++ Test.capnp.h
$ capnp --version
Cap'n Proto version 0.4.1
$

Kenton Varda

unread,
Aug 12, 2014, 12:05:32 AM8/12/14
to Nathan Yospe, capnproto, Joshua Warner
Hi Nathan,

This is half a bug in Cap'n Proto and half a problem with your flags.

When using an absolute path, you definitely need to use --src-prefix to tell the compiler what directory it should treat as the "root" of your source tree, for the purpose of generating output file names. This prefix will be stripped off of your file names for output purposes.

The bug in capnpc is that we don't print an error when an absolute path is given with no --src-prefix. We probably should, as it seems unlikely that anyone would actually expect or want the behavior you're seeing.

-Kenton

--
Sandstorm.io is crowdfunding! http://igg.me/at/sandstorm

Nathan Yospe

unread,
Aug 12, 2014, 12:10:38 AM8/12/14
to capn...@googlegroups.com, nyo...@gmail.com, allpow...@gmail.com
Hi Kenton,

Thanks for the exceptionally fast reply. Yes, that was my mistake. While the option was described in the help message, I assumed it was mostly for the purpose of specifying parallel subpaths, and didn't realize that absolute paths were unsupported.
Reply all
Reply to author
Forward
0 new messages