menoh icon indicating copy to clipboard operation
menoh copied to clipboard

make install fails for static library build

Open msakai opened this issue 6 years ago • 1 comments

If -DBUILD_SHARED_LIBS=OFF is specified, make install fails with following error:

$ cmake .. -DBUILD_SHARED_LIBS=OFF -DENABLE_TEST=OFF -DENABLE_EXAMPLE=ON && make
-- The C compiler identification is AppleClang 10.0.0.10001044
-- The CXX compiler identification is AppleClang 10.0.0.10001044
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/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 - found
-- Found Threads: TRUE  
-- Found Protobuf: /usr/local/lib/libprotobuf.dylib (found version "3.6.1") 
-- Found Git: /usr/bin/git (found version "2.17.2 (Apple Git-113)") 
-- Adding external/onnx
fatal: /Users/sakai/menoh/external/onnx: '/Users/sakai/menoh/external/onnx' is outside repository
-- 
-- ******** Summary ********
--   CMake version         : 3.12.4
--   CMake command         : /usr/local/Cellar/cmake/3.12.4/bin/cmake
--   System                : Darwin
--   C++ compiler          : /Library/Developer/CommandLineTools/usr/bin/c++
--   C++ compiler version  : 10.0.0.10001044
--   CXX flags             :  -Wnon-virtual-dtor
--   Build type            : Release
--   Compile definitions   : 
--   CMAKE_PREFIX_PATH     : 
--   CMAKE_INSTALL_PREFIX  : /usr/local
--   CMAKE_MODULE_PATH     : /Users/sakai/menoh/cmake
-- 
--   ONNX version          : 1.4.1
--   ONNX NAMESPACE        : menoh_onnx
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
-- 
--   Protobuf compiler     : /usr/local/bin/protoc
--   Protobuf includes     : /usr/local/include
--   Protobuf libraries    : /usr/local/lib/libprotobuf.dylib
--   BUILD_ONNX_PYTHON     : OFF
-- Adding benchmark
-- Adding example
-- Found OpenCV: /usr/local (found version "3.4.3") 
-- Adding menoh
-- Found MKLDNN: /usr/local/lib/libmkldnn.dylib (Required is at least version "0.14") 
-- Adding include
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sakai/menoh/build
Scanning dependencies of target gen_onnx_proto
[  1%] Running gen_proto.py on onnx/onnx.in.proto
Processing /Users/sakai/menoh/external/onnx/onnx/onnx.in.proto
Writing /Users/sakai/menoh/build/external/onnx/onnx/onnx_menoh_onnx.proto
Writing /Users/sakai/menoh/build/external/onnx/onnx/onnx_menoh_onnx.proto3
Writing /Users/sakai/menoh/build/external/onnx/onnx/onnx.pb.h
generating /Users/sakai/menoh/build/external/onnx/onnx/onnx_pb.py
..(snip)..
bash-3.2$ make install
[  2%] Built target gen_onnx_proto
[ 35%] Built target menoh_objlib
[ 44%] Built target onnx_proto
[ 88%] Built target onnx
[ 89%] Built target menoh
[ 91%] Built target vgg16_benchmark
[ 94%] Built target general_cnn_example_in_cpp
[ 96%] Built target mkldnn_vgg16_example_in_cpp
[ 98%] Built target mkldnn_vgg16_example_in_c
[100%] Built target menoh_test_target
Install the project...
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:36 (file):
  file INSTALL cannot find "/Users/sakai/menoh/MENOH_ONNX_LIB-NOTFOUND".


make: *** [install] Error 1

I think this is because libmenoh_onnx.a and libmenoh_onnx_proto.a are not built yet when find_library is executed.

https://github.com/pfnet-research/menoh/blob/d07eebbe5e53329c0b210dcc89a714524e988b37/CMakeLists.txt#L104-L115

msakai avatar Feb 07 '19 04:02 msakai

I see. I'll try to modify.

okdshin avatar Feb 07 '19 04:02 okdshin