nanopb compilation doesn't work

I am using zephyr_nanopb_sources to add some protobuf files to my app target, and this works fine in a normal build without mcuboot. However, when building with mcuboot it doesn't work. Here is the error I get:

Failed to import nanopb_pb2.py: type object 'FileOptions' has no attribute 'RegisterExtension'
Will automatically attempt to rebuild this.
Verify that python-protobuf and protoc versions match.
Using grpcio-tools protoc from /opt/nordic/ncs/toolchains/15b490767d/lib/python3.12/site-packages/grpc_tools/protoc.py
protoc builtin include path: ['/Users/nick/Documents/Repos/AirTurnWearable/application/build_rel_nrf52dk/application/src/proto/nanopb/generator/proto', '/opt/nordic/ncs/toolchains/15b490767d/lib/python3.12/site-packages/grpc_tools/_proto']
Python version 3.12.4 (main, Jun  7 2024, 04:28:19) [Clang 14.0.0 (clang-1400.0.29.202)]
Using python-protobuf from /opt/nordic/ncs/toolchains/15b490767d/lib/python3.12/site-packages/google/protobuf/__init__.py
Python-protobuf version: 5.27.1

This appears to be related to this issue: https://github.com/zephyrproject-rtos/zephyr/issues/72265

What's strange is that running the command that fails from a nRF toolchain terminal succeeds. So it appears something about the mcuboot build environment is causing the failure.

I'm using toolchain and SDK 2.8.0

Parents Reply
  • I looked at those, they were the same. So I deleted all _release suffix files in the board configuration directory, and it still didn't build. So I removed all .obj, .a, .h files from the debug build dir, then compared the two build dirs. I saw that the release build CMakeCache.txt file was missing 

    //No help, variable specified on the command line.
    NCS_TOOLCHAIN_VERSION:UNINITIALIZED=NONE

    I added that, and it built... And now when I remove it, it is immediately added back again when building. I have no idea how to break it again. I will keep going, hopefully this works well enough now. I'll mark as resolved in a few days if so.

Children
Related