{"action":"created","issue":{"url":"https://api.github.com/repos/opencv/opencv/issues/12429","repository_url":"https://api.github.com/repos/opencv/opencv","labels_url":"https://api.github.com/repos/opencv/opencv/issues/12429/labels{/name}","comments_url":"https://api.github.com/repos/opencv/opencv/issues/12429/comments","events_url":"https://api.github.com/repos/opencv/opencv/issues/12429/events","html_url":"https://github.com/opencv/opencv/issues/12429","id":357210223,"node_id":"MDU6SXNzdWUzNTcyMTAyMjM=","number":12429,"title":"Compile OpenCV 3.4.3 with pre-compiled Protobuf in user-defined folder","user":{"login":"Paperone80","id":26833332,"node_id":"MDQ6VXNlcjI2ODMzMzMy","avatar_url":"https://avatars1.githubusercontent.com/u/26833332?v=4","gravatar_id":"","url":"https://api.github.com/users/Paperone80","html_url":"https://github.com/Paperone80","followers_url":"https://api.github.com/users/Paperone80/followers","following_url":"https://api.github.com/users/Paperone80/following{/other_user}","gists_url":"https://api.github.com/users/Paperone80/gists{/gist_id}","starred_url":"https://api.github.com/users/Paperone80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Paperone80/subscriptions","organizations_url":"https://api.github.com/users/Paperone80/orgs","repos_url":"https://api.github.com/users/Paperone80/repos","events_url":"https://api.github.com/users/Paperone80/events{/privacy}","received_events_url":"https://api.github.com/users/Paperone80/received_events","type":"User","site_admin":false},"labels":[{"id":241025032,"node_id":"MDU6TGFiZWwyNDEwMjUwMzI=","url":"https://api.github.com/repos/opencv/opencv/labels/category:%20build/install","name":"category: build/install","color":"ededed","default":false},{"id":635087908,"node_id":"MDU6TGFiZWw2MzUwODc5MDg=","url":"https://api.github.com/repos/opencv/opencv/labels/category:%20dnn","name":"category: dnn","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-05T12:41:11Z","updated_at":"2018-09-05T14:16:46Z","closed_at":null,"author_association":"NONE","body":"##### System information (version)\r\n- OpenCV => 3.4.3\r\n- Operating System / Platform => RHEL 7.5\r\n- Compiler => GCC 4.8.5\r\n\r\n##### Detailed description\r\nHi, I've been trying for days now to compile OpenCV 3.4.3 with: \r\n```\r\n-DWITH_CUDA=ON\r\n-DBUILD_opencv_dnn=ON \r\n```\r\nIt worked when I had Protobuf 3.5.1 (only 3.5.1 worked) compiled separately into in /usr/local/{bin|lib|include} and run opencv cmake3 with the following settings:\r\n\r\n```\r\ncmake3 \\\r\n-DCMAKE_BUILD_TYPE=RELEASE \\\r\n-DCMAKE_INSTALL_PREFIX=/opt/opencv/opencv_3.4.3/build \\\r\n-DBUILD_PNG=ON -DBUILD_JPEG=ON -DBUILD_TIFF=ON -DBUILD_FFMPEG=ON -DBUILD_OPENVX=ON -DBUILD_JINJA2=ON -DBUILD_JASPER=ON -DBUILD_OPENEXR=ON -DBUILD_ZLIB=ON -DBUILD_TBB=ON \\\r\n-DBUILD_opencv_gpu=ON \\\r\n-DWITH_CUDA=ON -DCUDA_NVCC_FLAGS=\"-ccbin /usr/bin/gcc -D_FORCE_INLINES --expt-relaxed-constexpr -std=c++11\" \\\r\n-DCUDA_ARCH_BIN=\"3.5, 3.7, 5.0, 5.2, 6.0, 6.1\" \\\r\n-DWITH_EIGEN=ON -DWITH_TBB=ON \\\r\n-DWITH_1394=OFF \\\r\n-DWITH_CUBLAS=ON \\\r\n-DWITH_GDCM=ON \\\r\n-DWITH_GTK_2_X=ON \\\r\n-DBUILD_OPENCV_PYTHON2=ON \\\r\n-DPYTHON2_EXECUTABLE=/opt/intel/intelpython27/bin/python2.7 \\\r\n-DPYTHON2_INCLUDE_DIR=/opt/intel/intelpython27/include/python2.7 \\\r\n-DPYTHON2_LIBRARY=/opt/intel/intelpython27/lib/python2.7 \\\r\n-DPYTHON2_PACKAGES_PATH=/opt/intel/intelpython27/lib/python2.7/site-packages \\\r\n-DPYTHON2_NUMPY_INCLDUE_DIRS=/opt/intel/intelpython27/lib/python2.7/site-packages/numpy/core/include \\\r\n-DINSTALL_PYTHON_EXAMPLES=ON \\\r\n-DBUILD_EXAMPLES=OFF \\\r\n-DINSTALL_C_EXAMPLES=OFF \\\r\n-DWITH_OPENGL=ON \\\r\n-DWITH_OPENCL=ON \\\r\n-DPYTHON3_EXECUTABLE=/opt/intel/intelpython35/bin/python3.5 \\\r\n-DPYTHON3_INCLUDE_DIR=/opt/intel/intelpython35/include/python3.5m \\\r\n-DPYTHON3_LIBRARY=/opt/intel/intelpython35/lib \\\r\n-DPYTHON3_PACKAGES_PATH=/opt/intel/intelpython35/lib/python3.5/site-packages \\\r\n-DPYTHON3_NUMPY_INCLDUE_DIRS=/opt/intel/intelpython35/lib/python3.5/site-packages/numpy/core/include \\\r\n-DCMAKE_C_COMPILER=/usr/bin/gcc \\\r\n-DCMAKE_CXX_COMPILER=/usr/bin/g++ \\\r\n-DCMAKE_CPP_COMPILER=/usr/bin/cpp \\\r\n-DWITH_VTK=OFF \\\r\n-DENABLE_FAST_MATH=1 \\\r\n-DCUDA_FAST_MATH=1 \\\r\n-DENABLE_PRECOMPILED_HEADERS=OFF \\\r\n-DBUILD_PERF_TESTS=OFF \\\r\n-DCUDA_HOST_COMPILER:FILEPATH=/usr/bin/gcc \\\r\n-ENABLE_CXX11=ON \\\r\n-DBUILD_opencv_dnn=ON \\\r\n-DWITH_PROTOBUF=ON \\\r\n-DBUILD_PROTOBUF=OFF \\\r\n-DPROTOBUF_UPDATE_FILES=OFF \\\r\n-BUILD_LIBPROTOBUF_FROM_SOURCES=OFF ..\r\n```\r\n\r\n<!-- your description -->\r\n\r\n##### Steps to reproduce\r\nHowever, I had to downgrade from Protobuf 3.6.1 to 3.5.1 in my /usr/local/ folder. I am trying to point to the folder outside /usr/local/ where Protobuf 3.5.1 is compiled into\r\n`/opt/protobuf-runtime/protobuf-3.5.1_build/{bin|include|lib}`. \r\n\r\nI checked CMakeCache.txt and CMakeVars.txt to find protobuf related entries. \r\n\r\nTo cmake3, II added the following to:\r\n```\r\n-DENABLE_PRECOMPILED_HEADERS=ON \\\r\n-DPROTOBUF_INCLUDE_DIR=/opt/protobuf-runtime/protobuf-3.5.1_build/include \\\r\n-DPROTOBUF_INCLUDE_DIRS=/opt/protobuf-runtime/protobuf-3.5.1_build/include \\\r\n-DPROTOBUF_LIBRARIES='/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotobuf.so;-lpthread' \\\r\n-DPROTOBUF_LIBRARY=/opt/protobuf-runtime/protobuf-3.5.1_build/libprotobuf.so \\\r\n-DPROTOBUF_LIBRARY_DEBUG=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotobuf.so \\\r\n-DPROTOBUF_LITE_LIBRARIES=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotobuf-lite.so \\\r\n-DPROTOBUF_LITE_LIBRARY=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotobuf-lite.so \\\r\n-DPROTOBUF_LITE_LIBRARY_DEBUG=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotobuf-lite.so \\\r\n-DPROTOBUF_PROTOC_EXECUTABLE=/opt/protobuf-runtime/protobuf-3.5.1_build/bin/protoc \\\r\n-DPROTOBUF_PROTOC_LIBRARIES=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotoc.so \\\r\n-DPROTOBUF_PROTOC_LIBRARY=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotoc.so \\\r\n-DPROTOBUF_PROTOC_LIBRARY_DEBUG=/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotoc.so \\\r\n```\r\n\r\nI also tried changing the following line in CMakeVars.txt & CMakeVars.txt:\r\n`OPENCV_MODULE_opencv_dnn_LINK_DEPS:INTERNAL=';libprotobuf;/usr/local/lib/libopenblas.so' \r\n`\r\nto\r\n`OPENCV_MODULE_opencv_dnn_LINK_DEPS:INTERNAL=';/opt/protobuf-runtime/protobuf-3.5.1_build/lib/libprotobuf.so;/usr/local/lib/libopenblas.so' \r\n`\r\n\r\nProblem is back that I get the following errors again due to Protobuf 3.6.1 in /usr/local:\r\n```\r\n[ 40%] Building CXX object modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/utils.cpp.o\r\nIn file included from /usr/include/c++/4.8.2/mutex:35:0,\r\n                 from /usr/local/include/google/protobuf/stubs/mutex.h:33,\r\n                 from /usr/local/include/google/protobuf/stubs/common.h:52,\r\n                 from /opt/opencv/opencv-3.4.3-test/modules/dnn/misc/tensorflow/attr_value.pb.h:9,\r\n                 from /opt/opencv/opencv-3.4.3-test/modules/dnn/misc/tensorflow/attr_value.pb.cc:4:\r\n/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.\r\n #error This file requires compiler and library support for the \\\r\n  ^\r\nIn file included from /opt/opencv/opencv-3.4.3-test/modules/dnn/misc/tensorflow/attr_value.pb.cc:4:0:\r\n/opt/opencv/opencv-3.4.3-test/modules/dnn/misc/tensorflow/attr_value.pb.h:17:2: error: #error This file was generated by an older version of protoc which is\r\n #error This file was generated by an older version of protoc which is\r\n  ^\r\n/opt/opencv/opencv-3.4.3-test/modules/dnn/misc/tensorflow/attr_value.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please\r\n #error incompatible with your Protocol Buffer headers.  Please\r\n  ^\r\n/opt/opencv/opencv-3.4.3-test/modules/dnn/misc/tensorflow/attr_value.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.\r\n #error regenerate this file with a newer version of protoc.\r\n```\r\n\r\nSomehow somewhere it is still trying to use Protobuf in /usr/local/*.\r\n```\r\n[...]\r\nfrom /usr/local/include/google/protobuf/stubs/mutex.h:33,\r\nfrom /usr/local/include/google/protobuf/stubs/common.h:52,\r\n[...]\r\n```\r\nAny help much appreciated towards the right cmake settings. Thanks in advance.\r\n"},"comment":{"url":"https://api.github.com/repos/opencv/opencv/issues/comments/418747327","html_url":"https://github.com/opencv/opencv/issues/12429#issuecomment-418747327","issue_url":"https://api.github.com/repos/opencv/opencv/issues/12429","id":418747327,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODc0NzMyNw==","user":{"login":"alalek","id":4981219,"node_id":"MDQ6VXNlcjQ5ODEyMTk=","avatar_url":"https://avatars0.githubusercontent.com/u/4981219?v=4","gravatar_id":"","url":"https://api.github.com/users/alalek","html_url":"https://github.com/alalek","followers_url":"https://api.github.com/users/alalek/followers","following_url":"https://api.github.com/users/alalek/following{/other_user}","gists_url":"https://api.github.com/users/alalek/gists{/gist_id}","starred_url":"https://api.github.com/users/alalek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alalek/subscriptions","organizations_url":"https://api.github.com/users/alalek/orgs","repos_url":"https://api.github.com/users/alalek/repos","events_url":"https://api.github.com/users/alalek/events{/privacy}","received_events_url":"https://api.github.com/users/alalek/received_events","type":"User","site_admin":false},"created_at":"2018-09-05T14:16:46Z","updated_at":"2018-09-05T14:16:46Z","author_association":"CONTRIBUTOR","body":"Message says that C++11 compilation mode is required.\r\n\r\nCMake options are incorrect:\r\n\r\n```.diff\r\n-    -ENABLE_CXX11=ON\r\n+    -DENABLE_CXX11=ON\r\n```\r\n\r\nand below one more"}}
{"actor":{"display_login":"alalek"}}