0002-CMakeLists.txt-Do-not-add-libdl-to-LINKER_LIBS-for-s.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 22e03ef8a9e3adcbc6b2f16c3cc98e4e14443eed Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Sat, 24 Sep 2016 17:51:22 +0200
  4. Subject: [PATCH 1/1] CMakeLists.txt: Do not add libdl to LINKER_LIBS for
  5. static builds
  6. Without this patch -ldl is present in opencv.pc which breaks OpenCV
  7. detection by ffmpeg, detected by buildroot autobuilders:
  8. http://autobuild.buildroot.net/results/765/7657e01481995a4f0d725467e935a83928a59a04//ffmpeg-3.1.3/config.log
  9. /home/peko/autobuild/instance-1/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.9.4/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -ldl
  10. Patch sent upstream: https://github.com/opencv/opencv/pull/7337
  11. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  12. ---
  13. CMakeLists.txt | 5 ++++-
  14. 1 file changed, 4 insertions(+), 1 deletion(-)
  15. diff --git a/CMakeLists.txt b/CMakeLists.txt
  16. index 007b80d..99b047d 100644
  17. --- a/CMakeLists.txt
  18. +++ b/CMakeLists.txt
  19. @@ -457,7 +457,10 @@ if(UNIX)
  20. elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
  21. set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m)
  22. else()
  23. - set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
  24. + if(BUILD_SHARED_LIBS)
  25. + set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl)
  26. + endif()
  27. + set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread rt)
  28. endif()
  29. else()
  30. set(HAVE_LIBPTHREAD YES)
  31. --
  32. 2.9.3