Ask Your Question

Revision history [back]

Fail to manually build opencv4.1.0 on centos6

I want to generate libopencv_java410.so for my project.

I reference to this link: https://docs.opencv.org/4.1.0/d7/d9f/tutorial_linux_install.html .

After I execute 'cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=OFF ..', it seems ok.

And then I execute 'make', things go wrong on libprotobuf. The command line errors are:

Scanning dependencies of target libprotobuf
[ 23%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.o
[ 23%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arenastring.cc.o
[ 23%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/extension_set.cc.o
In file included from /home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/repeated_field.h:62,
                 from /home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/extension_set.h:51,
                 from /home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/extension_set.cc:38:
/home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/message_lite.h:116: error: expected ‘;’ before ‘const’
/home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/message_lite.h:120: error: expected ‘;’ before ‘T’
/home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/message_lite.h: In function ‘const std::string& google::protobuf::internal::GetEmptyStringAlreadyInited()’:
/home/meicheng/tools/opencv-4.1.0/3rdparty/protobuf/src/google/protobuf/message_lite.h:139: error: ‘class google::protobuf::internal::ExplicitlyConstructed<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >’ has no member named ‘get’

I wonder why this happens. My cmake version is 3.14.3. My gcc version is 4.4.6 Thanks in advance.