Open rido-min opened 1 year ago
Not a bug - C instructions on the command sample need to be followed before running the sample: https://github.com/Azure-Samples/MqttApplicationSamples/tree/main/scenarios/command#c
To generate the c files to handle the protobuf payload, install protobuf-c-compiler and libprotobuf-dev. Note that you only need these to generate the files, running the sample only requires the libprotobuf-c-dev package.
sudo apt-get install protobuf-c-compiler libprotobuf-dev
Then, to generate the files, run:
# from the root folder
protoc-c --c_out=./scenarios/command/c/protobuf --proto_path=./scenarios/command/c/protobuf unlock_command.proto google/protobuf/timestamp.proto
well, this happens to me when opening the repo in VSCode (with codespaces), before even reading the READMEs.
Can we update devContainer with the apt-get packages ?
wondering if CMake allows to add a pre-build task to invoke proto automagically
Customers will need to read the readme's to set up all of their environment variables anyways before running it, so I don't think it's an issue for them to need to read things there before running the samples.
We could update the devContainer (the postCreateCommand.sh) to install those packages - I think we had decided before not to since they're only needed on the C command sample and only for the single time they generate the files, but I'm not opposed to adding them for ease of use in codespaces.
We wouldn't want cmake to invoke the proto creation automatically because it doesn't need to be done every build, but we could have the generation happen in postCreateCommand.sh script if you'd prefer (similar to the cert generation)! Again, this adds more steps to this script that are specific to only the C Command sample, but it would make this compile right after the initialization.
agree.. this is a side effect of VSCode trying to setup everything when opening the folder.. sigh..
we are already installing C-only-dependencies in the postCreateCommand, such as ninja, and lib-dev, so I dont see any issue adding more dependencies.
Is there a way to tell CMake to generate the files only if those are not there? worst case, generating always does not seem too bad.. I would not generate those in postCreateCommand though.
I don't think there's a way to generate it in cmake, and the customer should be aware of the step since they might need to generate more or different files if they're using a different protobuf payload
This issue is for a: (mark with an
x
)Minimal steps to reproduce
Any log messages given by the failure
Expected/desired behavior
The sample builds successfully
Language
OS and Version?
Mention any other details that might be useful
Other targets build correctly