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
  • It still isn't fixed on my system with SDK 3.0.0, out the box on macOS.

    The issue now stems from the way the terminal profile is being set up by the nRF Connect VS Code extension.

    My PATH is normally <list of paths> after opening a normal macOS terminal. When opening a normal VS Code terminal PATH contains duplicates, but if I set "terminal.integrated.inheritEnv": false it doesn't. But either way, after opening an NCS terminal profile, PATH has been set to <list of paths>:<toolchain dirs>:<list of paths>. For some reason the paths are duplicated and the toolchain dirs are not at the front.

    Running PATH=/opt/nordic/ncs/toolchains/ef4fc6722e/opt/bin:$PATH works around it.

Children
No Data
Related