[vlc-commits] [Git][videolan/vlc][master] 4 commits: contrib: x265: fix libunwind usage when static linking

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 19 06:29:59 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
517bf7f5 by Steve Lhomme at 2024-10-19T05:50:08+00:00
contrib: x265: fix libunwind usage when static linking

It ends up with
- set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "atomic;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl")
- set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "windowsapp;windowsapp;ucrt;windowsapp;ucrtapp;c++;mingw32;-l:libunwind.a;moldname;mingwex;mingw32;-l:libunwind.a;moldname;mingwex")

- - - - -
fe40fb7f by Steve Lhomme at 2024-10-19T05:50:08+00:00
contrib: chromaprint: fix libunwind usage when static linking

It ends up with
- set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "atomic;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl")
- set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "windowsapp;windowsapp;ucrt;windowsapp;ucrtapp;c++;mingw32;-l:libunwind.a;moldname;mingwex;mingw32;-l:libunwind.a;moldname;mingwex")

- - - - -
c13b2803 by Steve Lhomme at 2024-10-19T05:50:08+00:00
contrib: libaribcaption: fix libunwind usage when static linking

It ends up with
- set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "atomic;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl")
- set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "windowsapp;windowsapp;ucrt;windowsapp;ucrtapp;c++;mingw32;-l:libunwind.a;moldname;mingwex;mingw32;-l:libunwind.a;moldname;mingwex")

- - - - -
8d83dc78 by Steve Lhomme at 2024-10-19T05:50:08+00:00
contrib: vulkan-loader: fix libunwind usage when static linking

It ends up with
- set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "atomic;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl")
- set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "windowsapp;windowsapp;ucrt;windowsapp;ucrtapp;c++;mingw32;-l:libunwind.a;moldname;mingwex;mingw32;-l:libunwind.a;moldname;mingwex")

- - - - -


9 changed files:

- contrib/src/chromaprint/0002-add-the-C-runtime-to-the-packages-to-link-to.patch
- + contrib/src/libaribcaption/0001-Fix-libunwind-static-linking-on-Android-toolchains.patch
- contrib/src/libaribcaption/rules.mak
- + contrib/src/vulkan-loader/0003-fix-libunwind-usage-when-static-linking.patch
- contrib/src/vulkan-loader/002-proper-def-files-for-32bit.patch
- contrib/src/vulkan-loader/004-disable-suffix-in-static-lib.patch
- contrib/src/vulkan-loader/rules.mak
- + contrib/src/x265/0001-Fix-libunwind-static-linking-on-Android-toolchains.patch
- contrib/src/x265/rules.mak


Changes:

=====================================
contrib/src/chromaprint/0002-add-the-C-runtime-to-the-packages-to-link-to.patch
=====================================
@@ -1,24 +1,26 @@
-From 6726ebef3eec9dcc9d08b2ad6ae352bacb215e5e Mon Sep 17 00:00:00 2001
+From 78e7305d566b81f34470a4f21519a47d635ee147 Mon Sep 17 00:00:00 2001
 From: Steve Lhomme <robux4 at ycbcr.xyz>
 Date: Mon, 5 Sep 2022 16:13:05 +0200
 Subject: [PATCH 2/2] add the C++ runtime to the packages to link to
 
 gcc needs libstdc++ and clang needs libc++.
 ---
- CMakeLists.txt | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
+ CMakeLists.txt | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 0dbd9bd..67fa620 100644
+index 0dbd9bd..6facfdf 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -197,6 +197,21 @@ else()
+@@ -197,6 +197,23 @@ else()
  endif()
  
  if(NOT BUILD_FRAMEWORK)
 +	foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
