pfnet-research / menoh

Menoh: fast DNN inference library with multiple programming language support
MIT License
279 stars 34 forks source link

`No target "protobuf::protoc"` error with CMake 3.9.2 #152

Closed msakai closed 6 years ago

msakai commented 6 years ago

I encountered No target "protobuf::protoc" error with CMake 3.9.2. This also prevents us to build Menoh on Travis-CI Trusty environment.

$ PATH=/home/sakai/cmake-3.9.2-Linux-x86_64/bin:/home/sakai/local/bin:$PATH cmake .. -DCMAKE_PREFIX_PATH=/home/sakai/local -DENABLE_TEST=OFF -DENABLE_BENCHMARK=OFF -DENABLE_EXAMPLE=OFF -DMKLDNN_INCLUDE_DIR=/home/sakai/local/include -DMKLDNN_LIBRARY=/home/sakai/local/lib/libmkldnn.so.0.16.0
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- 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
-- 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
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- Build type: Release
-- 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 Protobuf: /home/sakai/local/lib/libprotobuf.so;-lpthread (found version "3.6.1") 
-- Found Protobuf: /home/sakai/local/lib/libprotobuf.so;-lpthread;-lpthread (found version "3.6.1") 
-- Adding external/onnx
-- Patching to external/onnx
-- 
-- ******** Summary ********
--   CMake version         : 3.9.2
--   CMake command         : /home/sakai/cmake-3.9.2-Linux-x86_64/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 5.4.0
--   CXX flags             : 
--   Build type            : Release
--   Compile definitions   : 
--   CMAKE_PREFIX_PATH     : /home/sakai/local
--   CMAKE_INSTALL_PREFIX  : /usr/local
--   CMAKE_MODULE_PATH     : /home/sakai/menoh/cmake
-- 
--   ONNX version          : 1.2.2
--   ONNX NAMESPACE        : onnx
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
-- 
--   Protobuf compiler     : /home/sakai/local/bin/protoc
--   Protobuf includes     : /home/sakai/local/include
--   Protobuf libraries    : /home/sakai/local/lib/libprotobuf.so;-lpthread;-lpthread
--   BUILD_ONNX_PYTHON     : OFF
-- Found MKLDNN: /home/sakai/local/lib/libmkldnn.so.0.16.0 (Required is at least version "0.14") 
-- Adding menoh
-- Adding include
-- Configuring done
CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

CMake Error at external/onnx/CMakeLists.txt:232 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:protobuf::protoc>

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

-- Generating done
-- Build files have been written to: /home/sakai/menoh/build
msakai commented 6 years ago

@okapies, do you have any ideas?

okapies commented 6 years ago

It seems that FindProtobuf in v3.9.2 does not set protobuf::protoc (it is supported from v3.10). It is strange because ONNX's cmake states that its minimum requirement is v3.1. I remember that ONNX itself can be built by v3.5.1.