Libopencv_world package undefined reference to xxx

Hi all.

For a while now I have been trying to create a conan package of opencv in my entreprise, I have built it from source, and I have a package that has the libopencv_world.so.4.5.5.
When I include my built package to my cmake project (using c++), the entire compiling works without any issues, so the opencv source is found and used, but the last step, when it’s linkin CXX executable, I first get following warnings :

/usr/bin/ld: warning: libpng16.so.16, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libIlmImf-2_3.so.24, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libdc1394.so.22, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavcodec.so.58, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavformat.so.58, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavutil.so.56, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libswscale.so.5, needed by <packagePATH>/lib/libopencv_world.so.4.5.5, not found (try using -rpath or -rpath-link)

and after that I get a bunch of undefined reference to… :

<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_transmission'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_log_get_level@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_dict_set@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `png_create_read_struct@PNG16_0'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `png_set_interlace_handling@PNG16_0'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `Imf_2_3::Header::dataWindow() const'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_deinterlace_stereo_frames'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `Imf_2_3::InputFile::InputFile(char const*, int)'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_value'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `Imf_2_3::FrameBuffer::insert(char const*, Imf_2_3::Slice const&)'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_packet_unref@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_receive_packet@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `Imf_2_3::OutputFile::setFrameBuffer(Imf_2_3::FrameBuffer const&)'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `png_set_IHDR@PNG16_0'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_iso_speed'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_codec_is_decoder@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_absolute_control'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_find_type_by_name@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_get_hwframe_constraints@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `png_get_io_ptr@PNG16_0'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_power'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `Imf_2_3::Header::compression()'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_init@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `Imf_2_3::ChannelList::findChannel(char const*) const'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_get_value'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_ctx_create_derived@LIBAVUTIL_56'

and many more but I’ll spare you the details.
So first question, are all these undefined references only due to the first 5 warnings or did I wrongly build the libopencv_world library ?
And second question, is it even possible to have my libopencv_world library in a single package, for linux ?

thanks in advance, and feel free to let me know if you need more info :slight_smile:

is that on a different machine, than where you built the libs ?
(just curious, and no idea at all about conan here…)

Hi,
Yes so the idea is to be able to use the package as is on any computer, I just have to add the package onto my cmake project.

i think, you can shave off a few dependancies, e.g. for imgproc, by enabling most BUILD_XXX flags in cmake (so it will compile those 3rdparty libs statically into the module), but that wont work for gui or video codecs.

if you build in support for ffmpeg, that has to be installed
(and the same version !) on the client machine too

Hi berak,

Thanks a lot for the support.
So to build my current library, I used following commands when I built from source :

cmake -D CMAKE_BUILD_TYPE=RELEASE     -D CMAKE_INSTALL_PREFIX=~/sandboxes/opencv/installation -D BUILD_opencv_world=ON -D OPENCV_GENERATE_PKGCONFIG=ON ..

Honestly I don’t necessarily need to build the opencv_world one, I don’t mind having all libs separately, but I’m still not sure what I need to add to my command for everything to by accessible when I include my opencv package project into my cmake project… there are a lot of configuration flags…

that’s true, but it wont change your dependancy problems

exactly…
But to be clear, you’d say that adding to my build command: -D BUILD_opencv_apps=ON -D BUILD_opencv_highgui=ON -D BUILD_opencv_imgproc=ON ...etc with all the apps ? Isn’t this by default already set to ON ? I’m afraid this won’t change anything

no i meant BUILD_PNG BUILD_JPEG BUILD_TIFF , etc, so you do not need to assume, the client system has the correct libjpeg.so installed

1 Like

OK so I tried to build with a lot of thing set to on, my cmake command was as follow :

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=~/sandboxes/opencv/installation -D BUILD_opencv_world=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D BUILD_PACKAGE=ON -D BUILD_PROTOBUF=ON -D BUILD_SHARED_LIBS=ON -D BUILD_opencv_apps=ON -D BUILD_opencv_calib3d=ON -D BUILD_opencv_core=ON -D BUILD_opencv_dnn=ON -D BUILD_opencv_features2d=ON -D BUILD_opencv_flann=ON -D BUILD_opencv_gapi=ON -D BUILD_opencv_highgui=ON -D BUILD_opencv_imgcodecs=ON -D BUILD_opencv_imgproc=ON -D BUILD_opencv_ml=ON -D BUILD_opencv_objc_bindings_generator=ON -D BUILD_opencv_objdetect=ON -D BUILD_opencv_photo=ON -D BUILD_opencv_python_bindings_generator=ON -D BUILD_opencv_python_tests=ON -D BUILD_opencv_stitching=ON -D BUILD_opencv_ts=ON -D BUILD_opencv_video=ON -D BUILD_opencv_videoio=ON -D BUILD_opencv_js=ON -D BUILD_opencv_js_bindings_generator=ON -D BUILD_opencv_java_bindings_generator=ON -D BUILD_CUDA_STUBS=ON -D BUILD_IPP_IW=ON -D BUILD_ITT=ON -D BUILD_JASPER=ON -D BUILD_JAVA=ON -D BUILD_JPEG=ON -D BUILD_OPENEXR=ON -D BUILD_OPENJPEG=ON -D BUILD_PNG=ON -D BUILD_TBB=ON -D BUILD_TESTS=ON -D BUILD_TIFF=ON -D BUILD_USE_SYMLINKS=ON -D BUILD_WEBP=ON -D BUILD_WITH_DEBUG_INFO=ON -D BUILD_WITH_DYNAMIC_IPP=ON -D BUILD_WITH_STATIC_CRT=ON -D BUILD_ZLIB=ON ..

