git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake ..
make -j4
Everything runs fine until I get to make -j4. On that step, I get down to 75% before I run into this error:
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to `uuid_parse@UUID_1.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to `uuid_generate_random@UUID_1.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to `uuid_unparse@UUID_1.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfontconfig.so: undefined reference to `uuid_copy@UUID_1.0'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/highgui/CMakeFiles/opencv_test_highgui.dir/build.make:122: bin/opencv_test_highgui] Error 1
make[1]: *** [CMakeFiles/Makefile2:2911: modules/highgui/CMakeFiles/opencv_test_highgui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I tried googling for this issue, and found a stackoverflow post that seemed similar that recommended installing libuuid-devel but libuuid-devel doesn’t seem to exist in Ubuntu. Next, I googled libuuid-devel ubuntu to see if that would show up properly. This answer seemed promising (apt install uuid-dev): linux - How do I obtain/use LibUUID? - Stack Overflow but I tried this and already have uuid-dev installed.
Has anybody else ran into this issue? Any suggestions on how to proceed from here to get a c++ opencv environment up and running so I can work on adding the feature I’m trying to? It probably goes without saying, but I am new to opencv and fairly new to c++ as well so I am open to suggestions on better ways to set up my dev environment as well to work on this issue. Thanks for taking the time to read this!
Thank you for the tips. I can definitely see why -j1 is better when debugging I will use that from now on. Does cmake .. build everything? I wasn’t quite sure if I should add arguments myself or let opencv use whatever defaults it uses. Is this the best place to find build flags: OpenCV: OpenCV configuration options reference? Or should I be looking somewhere else for that information
maybe you want to discover cmake-gui ?
cmake also generates a final report, better check that before running make even, all nessecary modules got built ? found correct python ? etc
I will look into cmake-gui. Thanks for bringing it to my attention. For the cmake final report, I am having some trouble understanding what I’m looking at and whether the output is problematic. Here is the full output:
sadmin@CRS-SVI-FIN-01:~/Documents/opencv/build$ cmake -DBUILD_LIST="imgcodecs,core,highgui" -DBUILD_TESTS=OFF .DBUILD_PERF_TESTS=OFF ..
-- Detected processor: x86_64
-- Looking for ccache - not found
Cleaning INTERNAL cached variable: JPEG_LIBRARY
Cleaning INTERNAL cached variable: JPEG_INCLUDE_DIR
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- libjpeg-turbo: VERSION = 2.1.3, BUILD = opencv-4.9.0-dev-libjpeg-turbo-debug
Cleaning INTERNAL cached variable: TIFF_LIBRARY
Cleaning INTERNAL cached variable: TIFF_INCLUDE_DIR
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
Cleaning INTERNAL cached variable: WEBP_LIBRARY
Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
-- Found system OpenJPEG: openjp2 (found version "2.4.0")
-- libva: missing va.h header (VA_INCLUDE_DIR)
-- found Intel IPP (ICV version): 2021.10.1 [2021.10.1]
-- at: /home/sadmin/Documents/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2021.10.1
-- at: /home/sadmin/Documents/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
-- LAPACK requires BLAS
-- A library with LAPACK API not found. Please specify library location.
-- Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- Checking for module 'gtk+-3.0'
-- No package 'gtk+-3.0' found
-- Checking for modules 'libavcodec;libavformat;libavutil;libswscale'
-- No package 'libavcodec' found
-- No package 'libavformat' found
-- No package 'libavutil' found
-- No package 'libswscale' found
-- FFMPEG is disabled. Required libraries: libavcodec;libavformat;libavutil;libswscale. Missing libraries: libavcodec;libavformat;libavutil;libswscale
-- Checking for module 'gstreamer-base-1.0'
-- No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-app-1.0'
-- No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
-- No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
-- No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-video-1.0'
-- No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-audio-1.0'
-- No package 'gstreamer-audio-1.0' found
-- Checking for module 'libdc1394-2'
-- No package 'libdc1394-2' found
-- Using whitelist: opencv_core;opencv_highgui;opencv_imgcodecs
-- Module opencv_calib3d disabled by whitelist
-- Module opencv_dnn disabled by whitelist
-- Module opencv_features2d disabled by whitelist
-- Module opencv_flann disabled by whitelist
-- Module opencv_gapi disabled by whitelist
-- Module opencv_java_bindings_generator disabled by whitelist
-- Module opencv_js_bindings_generator disabled by whitelist
-- Module opencv_ml disabled by whitelist
-- Module opencv_objc_bindings_generator disabled by whitelist
-- Module opencv_objdetect disabled by whitelist
-- Module opencv_photo disabled by whitelist
-- Module opencv_python_bindings_generator disabled by whitelist
-- Module opencv_python_tests disabled by whitelist
-- Module opencv_stitching disabled by whitelist
-- Module opencv_ts disabled by whitelist
-- Module opencv_video disabled by whitelist
-- Module opencv_videoio disabled by whitelist
-- Allocator metrics storage type: 'long long'
-- Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
-- Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
-- imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
-- highgui: using builtin backend: GTK2
--
-- General configuration for OpenCV 4.9.0-dev =====================================
-- Version control: 4.9.0-180-gf0e3d2f2f8
--
-- Platform:
-- Timestamp: 2024-02-20T18:21:49Z
-- Host: Linux 5.4.0-169-generic x86_64
-- CMake: 3.16.3
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: Debug
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (13 files): + SSSE3 SSE4_1
-- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (3 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (25 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 9.4.0)
-- C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: core highgui imgcodecs imgproc
-- Disabled: world
-- Disabled by dependency: calib3d dnn features2d flann gapi java_bindings_generator js_bindings_generator ml objc_bindings_generator objdetect photo python_bindings_generator python_tests stitching ts video videoio
-- Unavailable: java python2 python3
-- Applications: apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI: GTK2
-- GTK+: YES (ver 2.24.32)
-- GThread : YES (ver 2.64.6)
-- GtkGlExt: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: libjpeg-turbo (ver 2.1.3-62)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: build (ver 42 - 4.2.0)
-- JPEG 2000: OpenJPEG (ver 2.4.0)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2021.10.1 [2021.10.1]
-- at: /home/sadmin/Documents/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2021.10.1)
-- at: /home/sadmin/Documents/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- VA: NO
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: NO
-- Protobuf: build (3.19.1)
-- Flatbuffers: builtin/3rdparty (23.5.9)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/sadmin/Documents/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python (for build): /home/sadmin/anaconda3/bin/python3
--
-- Java:
-- ant: NO
-- Java: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
CMake Warning at cmake/OpenCVUtils.cmake:1582 (add_library):
Cannot generate a safe runtime search path for target opencv_imgcodecs
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libpng16.so.16] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
cmake/OpenCVModule.cmake:989 (ocv_add_library)
cmake/OpenCVModule.cmake:905 (_ocv_create_module)
modules/imgcodecs/CMakeLists.txt:168 (ocv_create_module)
CMake Warning at cmake/OpenCVUtils.cmake:1582 (add_library):
Cannot generate a safe runtime search path for target opencv_highgui
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libgio-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libgobject-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libfontconfig.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libfreetype.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libgthread-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libglib-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
cmake/OpenCVModule.cmake:989 (ocv_add_library)
cmake/OpenCVModule.cmake:905 (_ocv_create_module)
modules/highgui/CMakeLists.txt:291 (ocv_create_module)
-- Generating done
-- Build files have been written to: /home/sadmin/Documents/opencv/build
Here is the portion that I am thinking may be an issue, but I’m not sure how to resolve it if it is:
CMake Warning at cmake/OpenCVUtils.cmake:1582 (add_library):
Cannot generate a safe runtime search path for target opencv_highgui
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libgio-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libgobject-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libfontconfig.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libfreetype.so.6] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libgthread-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
runtime library [libglib-2.0.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/sadmin/anaconda3/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
cmake/OpenCVModule.cmake:989 (ocv_add_library)
cmake/OpenCVModule.cmake:905 (_ocv_create_module)
modules/highgui/CMakeLists.txt:291 (ocv_create_module)
I also slightly modified the cmake BUILD_LIST that you had proposed and replaced python3 with highgui because I am not planning on using Python for this development (at least to start). I guess my question here is does my cmake output look healthy to you or do I need to change something to fix these library warnings?