Tiryoh / opencv3_setup_scripts_ubuntu

OpenCV3 setup scripts for GNU/Linux Ubuntu
https://memoteki.net/archives/1293
MIT License
4 stars 0 forks source link

CMake Error. #1

Closed ObservedObserver closed 6 years ago

ObservedObserver commented 7 years ago

I successfully install opencv3 with this shell on my laptop, but failed on a web server. It shows:

mkdir: cannot create directory ‘build’: File exists
CMake Error: The source directory "/tmp/opencv3_installer" does not appear to contain CMakeLists.txt.
Tiryoh commented 7 years ago

Hi @ObservedObserver,

Thanks for your feedback!

I think the error mkdir: cannot create directory ‘build’: File exists causes the CMake error. Would you try these commands?

mkdir -p /tmp/opencv3_installer/opencv-3.2.0/build && cd /tmp/opencv3_installer/opencv-3.2.0/build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules  -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_OPENGL=ON ..
make -j4
sudo make install
sudo ldconfig

Please let me know the result of the commands.

ObservedObserver commented 7 years ago

Here is the result:

[ 86%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:4:0,
                 from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /root/opencv3_setup_scripts_ubuntu/opencv/modules/python/src2/cv2.cpp:10:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h:17:5: warning: "NPY_INTERNAL_BUILD" is not defined [-Wundef]
 #if NPY_INTERNAL_BUILD
     ^
[ 86%] Generating pyopencv_generated_include.h, pyopencv_generated_funcs.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_ns_reg.h
[ 86%] Linking CXX executable ../../bin/opencv_traincascade
[ 86%] Built target opencv_traincascade
Scanning dependencies of target cpp-tutorial-pnp_detection
[ 86%] Building CXX object samples/cpp/CMakeFiles/cpp-tutorial-pnp_detection.dir/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp.o
Scanning dependencies of target opencv_python3
[ 86%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
In file included from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarraytypes.h:4:0,
                 from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /root/opencv3_setup_scripts_ubuntu/opencv/modules/python/src2/cv2.cpp:10:
/usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/npy_common.h:17:5: warning: "NPY_INTERNAL_BUILD" is not defined [-Wundef]
 #if NPY_INTERNAL_BUILD
     ^
[ 86%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/parametersController.cpp.o
[ 86%] Building CXX object samples/cpp/CMakeFiles/cpp-tutorial-pnp_detection.dir/tutorial_code/calib3d/real_time_pose_estimation/src/CsvReader.cpp.o
[ 86%] Building CXX object samples/cpp/CMakeFiles/cpp-tutorial-pnp_detection.dir/tutorial_code/calib3d/real_time_pose_estimation/src/CsvWriter.cpp.o
[ 86%] Linking CXX executable ../../bin/opencv_interactive-calibration
[ 86%] Built target opencv_interactive-calibration
Scanning dependencies of target example_connected_components
[ 86%] Building CXX object samples/cpp/CMakeFiles/example_connected_components.dir/connected_components.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
modules/python2/CMakeFiles/opencv_python2.dir/build.make:318: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
CMakeFiles/Makefile2:19897: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I also tried many methods on the internet, but all failed, including jayrambhia/Install-OpenCV

Tiryoh commented 7 years ago

Dear @ObservedObserver,

Hmm...that's strange. Could you tell me more about your server?

It is just a speculation, but maybe your server don't have enough memory. I saw this error when I was building OpenCV2 on my Raspberry Pi.

gcc: internal compiler error: Killed (program cc1)

In that case, you could try make -j2 instead of make -j4.

ObservedObserver commented 7 years ago
# uname -a
Linux iZ2ze3er74mz6wkoqktu5zZ 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

--------------------------
# cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 85
model name  : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
stepping    : 4
microcode   : 0x1
cpu MHz     : 2494.134
cache size  : 33792 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f rdseed adx smap avx512cd xsaveopt xsavec xgetbv1
bugs        :
bogomips    : 4988.26
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:
------------------------
MemTotal:        1016096 kB
MemFree:          723784 kB

I tried make -j2 and make, it got stacked at:

[ 86%] Built target example_optflow_simpleflow_demo
[ 86%] Built target example_optflow_gpc_evaluate
[ 86%] Built target example_optflow_optical_flow_evaluation
[ 86%] Built target example_optflow_dis_opticalflow
[ 86%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
[ 86%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:4:0,
                 from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /root/opencv3_setup_scripts_ubuntu/opencv/modules/python/src2/cv2.cpp:10:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h:17:5: warning: "NPY_INTERNAL_BUILD" is not defined [-Wundef]
 #if NPY_INTERNAL_BUILD
     ^
In file included from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarraytypes.h:4:0,
                 from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /root/opencv3_setup_scripts_ubuntu/opencv/modules/python/src2/cv2.cpp:10:
/usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/npy_common.h:17:5: warning: "NPY_INTERNAL_BUILD" is not defined [-Wundef]
 #if NPY_INTERNAL_BUILD

c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
modules/python3/CMakeFiles/opencv_python3.dir/build.make:318: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 4
CMakeFiles/Makefile2:19992: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Tiryoh commented 7 years ago

@ObservedObserver,

Seems like you still have a memory issue. https://github.com/Valloric/ycmd/issues/224 Could you try make -j1? Is there a swap space (for memory) in your machine?

Tiryoh commented 7 years ago

@ObservedObserver,

I'll close this issue, but please feel free to re-open this issue if you still have some problems.

isaacaddis commented 6 years ago

Same problem here;

[ 85%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
In file included from /home/robotics45c/.virtualenvs/cv/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:4:0,
                 from /home/robotics45c/.virtualenvs/cv/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /home/robotics45c/opencv-3.1.0/modules/python/src2/cv2.cpp:10:
/home/robotics45c/.virtualenvs/cv/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_common.h:17:5: warning: "NPY_INTERNAL_BUILD" is not defined [-Wundef]
 #if NPY_INTERNAL_BUILD
     ^
In file included from /home/robotics45c/opencv_contrib-3.1.0/modules/tracking/include/opencv2/tracking/tracker.hpp:48:0,
                 from /home/robotics45c/opencv-3.1.0/build/modules/python2/pyopencv_generated_include.h:50,
                 from /home/robotics45c/opencv-3.1.0/modules/python/src2/cv2.cpp:12:
/home/robotics45c/opencv_contrib-3.1.0/modules/tracking/include/opencv2/tracking/onlineMIL.hpp:57:23: error: expected unqualified-id before ‘>’ token
 #define  sign(s)  ((s > 0 ) ? 1 : ((s<0) ? -1 : 0))
                       ^
/home/robotics45c/opencv_contrib-3.1.0/modules/tracking/include/opencv2/tracking/onlineMIL.hpp:57:23: error: expected ‘)’ before ‘>’ token
/home/robotics45c/opencv_contrib-3.1.0/modules/tracking/include/opencv2/tracking/onlineMIL.hpp:57:23: error: expected ‘)’ before ‘>’ token
modules/python2/CMakeFiles/opencv_python2.dir/build.make:294: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:20460: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
Tiryoh commented 6 years ago

@isaacaddis, Thanks for the feedback. Could you tell me more about your PC?

Tiryoh commented 6 years ago

@isaacaddis,

I'll close this issue, but please feel free to re-open this issue if you still have some problems.

lucian521 commented 5 years ago

raspberry pi 3b install opencv4.0.0 opencv_contrib4.0.0 , sudo make 86% Building cxx object modules/python2/CMakeFiles/opencv_python2.dir , raspberry pi 3b reboot CPU ARM Cortex-A53 1.2GHz 64-bit quad-core ARMv8 CPU RAM 1GB (LPDDR2) OS Raspbian 32bit

lucian521 commented 5 years ago

processor : 0 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

processor : 1 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

processor : 2 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

processor : 3 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4

Hardware : BCM2835 Revision : a22082 Serial : 000000000250399f

lucian521 commented 5 years ago

Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux

lucian521 commented 5 years ago

pi@raspberrypi:/opt/software/src/opencv/opencv-4.0.0/release $ free total used free shared buff/cache available Mem: 896792 346468 33936 13244 516388 477252 Swap: 102396 4020 98376