[vlc-commits] package/win32: build.sh: do not link with ucrtbase

Steve Lhomme git at videolan.org
Thu Jun 18 14:54:36 CEST 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun  3 11:04:07 2020 +0200| [322be7d1498cef9f8d1c495142738d9d5dea0372] | committer: Steve Lhomme

package/win32: build.sh: do not link with ucrtbase

It's not allowed to link directly to the library (even though it exists).

For UCRT builds not packaged by MSVC vcruntime140* will not be found. It's not
a problem for UWP/UWP apps that are always built with MSVC.

It's a problem for UCRT builds that we might want to do in the future without
MSVC at all. We will need a replacement library for the calls we use. Some are
currently linked with a api-ms-win-crt-private DLL.

(cherry picked from commit 06988f465caaea51763d2c4d0109a6fa8973b093)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=322be7d1498cef9f8d1c495142738d9d5dea0372
---

 extras/package/win32/build.sh | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 1c597c33bd..958ebe90d2 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -200,16 +200,20 @@ if [ ! -z "$BUILD_UCRT" ]; then
         CFLAGS="$CFLAGS -Wl,-lwindowsapp,-lwinstorecompat"
         CXXFLAGS="$CXXFLAGS -Wl,-lwindowsapp,-lwinstorecompat"
         CPPFLAGS="$CPPFLAGS -DWINSTORECOMPAT"
+        EXTRA_CRUNTIME="vcruntime140_app"
     else
         SHORTARCH="$SHORTARCH-ucrt"
+        # this library doesn't exist yet, so use ucrt twice as a placeholder
+        # EXTRA_CRUNTIME="vcruntime140"
+        EXTRA_CRUNTIME="ucrt"
     fi
 
-    LDFLAGS="$LDFLAGS -lucrtbase -lucrt"
+    LDFLAGS="$LDFLAGS -l$EXTRA_CRUNTIME -lucrt"
     if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
-        # tell gcc to replace msvcrt with ucrtbase+ucrt
-        CFLAGS="$CFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
-        CXXFLAGS="$CXXFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
-        LDFLAGS="$LDFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
+        # tell gcc to replace msvcrt with $EXTRA_CRUNTIME+ucrt
+        CFLAGS="$CFLAGS -mcrtdll=$EXTRA_CRUNTIME -mcrtdll=ucrt"
+        CXXFLAGS="$CXXFLAGS -mcrtdll=$EXTRA_CRUNTIME -mcrtdll=ucrt"
+        LDFLAGS="$LDFLAGS -mcrtdll=$EXTRA_CRUNTIME -mcrtdll=ucrt"
 
         if [ ! -z "$WINSTORE" ]; then
             # trick to provide these libraries before -ladvapi32 -lshell32 -luser32 -lkernel32
@@ -218,8 +222,8 @@ if [ ! -z "$BUILD_UCRT" ]; then
             LDFLAGS="$LDFLAGS -mcrtdll=windowsapp -mcrtdll=winstorecompat"
         fi
     else
-        CFLAGS="$CFLAGS -Wl,-lucrtbase,-lucrt"
-        CXXFLAGS="$CXXFLAGS -Wl,-lucrtbase,-lucrt"
+        CFLAGS="$CFLAGS -Wl,-l$EXTRA_CRUNTIME,-lucrt"
+        CXXFLAGS="$CXXFLAGS -Wl,-l$EXTRA_CRUNTIME,-lucrt"
     fi
 
     # the values are not passed to the makefiles/configures



More information about the vlc-commits mailing list