COMPILE OPENCV 3.1 AND PYTHON 2.7 WITH CUDA
ref:http://rolflussi.blogspot.co.id/2015/09/opencv-with-cuda-on-ubuntu-1404.html
1. Create a new virtualenv with python parameter point to python2.7.
|
1 2 3 4 5 6 7 8 9 10 |
teddy@teddy-K43SJ:~$ mkvirtualenv --python=python2.7 opencv_p27_cuda Running virtualenv with interpreter /usr/bin/python2.7 New python executable in /home/teddy/.virtualenvs/opencv_p27_cuda/bin/python2.7 Also creating executable in /home/teddy/.virtualenvs/opencv_p27_cuda/bin/python Installing setuptools, pip, wheel...done. virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27_cuda/bin/predeactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27_cuda/bin/postdeactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27_cuda/bin/preactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27_cuda/bin/postactivate virtualenvwrapper.user_scripts creating /home/teddy/.virtualenvs/opencv_p27_cuda/bin/get_env_details |
2. Check python version:
|
1 2 3 4 5 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> quit() |
3. Check pip version:
|
1 2 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~$ pip -V pip 8.1.1 from /home/teddy/.virtualenvs/opencv_p27_cuda/local/lib/python2.7/site-packages (python 2.7) |
4. Install numpy:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~$ pip install numpy Collecting numpy /home/teddy/.virtualenvs/opencv_p27_cuda/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /home/teddy/.virtualenvs/opencv_p27_cuda/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading numpy-1.11.0.tar.gz (4.2MB) 100% |████████████████████████████████| 4.2MB 199kB/s Building wheels for collected packages: numpy Running setup.py bdist_wheel for numpy ... done Stored in directory: /home/teddy/.cache/pip/wheels/dc/c6/37/0a82876d354006c8bfec830bffcb455215968d8e3c22b9e155 Successfully built numpy Installing collected packages: numpy Successfully installed numpy-1.11.0 |
CHECK numpy VERSION:
|
1 2 3 4 5 6 7 8 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> np.__version__ '1.11.0' >>> quit() |
IMPORTANT: I FOUND AN ERROR ‘The data should normally be NULL! in function allocate’ WHEN TRY TO TEST SIFT Holography Feature Matching (flann.knnMatch). PLS FIX THIS FIRST (SEE SOLUTION IN /media/data/MASTER/opencv/github_list_fish_rec.txt) BEFORE BUILD OPENCV AT STEP #5 BELOW! — OKAY. THIS IS ALREADY FIXED ON THE LAST COMPILE (OPENCV 3.1 WITH PYTHON 2.7)
5. We already cloned opencv 3.1.0 and opencv_contrib 3.1.0. so now, go to the build WITH CUDA and do setup:
<OLD>
THIS IS THE INITIAL CMAKE COMMAND: (DONT USE IT!)
|
1 2 3 4 5 6 |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON .. |
</OLD>
<OLD>
THIS IS THE CMAKE COMMAND WITH CUDA I GOT FROM http://rolflussi.blogspot.co.id/2015/09/opencv-with-cuda-on-ubuntu-1404.html: (DONT USE IT! ‘WITH_QT’ COMMAND GAVE ME AN ERROR! MAY BE I DONT HAVE QT INSTALLED)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=ON \ -D BUILD_NEW_PYTHON_SUPPORT=ON \ -D WITH_V4L=ON \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON \ -D WITH_QT=ON \ -D WITH_OPENGL=ON \ -D ENABLE_FAST_MATH=1 \ -D CUDA_FAST_MATH=1 \ -D WITH_CUBLAS=1 .. |
THIS IS THE ERROR:
|
1 2 3 4 5 6 7 8 9 |
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory CMake Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:1386 (message): Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x Call Stack (most recent call first): cmake/OpenCVFindLibsGUI.cmake:34 (find_package) CMakeLists.txt:535 (include) -- Configuring incomplete, errors occurred! See also "/home/teddy/opencv/build/CMakeFiles/CMakeOutput.log". See also "/home/teddy/opencv/build/CMakeFiles/CMakeError.log". |
</OLD>
<NEW>
THIS IS THE CMAKE COMMAND WITH CUDA AND REMOVE ‘WITH_QT’ COMMAND. THIS IS WORK!!! BUT MAKE SURE ‘build’ directory EMPTY FIRST!
NOTE: I USE ‘INSTALL_C_EXAMPLES=ON’ INSTEAD OF ‘OFF’ LIKE PREVIOUS BUILD. LET ME KNOW IF EVERYTHING WORKS (ITS CONFIRMED!!!)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=ON \ -D BUILD_NEW_PYTHON_SUPPORT=ON \ -D WITH_V4L=ON \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON \ -D WITH_OPENGL=ON \ -D ENABLE_FAST_MATH=1 \ -D CUDA_FAST_MATH=1 \ -D WITH_CUBLAS=1 .. |
</NEW>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~$ cd opencv/ (opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv$ mkdir build (opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv$ cd build (opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv/build$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D BUILD_EXAMPLES=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 .. -- The CXX compiler identification is GNU 4.8.4 -- The C compiler identification is GNU 4.8.4 -- 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 -- 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 -- Detected version of GNU GCC: 48 (408) -- Performing Test HAVE_CXX_FSIGNED_CHAR -- Performing Test HAVE_CXX_FSIGNED_CHAR - Success -- Performing Test HAVE_C_FSIGNED_CHAR -- Performing Test HAVE_C_FSIGNED_CHAR - Success -- Performing Test HAVE_CXX_W -- Performing Test HAVE_CXX_W - Success -- Performing Test HAVE_C_W -- Performing Test HAVE_C_W - Success -- Performing Test HAVE_CXX_WALL -- Performing Test HAVE_CXX_WALL - Success -- Performing Test HAVE_C_WALL -- Performing Test HAVE_C_WALL - Success -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success -- Performing Test HAVE_C_WERROR_RETURN_TYPE -- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_CXX_WERROR_ADDRESS -- Performing Test HAVE_CXX_WERROR_ADDRESS - Success -- Performing Test HAVE_C_WERROR_ADDRESS -- Performing Test HAVE_C_WERROR_ADDRESS - Success -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success -- Performing Test HAVE_CXX_WFORMAT -- Performing Test HAVE_CXX_WFORMAT - Success -- Performing Test HAVE_C_WFORMAT -- Performing Test HAVE_C_WFORMAT - Success -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success -- Performing Test HAVE_C_WMISSING_DECLARATIONS -- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed -- Performing Test HAVE_C_WMISSING_PROTOTYPES -- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed -- Performing Test HAVE_C_WSTRICT_PROTOTYPES -- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success -- Performing Test HAVE_CXX_WUNDEF -- Performing Test HAVE_CXX_WUNDEF - Success -- Performing Test HAVE_C_WUNDEF -- Performing Test HAVE_C_WUNDEF - Success -- Performing Test HAVE_CXX_WINIT_SELF -- Performing Test HAVE_CXX_WINIT_SELF - Success -- Performing Test HAVE_C_WINIT_SELF -- Performing Test HAVE_C_WINIT_SELF - Success -- Performing Test HAVE_CXX_WPOINTER_ARITH -- Performing Test HAVE_CXX_WPOINTER_ARITH - Success -- Performing Test HAVE_C_WPOINTER_ARITH -- Performing Test HAVE_C_WPOINTER_ARITH - Success -- Performing Test HAVE_CXX_WSHADOW -- Performing Test HAVE_CXX_WSHADOW - Success -- Performing Test HAVE_C_WSHADOW -- Performing Test HAVE_C_WSHADOW - Success -- Performing Test HAVE_CXX_WSIGN_PROMO -- Performing Test HAVE_CXX_WSIGN_PROMO - Success -- Performing Test HAVE_C_WSIGN_PROMO -- Performing Test HAVE_C_WSIGN_PROMO - Failed -- Performing Test HAVE_CXX_WNO_NARROWING -- Performing Test HAVE_CXX_WNO_NARROWING - Success -- Performing Test HAVE_C_WNO_NARROWING -- Performing Test HAVE_C_WNO_NARROWING - Success -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success -- Performing Test HAVE_CXX_WNO_LONG_LONG -- Performing Test HAVE_CXX_WNO_LONG_LONG - Success -- Performing Test HAVE_C_WNO_LONG_LONG -- Performing Test HAVE_C_WNO_LONG_LONG - Success -- Performing Test HAVE_CXX_PTHREAD -- Performing Test HAVE_CXX_PTHREAD - Success -- Performing Test HAVE_C_PTHREAD -- Performing Test HAVE_C_PTHREAD - Success -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER - Success -- Performing Test HAVE_C_FOMIT_FRAME_POINTER -- Performing Test HAVE_C_FOMIT_FRAME_POINTER - Success -- Performing Test HAVE_CXX_FFAST_MATH -- Performing Test HAVE_CXX_FFAST_MATH - Success -- Performing Test HAVE_C_FFAST_MATH -- Performing Test HAVE_C_FFAST_MATH - Success -- Performing Test HAVE_CXX_MSSE -- Performing Test HAVE_CXX_MSSE - Success -- Performing Test HAVE_C_MSSE -- Performing Test HAVE_C_MSSE - Success -- Performing Test HAVE_CXX_MSSE2 -- Performing Test HAVE_CXX_MSSE2 - Success -- Performing Test HAVE_C_MSSE2 -- Performing Test HAVE_C_MSSE2 - Success -- Performing Test HAVE_CXX_MNO_AVX -- Performing Test HAVE_CXX_MNO_AVX - Success -- Performing Test HAVE_C_MNO_AVX -- Performing Test HAVE_C_MNO_AVX - Success -- Performing Test HAVE_CXX_MSSE3 -- Performing Test HAVE_CXX_MSSE3 - Success -- Performing Test HAVE_C_MSSE3 -- Performing Test HAVE_C_MSSE3 - Success -- Performing Test HAVE_CXX_MNO_SSSE3 -- Performing Test HAVE_CXX_MNO_SSSE3 - Success -- Performing Test HAVE_C_MNO_SSSE3 -- Performing Test HAVE_C_MNO_SSSE3 - Success -- Performing Test HAVE_CXX_MNO_SSE4_1 -- Performing Test HAVE_CXX_MNO_SSE4_1 - Success -- Performing Test HAVE_C_MNO_SSE4_1 -- Performing Test HAVE_C_MNO_SSE4_1 - Success -- Performing Test HAVE_CXX_MNO_SSE4_2 -- Performing Test HAVE_CXX_MNO_SSE4_2 - Success -- Performing Test HAVE_C_MNO_SSE4_2 -- Performing Test HAVE_C_MNO_SSE4_2 - Success -- Performing Test HAVE_CXX_FFUNCTION_SECTIONS -- Performing Test HAVE_CXX_FFUNCTION_SECTIONS - Success -- Performing Test HAVE_C_FFUNCTION_SECTIONS -- Performing Test HAVE_C_FFUNCTION_SECTIONS - Success -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success -- Performing Test HAVE_C_FVISIBILITY_HIDDEN -- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed -- Looking for pthread.h -- Looking for pthread.h - found -- Check if the system is big endian -- Searching 16 bit integer -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of unsigned short -- Check size of unsigned short - done -- Using unsigned short -- Check if the system is big endian - little endian -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") -- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.0.3") -- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success -- Performing Test HAVE_C_WNO_SHADOW -- Performing Test HAVE_C_WNO_SHADOW - Success -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Success -- Found Jasper: /usr/lib/x86_64-linux-gnu/libjasper.so (found version "1.900.1") -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") -- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.50") -- Looking for /usr/include/libpng/png.h -- Looking for /usr/include/libpng/png.h - found -- Looking for semaphore.h -- Looking for semaphore.h - found -- Performing Test HAVE_CXX_WNO_SHADOW -- Performing Test HAVE_CXX_WNO_SHADOW - Success -- Performing Test HAVE_CXX_WNO_UNUSED -- Performing Test HAVE_CXX_WNO_UNUSED - Success -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success -- Performing Test HAVE_CXX_WNO_UNDEF -- Performing Test HAVE_CXX_WNO_UNDEF - Success -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WNO_UNINITIALIZED -- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success -- Performing Test HAVE_CXX_WNO_SWITCH -- Performing Test HAVE_CXX_WNO_SWITCH - Success -- Performing Test HAVE_CXX_WNO_PARENTHESES -- Performing Test HAVE_CXX_WNO_PARENTHESES - Success -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success -- Performing Test HAVE_CXX_WNO_EXTRA -- Performing Test HAVE_CXX_WNO_EXTRA - Success -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success -- checking for module 'gtk+-3.0' -- package 'gtk+-3.0' not found -- checking for module 'gtk+-2.0' -- found gtk+-2.0, version 2.24.23 -- checking for module 'gthread-2.0' -- found gthread-2.0, version 2.40.2 -- checking for module 'gtkglext-1.0' -- package 'gtkglext-1.0' not found -- checking for module 'gstreamer-base-1.0' -- package 'gstreamer-base-1.0' not found -- checking for module 'gstreamer-video-1.0' -- package 'gstreamer-video-1.0' not found -- checking for module 'gstreamer-app-1.0' -- package 'gstreamer-app-1.0' not found -- checking for module 'gstreamer-riff-1.0' -- package 'gstreamer-riff-1.0' not found -- checking for module 'gstreamer-pbutils-1.0' -- package 'gstreamer-pbutils-1.0' not found -- checking for module 'gstreamer-base-0.10' -- package 'gstreamer-base-0.10' not found -- checking for module 'gstreamer-video-0.10' -- package 'gstreamer-video-0.10' not found -- checking for module 'gstreamer-app-0.10' -- package 'gstreamer-app-0.10' not found -- checking for module 'gstreamer-riff-0.10' -- package 'gstreamer-riff-0.10' not found -- checking for module 'gstreamer-pbutils-0.10' -- package 'gstreamer-pbutils-0.10' not found -- checking for module 'libdc1394-2' -- package 'libdc1394-2' not found -- checking for module 'libdc1394' -- package 'libdc1394' not found -- checking for module 'libv4l1' -- found libv4l1, version 1.0.1 -- checking for module 'libv4l2' -- found libv4l2, version 1.0.1 -- Looking for linux/videodev.h -- Looking for linux/videodev.h - not found -- Looking for linux/videodev2.h -- Looking for linux/videodev2.h - found -- Looking for sys/videoio.h -- Looking for sys/videoio.h - not found -- checking for module 'libavcodec' -- found libavcodec, version 54.35.0 -- checking for module 'libavformat' -- found libavformat, version 54.20.4 -- checking for module 'libavutil' -- found libavutil, version 52.3.0 -- checking for module 'libswscale' -- found libswscale, version 2.1.1 -- checking for module 'libavresample' -- package 'libavresample' not found -- Looking for libavformat/avformat.h -- Looking for libavformat/avformat.h - found -- Looking for ffmpeg/avformat.h -- Looking for ffmpeg/avformat.h - not found -- checking for module 'libgphoto2' -- package 'libgphoto2' not found -- checking for module 'tbb' -- found tbb, version 4.2~20130725 -- ICV: Removing previous unpacked package: /home/teddy/opencv/3rdparty/ippicv/unpack -- ICV: Unpacking ippicv_linux_20151201.tgz to /home/teddy/opencv/3rdparty/ippicv/unpack... -- ICV: Package successfully downloaded -- found IPP (ICV version): 9.0.1 [9.0.1] -- at: /home/teddy/opencv/3rdparty/ippicv/unpack/ippicv_lnx -- CUDA detected: 7.5 -- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30 -- Found Doxygen: /usr/bin/doxygen (found version "1.8.6") -- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake -- Found PythonInterp: /home/teddy/.virtualenvs/opencv_p27_cuda/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable exact version "2.7.6") -- Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (found suitable exact version "3.4.3") Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named 'numpy' -- Found apache ant 1.9.3: /usr/bin/ant -- Found JNI: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libjawt.so -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success -- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION -- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION - Success -- Performing Test HAVE_CXX_WNO_UNUSED_VARIABLE -- Performing Test HAVE_CXX_WNO_UNUSED_VARIABLE - Success -- Performing Test HAVE_CXX_WNO_ENUM_COMPARE -- Performing Test HAVE_CXX_WNO_ENUM_COMPARE - Success -- Caffe: NO -- Protobuf: NO -- Glog: NO -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) -- Checking SFM deps... FALSE -- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags -- Tesseract: NO -- Performing Test HAVE_CXX_WNO_UNUSED_BUT_SET_VARIABLE -- Performing Test HAVE_CXX_WNO_UNUSED_BUT_SET_VARIABLE - Success -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED - Success -- Performing Test HAVE_CXX_WNO_SIGN_PROMO -- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Failed -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) -- Build libprotobuf from sources: -- libprotobuf not found into system -- The protocol buffer compiler not found -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for C++ include unordered_map -- Looking for C++ include unordered_map - found -- Looking for C++ include tr1/unordered_map -- Looking for C++ include tr1/unordered_map - found -- Looking for C++ include unordered_set -- Looking for C++ include unordered_set - found -- Looking for C++ include tr1/unordered_set -- Looking for C++ include tr1/unordered_set - found -- Performing Test HAVE_CXX_WNO_DEPRECATED -- Performing Test HAVE_CXX_WNO_DEPRECATED - Success -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS - Success -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE - Failed -- Tesseract: NO -- -- General configuration for OpenCV 3.1.0 ===================================== -- Version control: 3.1.0-dirty -- -- Platform: -- Host: Linux 3.19.0-56-generic x86_64 -- CMake: 2.8.12.2 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make -- Configuration: RELEASE -- -- C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /usr/bin/c++ (ver 4.8.4) -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- Precompiled headers: YES -- Extra dependencies: /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so gtk-x11-2.0 gdk-x11-2.0 atk-1.0 gio-2.0 pangoft2-1.0 pangocairo-1.0 gdk_pixbuf-2.0 cairo pango-1.0 fontconfig gobject-2.0 freetype gthread-2.0 glib-2.0 v4l1 v4l2 avcodec avformat avutil swscale dl m pthread rt tbb cudart nppc nppi npps cublas cufft -L/usr/local/cuda-7.5/lib64 -- 3rdparty dependencies: libwebp IlmImf libprotobuf -- -- OpenCV modules: -- To be built: cudev core cudaarithm flann imgproc ml reg surface_matching video cudabgsegm cudafilters cudaimgproc cudawarping dnn fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo datasets java rgbd stereo structured_light superres tracking videostab xfeatures2d ximgproc aruco optflow stitching python2 -- Disabled: world contrib_world -- Disabled by dependency: - -- Unavailable: python3 viz cvv hdf matlab sfm -- -- GUI: -- QT: NO -- GTK+ 2.x: YES (ver 2.24.23) -- GThread : YES (ver 2.40.2) -- GtkGlExt: NO -- OpenGL support: NO -- VTK support: NO -- -- Media I/O: -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8) -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver ) -- WEBP: build (ver 0.3.1) -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.50) -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.3) -- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1) -- OpenEXR: build (ver 1.7.1) -- GDAL: NO -- -- Video I/O: -- DC1394 1.x: NO -- DC1394 2.x: NO -- FFMPEG: YES -- codec: YES (ver 54.35.0) -- format: YES (ver 54.20.4) -- util: YES (ver 52.3.0) -- swscale: YES (ver 2.1.1) -- resample: NO -- gentoo-style: YES -- GStreamer: NO -- OpenNI: NO -- OpenNI PrimeSensor Modules: NO -- OpenNI2: NO -- PvAPI: NO -- GigEVisionSDK: NO -- UniCap: NO -- UniCap ucil: NO -- V4L/V4L2: Using libv4l1 (ver 1.0.1) / libv4l2 (ver 1.0.1) -- XIMEA: NO -- Xine: NO -- gPhoto2: NO -- -- Parallel framework: TBB (ver 4.2 interface 7000) -- -- Other third-party libraries: -- Use IPP: 9.0.1 [9.0.1] -- at: /home/teddy/opencv/3rdparty/ippicv/unpack/ippicv_lnx -- Use IPP Async: NO -- Use VA: NO -- Use Intel VA-API/OpenCL: NO -- Use Eigen: YES (ver 3.2.0) -- Use Cuda: YES (ver 7.5) -- Use OpenCL: YES -- Use custom HAL: NO -- -- NVIDIA CUDA -- Use CUFFT: YES -- Use CUBLAS: YES -- USE NVCUVID: NO -- NVIDIA GPU arch: 20 21 30 35 -- NVIDIA PTX archs: 30 -- Use fast math: YES -- -- OpenCL: -- Version: dynamic -- Include path: /home/teddy/opencv/3rdparty/include/opencl/1.2 -- Use AMDFFT: NO -- Use AMDBLAS: NO -- -- Python 2: -- Interpreter: /home/teddy/.virtualenvs/opencv_p27_cuda/bin/python2.7 (ver 2.7.6) -- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6) -- numpy: /home/teddy/.virtualenvs/opencv_p27_cuda/local/lib/python2.7/site-packages/numpy/core/include (ver 1.11.0) -- packages path: lib/python2.7/site-packages -- -- Python 3: -- Interpreter: /usr/bin/python3.4 (ver 3.4.3) -- -- Python (for build): /home/teddy/.virtualenvs/opencv_p27_cuda/bin/python2.7 -- -- Java: -- ant: /usr/bin/ant (ver 1.9.3) -- JNI: /usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-8-oracle/include/linux /usr/lib/jvm/java-8-oracle/include -- Java wrappers: YES -- Java tests: YES -- -- Matlab: Matlab not found or implicitly disabled -- -- Documentation: -- Doxygen: /usr/bin/doxygen (ver 1.8.6) -- PlantUML: NO -- -- Tests and samples: -- Tests: YES -- Performance tests: YES -- C/C++ Examples: YES -- -- Install path: /usr/local -- -- cvconfig.h is in: /home/teddy/opencv/build -- ----------------------------------------------------------------- -- -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: BUILD_NEW_PYTHON_SUPPORT -- Build files have been written to: /home/teddy/opencv/build |
NOTE:
PLS SEE THE NVIDIA CUDA PART ON THE ABOVE RESULT IS INCLUDED! BUILD WITH CUDA IS FAST (A FEW MINUTES)!
6. Compile opencv:
NOTE: BEFORE EXECUTING THIS, CONSIDER TO EDIT THIS FILE:
|
1 |
/home/teddy/opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir/link.txt |
SEE BELOW HOW TO MODIFY IT!!!
|
1 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv/build$ make -j4 |
NOTE:
AFTER WAITING FOR MORE THAN 1 hour AND 25 MINUTES (91% COMPLETED), THE COMPILATION IS STOPPED WITH THESE ERRORS STACK:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
... [ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_multi.dir/multi.cpp.o [ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o Linking CXX executable ../../bin/gpu-example-hog [ 89%] Built target example_gpu_hog Scanning dependencies of target example_gpu_optical_flow [ 89%] Building CXX object samples/gpu/CMakeFiles/example_gpu_optical_flow.dir/optical_flow.cpp.o Linking CXX executable ../../bin/gpu-example-opengl CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o: In function `draw(void*)': opengl.cpp:(.text._Z4drawPv+0x21): undefined reference to `glRotated' CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o: In function `main': opengl.cpp:(.text.startup.main+0x4ae): undefined reference to `glMatrixMode' opengl.cpp:(.text.startup.main+0x4b3): undefined reference to `glLoadIdentity' opengl.cpp:(.text.startup.main+0x4d8): undefined reference to `gluPerspective' opengl.cpp:(.text.startup.main+0x4e2): undefined reference to `glMatrixMode' opengl.cpp:(.text.startup.main+0x4e7): undefined reference to `glLoadIdentity' opengl.cpp:(.text.startup.main+0x519): undefined reference to `gluLookAt' opengl.cpp:(.text.startup.main+0x523): undefined reference to `glEnable' opengl.cpp:(.text.startup.main+0x54b): undefined reference to `glTexParameteri' opengl.cpp:(.text.startup.main+0x55f): undefined reference to `glTexEnvi' opengl.cpp:(.text.startup.main+0x569): undefined reference to `glDisable' collect2: error: ld returned 1 exit status make[2]: *** [bin/gpu-example-opengl] Error 1 make[1]: *** [samples/gpu/CMakeFiles/example_gpu_opengl.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... Linking CXX executable ../../bin/gpu-example-multi [ 89%] Built target example_gpu_multi Linking CXX executable ../../bin/gpu-example-optical_flow [ 89%] Built target example_gpu_optical_flow Scanning dependencies of target opencv_videostab [ 91%] [ 91%] [ 91%] [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/optical_flow.cpp.o Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/log.cpp.o Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/frame_source.cpp.o Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/wobble_suppression.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/outlier_rejection.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/fast_marching.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/motion_stabilizing.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/stabilizer.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/deblurring.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/inpainting.cpp.o [ 91%] Building CXX object modules/videostab/CMakeFiles/opencv_videostab.dir/src/global_motion.cpp.o Linking CXX shared library ../../lib/libopencv_videostab.so [ 91%] Built target opencv_videostab make: *** [all] Error 2 |
SOLUTION:
ref:https://github.com/Itseez/opencv/issues/5859
I USED A TEMPORARY SOLUTION: EDIT /home/teddy/opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir/link.txt. THEN ADD THIS: -lGL -lGLU AT THE END OF THE LINE (IN SINGLE LINE! DONT ADD AT THE NEW LINE!). SO THE FILE WOULD BE LIKE THIS:
|
1 |
/usr/bin/c++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o -o ../../bin/gpu-example-opengl -L/usr/local/cuda-7.5/lib64 -rdynamic -ldl -lm -lpthread -lrt -ltbb ../../../3rdparty/ippicv/unpack/ippicv_lnx/lib/intel64/libippicv.a -lcudart -lnppc -lnppi -lnpps -lcublas -lcufft -L/usr/local/cuda-7.5/lib64 ../../lib/libopencv_core.so.3.1.0 ../../lib/libopencv_flann.so.3.1.0 ../../lib/libopencv_imgproc.so.3.1.0 ../../lib/libopencv_imgcodecs.so.3.1.0 ../../lib/libopencv_videoio.so.3.1.0 ../../lib/libopencv_highgui.so.3.1.0 ../../lib/libopencv_ml.so.3.1.0 ../../lib/libopencv_video.so.3.1.0 ../../lib/libopencv_objdetect.so.3.1.0 ../../lib/libopencv_features2d.so.3.1.0 ../../lib/libopencv_calib3d.so.3.1.0 ../../lib/libopencv_superres.so.3.1.0 ../../lib/libopencv_cudaarithm.so.3.1.0 ../../lib/libopencv_cudafilters.so.3.1.0 ../../lib/libopencv_cudawarping.so.3.1.0 ../../lib/libopencv_cudaimgproc.so.3.1.0 ../../lib/libopencv_cudafeatures2d.so.3.1.0 ../../lib/libopencv_cudaoptflow.so.3.1.0 ../../lib/libopencv_cudabgsegm.so.3.1.0 ../../lib/libopencv_cudastereo.so.3.1.0 ../../lib/libopencv_cudalegacy.so.3.1.0 ../../lib/libopencv_cudaobjdetect.so.3.1.0 -lcuda ../../lib/libopencv_xfeatures2d.so.3.1.0 ../../lib/libopencv_cudacodec.so.3.1.0 ../../lib/libopencv_cudawarping.so.3.1.0 ../../lib/libopencv_cudalegacy.so.3.1.0 ../../lib/libopencv_objdetect.so.3.1.0 ../../lib/libopencv_cudaimgproc.so.3.1.0 ../../lib/libopencv_cudafilters.so.3.1.0 ../../lib/libopencv_calib3d.so.3.1.0 ../../lib/libopencv_features2d.so.3.1.0 ../../lib/libopencv_flann.so.3.1.0 ../../lib/libopencv_highgui.so.3.1.0 ../../lib/libopencv_videoio.so.3.1.0 ../../lib/libopencv_imgcodecs.so.3.1.0 ../../lib/libopencv_ml.so.3.1.0 ../../lib/libopencv_cudaarithm.so.3.1.0 ../../lib/libopencv_shape.so.3.1.0 ../../lib/libopencv_video.so.3.1.0 ../../lib/libopencv_imgproc.so.3.1.0 ../../lib/libopencv_core.so.3.1.0 ../../lib/libopencv_cudev.so.3.1.0 -Wl,-rpath,/usr/local/cuda-7.5/lib64:/home/teddy/opencv/build/lib -lGL -lGLU |
SAVE THE FILE THEN RE-MAKE (BUT I SUGGEST TO REMOVE ‘build’ DIRECTORY, CREATE IT AGAIN LIKE STEP #5. BUT BEFORE EXECUTING STEP #6, EDIT link.txt FILE LIKE THE ABOVE! ). THIS SOLUTION IS WORKING!!!
ACTUALLY THERE IS A PERMANENT SOLUTION IS SUGGESTED IN THE SAME URL, BUT I DONT KNOW HOW TO DO IT!!! LEARN IT
OK. HERE IS THE SUCCESFULL COMPILE (MAKE)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv/build$ make -j4 ... [ 98%] Built target tutorial_objectDetection Scanning dependencies of target tutorial_video-input-psnr-ssim [ 98%] Building CXX object samples/cpp/CMakeFiles/tutorial_video-input-psnr-ssim.dir/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp.o [ 98%] Built target tutorial_objectDetection2 Scanning dependencies of target tutorial_video-write [100%] Building CXX object samples/cpp/CMakeFiles/tutorial_video-write.dir/tutorial_code/HighGUI/video-write/video-write.cpp.o Linking CXX executable ../../bin/cpp-tutorial-pointPolygonTest_demo [100%] Built target tutorial_pointPolygonTest_demo Linking CXX executable ../../bin/cpp-tutorial-video-write [100%] Built target tutorial_video-write Linking CXX executable ../../bin/cpp-tutorial-planar_tracking Linking CXX executable ../../bin/cpp-tutorial-video-input-psnr-ssim [100%] Built target tutorial_planar_tracking [100%] Built target tutorial_video-input-psnr-ssim |
NOTE:
SEE THE MORE COMPLETE COMPILATION (MAKE) PROCESS IN THIS FILE: /media/data/MASTER/opencv/make_opencv_cuda.txt
ITS NOT FULL COMPLETED BECAUSE I MISSED SOME DATA BUT IT WORTHS TO SEE (THERE ARE SOME WARNING!!!)
THIS COMPILATION TOOK MORE THAN 1 hour AND 30 MINUTES. COMPILATION WITH CUDA (MAY BE ALSO WITH OPENGL) MAKE IT SLOWER!!!
WARNINGS:
1.
|
1 |
cc1: warning: command line option '-Wno-delete-non-virtual-dtor' is valid for C++/ObjC++ but not for C [enabled by default] |
2.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/onlineBoosting.cpp.o /home/teddy/opencv_contrib/modules/xfeatures2d/src/cuda/surf.cu:153:13: warning: "__CUDA_ARCH__" is not defined [-Wundef] #if __CUDA_ARCH__ && __CUDA_ARCH__ >= 200 ^ /home/teddy/opencv_contrib/modules/xfeatures2d/src/cuda/surf.cu:287:17: warning: "__CUDA_ARCH__" is not defined [-Wundef] #if __CUDA_ARCH__ && __CUDA_ARCH__ >= 110 ^ /home/teddy/opencv_contrib/modules/xfeatures2d/src/cuda/surf.cu:410:17: warning: "__CUDA_ARCH__" is not defined [-Wundef] #if __CUDA_ARCH__ && __CUDA_ARCH__ >= 110 ^ /home/teddy/opencv_contrib/modules/xfeatures2d/src/cuda/surf.cu:595:13: warning: "__CUDA_ARCH__" is not defined [-Wundef] #if __CUDA_ARCH__ >= 200 ^ ... 17: warning: "__CUDA_ARCH__" is not defined [-Wundef] #if __CUDA_ARCH__ >= 300 ^ /home/teddy/opencv/modules/core/include/opencv2/core/cuda/detail/reduce.hpp:324:21: warning: "__CUDA_ARCH__" is not defined [-Wundef] #if __CUDA_ARCH__ && __CUDA_ARCH__ >= 200 ^ |
7. Assuming OpenCV 3.1 compiled without error, you can now install it on your system:
NOTE: BEFORE EXECUTING THIS COMMAND, MODIFY AGAIN THE ABOVE FILE: /home/teddy/opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir/link.txt OR WE’D GET THE SAME ERROR (PLS SEE THE ERROR HERE: /media/data/MASTER/opencv/opencv_cuda_make_install_error.txt ):
|
1 2 3 |
CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o: In function `draw(void*)': opengl.cpp:(.text._Z4drawPv+0x21): undefined reference to `glRotated' CMakeFiles/example_gpu_opengl.dir/opengl.cpp.o: In function `main': |
THIS TIME WE MUST USE SUDO BECAUSE THE FILE IS LOCKED:
|
1 2 |
teddy@teddy-K43SJ:~$ cd opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir/ teddy@teddy-K43SJ:~/opencv/build/samples/gpu/CMakeFiles/example_gpu_opengl.dir$ sudo gedit link.txt |
THEN ADD THIS AT THE END OF THE SINGLE LINE LIKE ABOVE: -lGL -lGLU
THEN SAVE AND CLOSE
INSTALL AGAIN:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv/build$ sudo make install ... -- Up-to-date: /usr/local/share/OpenCV/samples/python/texture_flow.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/otsu_binarization.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/mser.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/calibrate.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/digits_adjust.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/houghlines.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/color_histogram.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/good_features.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/demo.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/mouse_paint_img.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/adaptive_equal.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/inpaint.py -- Up-to-date: /usr/local/share/OpenCV/samples/python/video_threaded.py |
NOTE:
FOR COMPLETE PROCESS RESULT, SEE THIS FILE: /media/data/MASTER/opencv/opencv_cuda_make_install_success.txt
8.
|
1 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv/build$ sudo ldconfig |
9. If you’ve reached this step without an error, OpenCV should now be installed in /usr/local/lib/python2.7/site-packages
However, our ‘opencv_p27_cuda’ virtual environment is located in our home directory — thus to use OpenCV within our cv environment, we first need to sym-link OpenCV into the site-packages directory of the ‘opencv_p27_cuda’ virtual environment:
|
1 2 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~/opencv/build$ cd ~/.virtualenvs/opencv_p27_cuda/lib/python2.7/site-packages/ (opencv_p27_cuda) teddy@teddy-K43SJ:~/.virtualenvs/opencv_p27_cuda/lib/python2.7/site-packages$ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so |
10. Check the installation opencv version:
|
1 2 3 4 5 6 7 |
(opencv_p27_cuda) teddy@teddy-K43SJ:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.1.0' |
11. EXECUTE SOME OPENCV EXAMPLES in /home/teddy/opencv/build/bin/ DIRECTORY:
a. Run this example (image grain):
|
1 |
teddy@teddy-K43SJ:~/opencv/build/bin$ ./cpp-example-image ../../samples/data/fruits.jpg |
b. Test Cuda Codec:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
teddy@teddy-K43SJ:~/opencv/build/bin$ ./opencv_test_cudacodec Available options besides google test option: Usage: opencv_test_cudacodec [params] --cuda_device (value:-1) CUDA device on which tests will be executed (-1 means all devices) -h, --help (value:false) Print help info Run tests on all supported CUDA devices [----------] [ GPU INFO ] Run on OS Linux x64. [----------] *** CUDA Device Query (Runtime API) version (CUDART static linking) *** Device count: 1 Device 0: "GeForce GT 520M" CUDA Driver Version / Runtime Version 7.50 / 7.50 CUDA Capability Major/Minor version number: 2.1 Total amount of global memory: 1023 MBytes (1072889856 bytes) ( 1) Multiprocessors x (48) CUDA Cores/MP: 48 CUDA Cores GPU Clock Speed: 1.48 GHz Max Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536,65535), 3D=(2048,2048,2048) Max Layered Texture Size (dim) x layers 1D=(16384) x 2048, 2D=(16384,16384) x 2048 Total amount of constant memory: 65536 bytes Total amount of shared memory per block: 49152 bytes Total number of registers available per block: 32768 Warp size: 32 Maximum number of threads per block: 1024 Maximum sizes of each dimension of a block: 1024 x 1024 x 64 Maximum sizes of each dimension of a grid: 65535 x 65535 x 65535 Maximum memory pitch: 2147483647 bytes Texture alignment: 512 bytes Concurrent copy and execution: Yes with 1 copy engine(s) Run time limit on kernels: Yes Integrated GPU sharing Host Memory: No Support host page-locked memory mapping: Yes Concurrent kernel execution: Yes Alignment requirement for Surfaces: Yes Device has ECC support enabled: No Device is using TCC driver mode: No Device supports Unified Addressing (UVA): Yes Device PCI Bus ID / PCI location ID: 1 / 0 Compute Mode: Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 7.50, CUDA Runtime Version = 7.50, NumDevs = 1 CTEST_FULL_OUTPUT OpenCV version: 3.1.0 OpenCV VCS version: 3.1.0-dirty Build type: release Parallel framework: tbb CPU features: OpenCL is disabled [==========] Running 0 tests from 0 test cases. [==========] 0 tests from 0 test cases ran. (0 ms total) [ PASSED ] 0 tests. |