-+		if (LIB MATCHES "-l.*")
++		if (IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
 +			list(APPEND PKG_CXX_LIBS "${LIB}")
++		elseif(${LIB} MATCHES "-l:libunwind.a") # android toolchain
++			list(APPEND IMPLICITS_LIST "-lunwind")
 +		else()
 +			list(APPEND PKG_CXX_LIBS "-l${LIB}")
 +		endif()
@@ -35,5 +37,5 @@ index 0dbd9bd..67fa620 100644
  	install(
          FILES ${CMAKE_CURRENT_BINARY_DIR}/libchromaprint.pc
 -- 
-2.27.0.windows.1
+2.45.0.windows.1
 


=====================================
contrib/src/libaribcaption/0001-Fix-libunwind-static-linking-on-Android-toolchains.patch
=====================================
@@ -0,0 +1,28 @@
+From 1683890643eb99dc230b71886951de5a6945f683 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 16 Oct 2024 10:56:50 +0200
+Subject: [PATCH] Fix libunwind static linking on Android toolchains
+
+As well as llvm-mingw with -static-libgcc
+---
+ cmake/GeneratePkgConfig.cmake | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/GeneratePkgConfig.cmake b/cmake/GeneratePkgConfig.cmake
+index ae9add8..aebf2c1 100644
+--- a/cmake/GeneratePkgConfig.cmake
++++ b/cmake/GeneratePkgConfig.cmake
+@@ -30,7 +30,9 @@ function(generate_pkg_config_pc_file TARGET TEMPLATE template OUTPUT output)
+     if(NOT BUILD_SHARED_LIBS)
+         if(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
+             foreach(IMPLICIT_LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
+-                if (IMPLICIT_LIB MATCHES "-l.*")
++                if(IMPLICIT_LIB MATCHES "-l:libunwind.a") # android toolchain
++                    list(APPEND LIBS_LIST "-lunwind")
++                elseif (IMPLICIT_LIB MATCHES "(-l|/).*")
+                     list(APPEND LIBS_LIST "${IMPLICIT_LIB}")
+                 else()
+                     list(APPEND LIBS_LIST "-l${IMPLICIT_LIB}")
+-- 
+2.45.0.windows.1
+


=====================================
contrib/src/libaribcaption/rules.mak
=====================================
@@ -33,6 +33,7 @@ $(TARBALLS)/libaribcaption-$(LIBARIBCC_VERSION).tar.gz:
 
 libaribcaption: libaribcaption-$(LIBARIBCC_VERSION).tar.gz .sum-libaribcaption
 	$(UNPACK)
+	$(APPLY) $(SRC)/libaribcaption/0001-Fix-libunwind-static-linking-on-Android-toolchains.patch
 	$(MOVE)
 
 LIBARIBCC_CONF := \


=====================================
contrib/src/vulkan-loader/0003-fix-libunwind-usage-when-static-linking.patch
=====================================
@@ -0,0 +1,34 @@
+From ce897781c15a650f59b0c2ffa7dced738b34fa60 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 17 Oct 2024 11:56:18 +0200
+Subject: [PATCH 3/3] fix libunwind usage when static linking
+
+It ends up with
+- set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "atomic;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl")
+- set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "windowsapp;windowsapp;ucrt;windowsapp;ucrtapp;c++;mingw32;-l:libunwind.a;moldname;mingwex;mingw32;-l:libunwind.a;moldname;mingwex")
+---
+ loader/CMakeLists.txt | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
+index 98da79ab8..93ab25f06 100644
+--- a/loader/CMakeLists.txt
++++ b/loader/CMakeLists.txt
+@@ -335,7 +335,13 @@ include(FindPkgConfig QUIET)
+ if(PKG_CONFIG_FOUND)
+     set(VK_API_VERSION "${LOADER_GENERATED_HEADER_VERSION}")
+     foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
+-        set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
++        if (IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
++            set(PRIVATE_LIBS "${PRIVATE_LIBS} ${LIB}")
++        elseif(${LIB} MATCHES "-l:libunwind.a") # android toolchain
++            set(PRIVATE_LIBS "${PRIVATE_LIBS} -lunwind")
++        else()
++            set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
++        endif()
+     endforeach()
+     if(MSVC)
+         set(VULKAN_LIB_SUFFIX "-1")
+-- 
+2.45.0.windows.1
+


=====================================
contrib/src/vulkan-loader/002-proper-def-files-for-32bit.patch
=====================================
@@ -1,5 +1,16 @@
+From 56ce783d2cad375cb29f19be43b5dda7061ded3c Mon Sep 17 00:00:00 2001
+From: Alexey Pavlov <alexpux at gmail.com>
+Date: Fri, 8 Nov 2019 07:40:41 +0100
+Subject: [PATCH 1/3] proper def files for 32bit
+
+---
+ loader/CMakeLists.txt       | 15 +++++++++++++--
+ loader/vk_loader_platform.h |  8 +++++++-
+ loader/vulkan-1.def         |  2 +-
+ 3 files changed, 21 insertions(+), 4 deletions(-)
+
 diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
-index 8bb10fd..fc38ecc 100644
+index d1606f549..0552c5bdd 100644
 --- a/loader/CMakeLists.txt
 +++ b/loader/CMakeLists.txt
 @@ -127,7 +127,7 @@ set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG}Note that this may be unsafe, as the C co
@@ -35,7 +46,7 @@ index 8bb10fd..fc38ecc 100644
      endif()
  elseif(APPLE)
      # For MacOS, use the C code and force the compiler's tail-call optimization instead of using assembly code.
-@@ -261,6 +263,7 @@ endif()
+@@ -217,6 +219,7 @@ endif()
  
  if(WIN32)
      add_library(loader-opt STATIC ${OPT_LOADER_SRCS})
@@ -43,7 +54,7 @@ index 8bb10fd..fc38ecc 100644
      target_link_libraries(loader-opt PUBLIC loader_specific_options)
      add_dependencies(loader-opt loader_asm_gen_files)
      set_target_properties(loader-opt PROPERTIES CMAKE_C_FLAGS_DEBUG "${MODIFIED_C_FLAGS_DEBUG}")
-@@ -237,10 +240,17 @@ if(WIN32)
+@@ -237,9 +240,17 @@ if(WIN32)
      # when adding the suffix the import and runtime library names must be consistent
      # mingw: libvulkan-1.dll.a / libvulkan-1.dll
      # msvc: vulkan-1.lib / vulkan-1.dll
@@ -51,7 +62,6 @@ index 8bb10fd..fc38ecc 100644
      set_target_properties(vulkan
                            PROPERTIES
                            OUTPUT_NAME vulkan-1)
--
 +    else()
 +    set_target_properties(vulkan
 +                          PROPERTIES
@@ -59,11 +69,11 @@ index 8bb10fd..fc38ecc 100644
 +                          RUNTIME_OUTPUT_NAME vulkan-1
 +                          ARCHIVE_OUTPUT_NAME vulkan)
 +    endif()
+ 
      if(MSVC AND ENABLE_WIN10_ONECORE)
          target_link_libraries(vulkan OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB)
-         set_target_properties(vulkan PROPERTIES LINK_FLAGS "/NODEFAULTLIB")
 diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
-index 507a901..6b8fc48 100644
+index 594a24986..6bbe6798b 100644
 --- a/loader/vk_loader_platform.h
 +++ b/loader/vk_loader_platform.h
 @@ -77,7 +77,13 @@
@@ -82,7 +92,7 @@ index 507a901..6b8fc48 100644
  #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
  #define LOADER_EXPORT __attribute__((visibility("default")))
 diff --git a/loader/vulkan-1.def b/loader/vulkan-1.def
-index 6a88b55..1d26b1f 100644
+index f1aab7880..0b8a68ff8 100644
 --- a/loader/vulkan-1.def
 +++ b/loader/vulkan-1.def
 @@ -22,7 +22,7 @@
@@ -94,3 +104,6 @@ index 6a88b55..1d26b1f 100644
  EXPORTS
     vkCreateInstance
     vkDestroyInstance
+-- 
+2.45.0.windows.1
+


=====================================
contrib/src/vulkan-loader/004-disable-suffix-in-static-lib.patch
=====================================
@@ -1,6 +1,17 @@
+From e9e54996189115fd4868cc7be55e2390419e0c57 Mon Sep 17 00:00:00 2001
+From: Biswapriyo Nath <nathbappai at gmail.com>
+Date: Sat, 22 Jan 2022 09:51:26 +0100
+Subject: [PATCH 2/3] disable suffix in static lib
+
+---
+ loader/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
+index 0552c5bdd..98da79ab8 100644
 --- a/loader/CMakeLists.txt
 +++ b/loader/CMakeLists.txt
-@@ -398,7 +398,7 @@
+@@ -337,7 +337,7 @@ if(PKG_CONFIG_FOUND)
      foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
          set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
      endforeach()
@@ -9,3 +20,6 @@
          set(VULKAN_LIB_SUFFIX "-1")
          # Set libdir path as in cmake's FindVulkan.cmake
          # https://github.com/KhronosGroup/Vulkan-Loader/issues/668
+-- 
+2.45.0.windows.1
+


=====================================
contrib/src/vulkan-loader/rules.mak
=====================================
@@ -40,6 +40,7 @@ vulkan-loader: Vulkan-Loader-$(VULKAN_LOADER_VERSION).tar.gz .sum-vulkan-loader
 # https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-vulkan-loader
 	$(APPLY) $(SRC)/vulkan-loader/002-proper-def-files-for-32bit.patch
 	$(APPLY) $(SRC)/vulkan-loader/004-disable-suffix-in-static-lib.patch
+	$(APPLY) $(SRC)/vulkan-loader/0003-fix-libunwind-usage-when-static-linking.patch
 ifeq ($(HOST),i686-w64-mingw32)
 	cp -v $(SRC)/vulkan-loader/libvulkan-32.def $(UNPACK_DIR)/loader/vulkan-1.def
 endif


=====================================
contrib/src/x265/0001-Fix-libunwind-static-linking-on-Android-toolchains.patch
=====================================
@@ -0,0 +1,26 @@
+From c5dd262ca6a31ec77a12fe0141fa4de875c6e7ba Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 16 Oct 2024 10:43:58 +0200
+Subject: [PATCH] Fix libunwind static linking on Android toolchains
+
+As well as llvm-mingw with -static-libgcc.
+---
+ source/CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index 8a3128bb7..8250f9ec7 100755
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -882,6 +882,8 @@ if(X265_LATEST_TAG)
+     foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
+         if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
+             list(APPEND PLIBLIST "${LIB}")
++        elseif(${LIB} MATCHES "-l:libunwind.a") # android toolchain
++            list(APPEND IMPLICITS_LIST "-lunwind")
+         else()
+             list(APPEND PLIBLIST "-l${LIB}")
+         endif()
+-- 
+2.45.0.windows.1
+


=====================================
contrib/src/x265/rules.mak
=====================================
@@ -35,6 +35,7 @@ x265: x265_$(X265_VERSION).tar.gz .sum-x265
 	$(APPLY) $(SRC)/x265/x265-enable-detect512.patch
 	$(APPLY) $(SRC)/x265/0001-api-use-LoadLibraryExA-instead-of-LoadLibraryA.patch
 	$(APPLY) $(SRC)/x265/0001-threadpool-disable-group-affinity-in-UWP-builds.patch
+	$(APPLY) $(SRC)/x265/0001-Fix-libunwind-static-linking-on-Android-toolchains.patch
 	$(call pkg_static,"source/x265.pc.in")
 	$(MOVE)
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/81fbc423b40a0053ff943e832bf6bac2934ba898...8d83dc7834b61ca7fe2e373f98d57a2751c5d21d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/81fbc423b40a0053ff943e832bf6bac2934ba898...8d83dc7834b61ca7fe2e373f98d57a2751c5d21d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list