Page MenuHomePhabricator

protobuf is missing from nanapob python dependencies.
Closed, ResolvedPublic

Description

The nanopb requirements file (external/nanopb/requirements.txt) does not captures an exact version of the "protobuf" package. As a result newer version may get installed (i.e. 3.15.6) which makes the build fail.

A fix is needed which adds:
protobuf==3.15.2 .

Example build error:

Traceback (most recent call last):
  File "/home/vagrant/src/trusted-services/tools/b-test/build-crypto-optee-arm/_deps/nanopb-src/generator/nanopb_generator.py", line 50, in <module>
    from .proto import nanopb_pb2
ImportError: attempted relative import with no known parent package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vagrant/src/trusted-services/tools/b-test/build-crypto-optee-arm/_deps/nanopb-src/generator/protoc", line 6, in <module>
    from nanopb_generator import invoke_protoc
  File "/home/vagrant/src/trusted-services/tools/b-test/build-crypto-optee-arm/_deps/nanopb-src/generator/nanopb_generator.py", line 71, in <module>
    import proto.nanopb_pb2 as nanopb_pb2
  File "/home/vagrant/src/trusted-services/tools/b-test/build-crypto-optee-arm/_deps/nanopb-src/generator/proto/nanopb_pb2.py", line 9, in <module>
    from google.protobuf import symbol_database as _symbol_database
  File "/home/vagrant/ts-venv/lib/python3.6/site-packages/google/protobuf/symbol_database.py", line 189, in <module>
    _DEFAULT = SymbolDatabase(pool=descriptor_pool.Default())
AttributeError: module 'google.protobuf.descriptor_pool' has no attribute 'Default'
CMakeFiles/generate_nanopb_pb2.py.dir/build.make:79: recipe for target 'nanopb_pb2.py' failed
make[2]: *** [nanopb_pb2.py] Error 1
CMakeFiles/Makefile2:96: recipe for target 'CMakeFiles/generate_nanopb_pb2.py.dir/all' failed
make[1]: *** [CMakeFiles/generate_nanopb_pb2.py.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
make: *** [all] Error 2