Onnx-tensorrt: NO target "protobuf::protoc"error in cmake onnx

Created on 30 Jan 2019  ·  10Comments  ·  Source: onnx/onnx-tensorrt

-- The CXX compiler identification is GNU 5.4.0
-- The C compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "9.0")
-- Found Protobuf: /home/gaeiauto8/.conda/envs/pytorch1.0/lib/libprotobuf.so;-lpthread (found version "3.5.1")
-- Build type not set - defaulting to Release
--
-- ******** Summary********
--   CMake version         : 3.9.1
--   CMake command         : /usr/local/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 5.4.0
--   CXX flags             :  -Wall -Wnon-virtual-dtor
--   Build type            : Release
--   Compile definitions   : ONNX_NAMESPACE=onnx2trt_onnx
--   CMAKE_PREFIX_PATH     : /home/gaeiauto8/.conda/envs/pytorch1.0/
--   CMAKE_INSTALL_PREFIX  : /usr/local
--   CMAKE_MODULE_PATH     :
--
--   ONNX version          : 1.3.0
--   ONNX NAMESPACE        : onnx2trt_onnx
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
--
--   Protobuf compiler     : /home/gaeiauto8/.conda/envs/pytorch1.0/bin/protoc
--   Protobuf includes     : /home/gaeiauto8/.conda/envs/pytorch1.0/include
--   Protobuf libraries    : /home/gaeiauto8/.conda/envs/pytorch1.0/lib/libprotobuf.so;-lpthread
--   BUILD_ONNX_PYTHON     : OFF
-- Found CUDNN: /usr/local/cuda/include
-- Found TensorRT headers at /usr/include/x86_64-linux-gnu
-- Find TensorRT libs at /usr/lib/x86_64-linux-gnu/libnvinfer.so;/usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so
-- Found TENSORRT: /usr/include/x86_64-linux-gnu
-- Configuring done

CMake Error at third_party/onnx/CMakeLists.txt:233 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

  No target "protobuf::protoc"
Call Stack (most recent call first):
  third_party/onnx/CMakeLists.txt:257 (relative_protobuf_generate_cpp)
......

thanks for any suggestions!

triaged

Most helpful comment

I have the same problem too ;-)

i fix it with sudo apt install protobuf-compiler

All 10 comments

I have the same problem ;-)

I have the same problem too ;-)

I have the same problem too ;-)

i fix it with sudo apt install protobuf-compiler

May be you can modify the third_party CMakelists, I have solved it~

I got the same problem on Ubuntu 18.04 LTS, and found this is because my protobuf from apt is too old (v3.0.0). Compiling it from source turns out solving the problem:

sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make -j8
make check
sudo make install
sudo ldconfig

@grapeot thanks that compiled protoc for me. Additionally I had to change the PATH variable to protoc location (I had /usr/local/bin) because anaconda's protoc came first

@anuar12,I have the same situation as you and i am a newcomer in DL, Can you tell how to do it?Hope for your reply,tkx.

I got the same problem on Ubuntu 18.04 LTS, and found this is because my protobuf from apt is too old (v3.0.0). Compiling it from source turns out solving the problem:

sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make -j8
make check
sudo make install
sudo ldconfig

This fixed the issue for me. +1

I have the same problem too ;-)

i fix it with sudo apt install protobuf-compiler

thanks,it works!

Closing this issue as it seems to have been resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qigtang picture qigtang  ·  8Comments

bpinaya picture bpinaya  ·  6Comments

andrew-yang0722 picture andrew-yang0722  ·  3Comments

felixplum picture felixplum  ·  7Comments

basaltzhang picture basaltzhang  ·  5Comments