seL4 / seL4-CAmkES-L4v-dockerfiles

Dockerfiles defining the dependencies required to build seL4, CAmkES, and L4v.
12 stars 39 forks source link

Issues with nanopb Python package import #74

Closed Ivan-Velickovic closed 5 months ago

Ivan-Velickovic commented 5 months ago

I was building sel4bench and was getting compile errors due to extra GCC warnings, so I thought I'd use the compiler in the Docker container just to check that it works in there since an older compiler is used.

I did:

../init-build.sh -DPLATFORM=tx2 -DVCPU=1

and got the following output:

ivanv@in-container:/host/tx2_vcpu_container$ ../init-build.sh -DPLATFORM=tx2 -DVCPU=1
loading initial cache file /host/projects/sel4bench/settings.cmake
-- Set platform details from PLATFORM=tx2
--   KernelPlatform: tx2
-- Found seL4: /host/kernel  
-- platform tx2 supports multiple architectures, none was given
--   defaulting to: aarch64
-- Found GCC with prefix aarch64-linux-gnu-
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/aarch64-linux-gnu-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found elfloader-tool: /host/tools/seL4/elfloader-tool  
-- /host/tx2_vcpu_container/kernel/gen_headers/plat/machine/devices_gen.h is out of date. Regenerating from DTB...
WARNING:root:Only mapping 4096/16777216 bytes from node /iommu@12000000, region 0. Set kernel_size in YAML to silence.
-- CPIO test cpio_reproducible_flag PASSED
-- Found musllibc: /host/projects/musllibc  
-- Found util_libs: /host/projects/util_libs  
-- Found seL4_libs: /host/projects/seL4_libs  
-- Found sel4_projects_libs: /host/projects/sel4_projects_libs  
-- Found projects_libs: /host/projects/projects_libs  
-- Found sel4runtime: /host/projects/sel4runtime  
-- Performing Test compiler_arch_test
-- Performing Test compiler_arch_test - Success
-- libmuslc architecture: 'aarch64' (from KernelSel4Arch 'aarch64')
-- Detecting cached version of: musllibc
-- Found Git: /usr/bin/git (found version "2.30.2") 
--   Found valid cache entry for musllibc
-- Found Nanopb: /host/nanopb  
-- Configuring done
-- Generating done
-- Build files have been written to: /host/tx2_vcpu_container
ivanv@in-container:/host/tx2_vcpu_container$ ninja
[210/303] Running C++ protocol buffer compiler using nanopb plugin on /host/projects/sel4_projects_libs/libsel4rpc/rpc.proto
FAILED: apps/sel4bench/sel4_projects_libs/libsel4rpc/rpc.pb.c apps/sel4bench/sel4_projects_libs/libsel4rpc/rpc.pb.h 
cd /host/tx2_vcpu_container/apps/sel4bench/sel4_projects_libs/libsel4rpc && /usr/bin/protoc -I/host/tx2_vcpu_container/nanopb/generator -I/host/tx2_vcpu_container/nanopb/generator/proto -I/host/tx2_vcpu_container/apps/sel4bench/sel4_projects_libs/libsel4rpc -I/host/projects/sel4_projects_libs/libsel4rpc --plugin=protoc-gen-nanopb=/host/tx2_vcpu_container/nanopb/generator/protoc-gen-nanopb --nanopb_out=:/host/tx2_vcpu_container/apps/sel4bench/sel4_projects_libs/libsel4rpc /host/projects/sel4_projects_libs/libsel4rpc/rpc.proto
Traceback (most recent call last):
  File "/host/tx2_vcpu_container/nanopb/generator/nanopb_generator.py", line 51, 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 "/host/tx2_vcpu_container/nanopb/generator/nanopb_generator.py", line 72, in <module>
    import proto.nanopb_pb2 as nanopb_pb2
  File "/host/tx2_vcpu_container/nanopb/generator/proto/nanopb_pb2.py", line 8, in <module>
    from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/lib/python3/dist-packages/google/protobuf/internal/__init__.py)
--nanopb_out: protoc-gen-nanopb: Plugin failed with status code 1.
[211/303] Building C object kernel/CMakeFiles/kernel.elf.dir/kernel_all.c.obj
ninja: build stopped: subcommand failed.
Ivan-Velickovic commented 5 months ago

Doesn't happen on a fresh checkout of sel4bench, must be some cache from builds outside of Docker or something leaking in? I don't know.

lsf37 commented 5 months ago

Doesn't happen on a fresh checkout of sel4bench, must be some cache from builds outside of Docker or something leaking in? I don't know.

That would make sense (left-overs in the build from work outside the container)

lsf37 commented 5 months ago

sel4bench as such builds regularly in the docker container (this is what CI uses)

Ivan-Velickovic commented 5 months ago

It was a different build directory, which I would expect to work. Anyways, I guess this kind of thing is outside of the scope of Docker.