ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

Symbol name conflict in pnnx

Open JeremyRand opened this issue 2 years ago • 2 comments

error log | 日志或报错信息 | ログ

$ cd tools/pnnx
$ mkdir build
$ cd build

$ cmake ..
CMake Warning (dev) at CMakeLists.txt:7 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - 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/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find protobuf (missing: protobuf_DIR)
-- Found Protobuf: /usr/lib/powerpc64le-linux-gnu/libprotobuf.so (found version "3.21.12") 
-- Found Python3: /bedrock/cross/pin/bin/python3 (found version "3.11.2") found components: Interpreter Development Development.Module Development.Embed 
-- Found Python3: /bedrock/cross/pin/bin/python3 (found version "3.11.2") found components: Interpreter 
-- Checking for PyTorch using /bedrock/cross/pin/bin/python3 ...
-- Found PyTorch installation at /usr/lib/python3/dist-packages/torch/share/cmake
-- Found Threads: TRUE  
-- Caffe2: Found gflags with new-style gflags target.
-- Caffe2: Found glog with new-style glog target.
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 3.21.12
-- Found Torch: /usr/lib/powerpc64le-linux-gnu/libtorch.so  
-- Torch_VERSION = 1.13.0
-- Torch_VERSION_MAJOR = 1
-- Torch_VERSION_MINOR = 13
-- Torch_VERSION_PATCH = 0
CMake Warning at CMakeLists.txt:82 (message):
  Building without TorchVision


-- Building with onnx-zero
-- Configuring done (7.4s)
-- Generating done (0.2s)
-- Build files have been written to: 

$ ./src/pnnx --help
[libprotobuf ERROR google/protobuf/descriptor_database.cc:669] Symbol name "onnx.AttributeProto" conflicts with the existing symbol "onnx.AttributeProto".
[libprotobuf FATAL google/protobuf/descriptor.cc:1988] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
Aborted

context | 编译/运行环境 | バックグラウンド

It looks like this Stack Overflow question might be relevant?

how to reproduce | 复现步骤 | 再現方法

Built pnnx from ncnn commit hash c41aa2fdfdeb80753b02b0ce80b8a0271d49fe1e on Debian Bookworm ppc64le, with Debian's PyTorch package.

more | 其他 | その他

Not sure what might be special about my setup that would cause this, let me know if there's anything I can do to extract more useful logs.

JeremyRand avatar Dec 21 '23 04:12 JeremyRand

Temporary solution: comment out the protobuf content in pnnx CMakeLists so that it does not compile onnx-zero support

https://github.com/Tencent/ncnn/blob/d30af29ee2540eb80d878ff7df6841a7379713cd/tools/pnnx/CMakeLists.txt#L42-L55

nihui avatar Dec 21 '23 06:12 nihui

Thanks, that seems to work OK as a workaround until it's fixed properly.

JeremyRand avatar Dec 21 '23 20:12 JeremyRand