when using th epackage I got less undefined reference to [xx] but still a lot are there :

<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_transmission'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_log_get_level@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_dict_set@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_deinterlace_stereo_frames'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_value'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_packet_unref@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_receive_packet@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_iso_speed'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_codec_is_decoder@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_absolute_control'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_find_type_by_name@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_get_hwframe_constraints@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_power'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_init@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_get_value'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_ctx_create_derived@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_get_color_coding_from_video_mode'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_frame_get_buffer@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `exp@GLIBC_2.29'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_camera_free'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_malloc@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_find_encoder@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_alloc@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_convert_frames'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_camera_free_list'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_freep@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `sws_getContext@LIBSWSCALE_5'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `__cxa_init_primary_exception@CXXABI_1.3.11'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_capture_is_frame_corrupt'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_codec_get_tag@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_close@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `sws_freeContext@LIBSWSCALE_5'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `typeinfo for std::thread::_State@GLIBCXX_3.4.22'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_sub_q@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_operation_mode'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())@GLIBCXX_3.4.22'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::thread::_State::~_State()@GLIBCXX_3.4.22'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwframe_ctx_init@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_get_hw_frames_parameters@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_alloc_context@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_free@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_seek_frame@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_get_mov_video_tags@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_frame_unref@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_lockmgr_register@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_init_packet@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_dict_free@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_send_packet@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_image_get_buffer_size@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_open_input@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_packet_free@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_network_init@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_flush_buffers@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_dict_parse_string@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_get_supported_modes'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_find_input_format@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_guess_sample_aspect_ratio@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_get_type_name@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_get_name@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_debayer_frames'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_free'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()@GLIBCXX_3.4.26'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_guess_format@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::__exception_ptr::exception_ptr::exception_ptr(void*)@CXXABI_1.3.11'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_buffer_ref@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_get_mode'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_register_all@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `sws_getCachedContext@LIBSWSCALE_5'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwframe_get_buffer@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_write_frame@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwframe_constraints_free@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_new_stream@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_frame_alloc@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_camera_new'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_codec_is_encoder@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_find_decoder_by_name@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwframe_ctx_create_derived@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_get_supported_framerates'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `log@GLIBC_2.29'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwdevice_ctx_create@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_get_all'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_get_image_size_from_video_mode'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_whitebalance_set_value'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_log_set_level@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_mode'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_write_trailer@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_open2@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_image_fill_arrays@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_capture_dequeue'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_dict_get@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `powf@GLIBC_2.27'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_parameters_copy@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::logic_error::logic_error(std::logic_error&&)@GLIBCXX_3.4.26'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_get_context_defaults3@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_free@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `expf@GLIBC_2.27'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_frame_free@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_capture_enqueue'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avio_open@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_pix_fmt_to_codec_tag@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_capture_stop'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_descriptor_get_by_name@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_receive_frame@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_receive_packet@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_bsf_get_by_name@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_capture_setup'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_opt_set@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_set_mode'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avio_close@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_get_control_registers'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_get_riff_video_tags@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_log_set_callback@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_capture_get_fileno'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `pow@GLIBC_2.29'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_packet_rescale_ts@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_get_hw_config@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_send_frame@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_video_set_framerate'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_codec_get_id@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_packet_alloc@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwframe_ctx_alloc@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_feature_whitebalance_get_value'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `std::runtime_error::runtime_error(std::runtime_error&&)@GLIBCXX_3.4.26'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_new'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_default_get_format@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_read_frame@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `log2f@GLIBC_2.27'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_codec_iterate@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_find_stream_info@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_find_decoder@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_mallocz@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `sws_scale@LIBSWSCALE_5'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_free_context@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avcodec_send_packet@LIBAVCODEC_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_close_input@LIBAVFORMAT_58'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `logf@GLIBC_2.27'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_buffer_unref@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `dc1394_camera_enumerate'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `av_hwframe_transfer_data@LIBAVUTIL_56'
<packagePATH>/lib/libopencv_world.so.4.5.5: undefined reference to `avformat_write_header@LIBAVFORMAT_58'

Is there no way to build opencv, so that when installing, the content of the folder where all the installed libraries are is working as a whole package, without any dependencies ?

all the av_xxx things come from ffmpeg, you probably dont need dc1394 support, but the real alarming things are the std::
ones. your C(++) stdlib differs from that on your build box !

in general, no. (esp. on linux, it’s far easier on windows)

if you want my 2 ct: this whole package idea seems futile
you should build the opencv libs, where you need them
(so e.g. they can exploit local hw features properly)