GobySoft / dccl

Dynamic Compact Control Language
Other
17 stars 13 forks source link

Questions about Python example #74

Closed danieleades closed 2 years ago

danieleades commented 2 years ago

I'm just getting started following the example in https://libdccl.org/, and I had a couple of questions I was hoping to get some help with.

I've pushed my example project to https://github.com/danieleades/dccl-example for reference. The steps I've followed are in the README in the project root. I'm using Poetry for managing Python packages.

Some questions-

  1. The example in https://libdccl.org/ says to build the C++ project (./build.sh) first, and then build the Python package (cd python && python setup.py build). I'm finding that the python project fails to build since it can't find the dccl header files. I can get this to work by installing the C++ project first (cd build && sudo make install). This step isn't in the instructions, and isn't super portable. Is there a way around this?
  2. The example python code adds references to the header files again-
    
    import os, dccl, navreport_pb2

dccl.addProtoIncludePath(os.path.abspath(".")) dccl.addProtoIncludePath(os.path.abspath("/path/to/dccl/include"))

dccl.loadProtoFile(os.path.abspath("./navreport.proto"))

codec = dccl.Codec() codec.load("NavigationReport")

...



It seems counterintuitive that references to `ProtoIncludePath` are needed at both compile time *and* at runtime. What's the technical reason for this? I've noticed that this example works perfectly fine if both these lines are commented out. When are they required?

Thanks!
tsaubergine commented 2 years ago

@chrismurf Any thoughts on this?

danieleades commented 2 years ago

thanks. the built python wheel contains shared libs and header files for dccl, so it would seem a bit circular to also have to include system-installed header files.

tsaubergine commented 2 years ago

This has been fixed in 3.0 and 4.0