From b0e0ca4e60483b76383ae3575ef39423fda608d6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 29 Jul 2016 18:14:06 +0200 Subject: Use 64-to-32 cross compiler for VC 12 and 14 32-bit link.exe hangs with /DEBUG. --- INSTALL | 62 +++++++++++++++++++++++++++++++++++++++----------------- msvc-11 | 5 +++-- msvc-12 | 7 ++++--- msvc-14 | 7 ++++--- msvc-14u2 | 7 ++++--- msvc-cl-common | 2 +- msvc-lib-common | 4 ++++ msvc-link-common | 2 +- 8 files changed, 64 insertions(+), 32 deletions(-) diff --git a/INSTALL b/INSTALL index c8da45b..dec36a9 100644 --- a/INSTALL +++ b/INSTALL @@ -32,12 +32,24 @@ Install Wine You need 1.7.55 or later. Previous versions are known not to work with Visual Studio 14. -For Ubuntu: +For Ubuntu, to install stable: # add-apt-repository ppa:ubuntu-wine/ppa # apt-get update # apt-get install --no-install-recommends winbind # apt-get install wine1.7 wine-mono4.5.6 wine-gecko2.40 +# apt-get install p11-kit-modules:i386 libp11-kit-gnome-keyring:i386 + + +For Ubuntu, to install staging (into /opt/): + +# add-apt-repository ppa:wine/wine-builds +# apt-get update +# apt-get install --install-recommends wine-staging + +To install compatibility symlinks: + +# apt-get install winehq-staging Configure Wine @@ -94,10 +106,11 @@ Add lower-case symlinks for upper-case named headers: $ etc/lowercase-headers \ ".wine/drive_c/Program Files (x86)/Windows Kits/8.0/Include" -Run the VC11 redistributable DLLs installer for x86 from .../VC/redist/1033/. +Run the VC11 redistributable DLLs installer for both x64 and x86 from +.../VC/redist/1033/. -Add override for msvcr110.dll: run winecfg, select the "Libraries" tab, then -enter the DLL name and "Add". +Add overrides for msvcr110.dll and msvcp110.dll: run winecfg, select the +"Libraries" tab, then enter the DLL name and "Add". Copy and Setup Visual Studio 12 @@ -116,17 +129,19 @@ Add lower-case symlinks for upper-case named headers: $ etc/lowercase-headers \ ".wine/drive_c/Program Files (x86)/Windows Kits/8.1/Include" -Run the VC12 redistributable DLLs installer for x86 from .../VC/redist/1033/. +Run the VC12 redistributable DLLs installer for both x64 and x86 from +.../VC/redist/1033/. -Add override for msvcr120.dll: run winecfg, select the "Libraries" tab, then -enter the DLL name and "Add". +Add overrides for msvcr120.dll and msvcp120.dll: run winecfg, select the +"Libraries" tab, then enter the DLL name and "Add". Copy and Setup Visual Studio 14 ------------------------------- -Note: 14 Update 2 requires Wine 1.9.8 or later (bug #34851). -Note: if using 14 Update 2, then use the *-14u2 driver scripts. +Note: If using 14 Update 2, then use the *-14u2 driver scripts. +Note: 14 Update 2 requires Wine 1.9 or later (bug #34851). +Note: 14 Update 2 is known to work with Wine 1.9.7, 1.9.8 but not 1.9.15. $ mkdir -p ".wine/drive_c/Program Files (x86)/Microsoft Visual Studio 14.0" $ cp -r "/mnt/Program Files (x86)/Microsoft Visual Studio 14.0/VC" \ @@ -136,7 +151,8 @@ $ cp "/mnt/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x86/Micros Remove Microsoft's "experience improvement data uploade" which crashes: -$ rm ".wine/drive_c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/vctip.exe" +$ find ".wine/drive_c/Program Files (x86)/Microsoft Visual Studio 14.0/" \ + -name vctip.exe -exec rm -f '{}' ';' $ mkdir -p ".wine/drive_c/Program Files (x86)/Windows Kits" $ cp -r "/mnt/Program Files (x86)/Windows Kits/8.1" \ @@ -151,28 +167,36 @@ $ etc/lowercase-headers \ ".wine/drive_c/Program Files (x86)/Windows Kits/10/Include" Installing via the redistributable DLLs still does not work as of Wine 1.7.55. -Instead, we have to manually copy a bunch of DLLs from /mnt/Windows/SysWoW64/ -to VC/bin/ and add Wine overrides (run winecfg, select the "Libraries" tab, -then enter the DLL name and "Add"). +Instead, we have to manually copy a bunch of DLLs from /mnt/Windows/{SysWoW64/ +System32/} to .wine/drive_c/windows/{syswow64/ system32/} and add Wine +overrides (run winecfg, select the "Libraries" tab, then enter the DLL name +and press "Add"). -To discover the list of DLLs, run cl-14 to compile and link and executable -(see Test below): any DLL that causes an error needs an override. +To discover the list of DLLs, run cl-14 to compile and link and an executable +and then run the executable itself (see Test below): any DLL that causes an +error needs an override. -For Wine 1.7.55 the list is: +For Wine 1.7.55-1.9.8 the list is: api-ms-win-crt-runtime-l1-1-0.dll - ucrtbase.dll api-ms-win-crt-locale-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll - vcruntime140.dll api-ms-win-crt-stdio-l1-1-0.dll api-ms-win-crt-conio-l1-1-0.dll + ucrtbase.dll + vcruntime140.dll + msvcp140.dll + +The following overrides are necessary because of some unimplemented functions: + + api-ms-win-crt-string-l1-1-0.dll + api-ms-win-crt-time-l1-1-0.dll Test ---- -cl-NN /EHsc /TP hello-world.cxx +cl-NN /EHsc /MD /TP hello-world.cxx ./hello-world.exe diff --git a/msvc-11 b/msvc-11 index 4fcee37..e226f5c 100755 --- a/msvc-11 +++ b/msvc-11 @@ -1,8 +1,8 @@ #! /usr/bin/env bash -# MSVC 11 setup/configuration. +# MSVC 11 32-bit setup/configuration. # -# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. +# Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # # SDK @@ -17,6 +17,7 @@ LIB="$SDK\\lib\\win8\\um\\x86" # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC" VCBIN="$VC\\bin" +VCDLL="$VC\\bin" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" diff --git a/msvc-12 b/msvc-12 index e124a1b..e4d9500 100755 --- a/msvc-12 +++ b/msvc-12 @@ -1,8 +1,8 @@ #! /usr/bin/env bash -# MSVC 12 setup/configuration. +# MSVC 12 32-bit setup/configuration (note: using 64-to-32 cross-compiler). # -# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. +# Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # # SDK @@ -16,7 +16,8 @@ LIB="$SDK\\lib\\winv6.3\\um\\x86" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC" -VCBIN="$VC\\bin" +VCBIN="$VC\\bin\\amd64_x86" +VCDLL="$VC\\bin\\amd64" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" diff --git a/msvc-14 b/msvc-14 index 2e0c53a..77e2259 100755 --- a/msvc-14 +++ b/msvc-14 @@ -1,8 +1,8 @@ #! /usr/bin/env bash -# MSVC 14 setup/configuration. +# MSVC 14 32-bit setup/configuration (note: using 64-to-32 cross-compiler). # -# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. +# Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # # SDK @@ -24,7 +24,8 @@ LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" -VCBIN="$VC\\bin" +VCBIN="$VC\\bin\\amd64_x86" +VCDLL="$VC\\bin\\amd64" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" diff --git a/msvc-14u2 b/msvc-14u2 index 0f6d1f7..8792e5d 100755 --- a/msvc-14u2 +++ b/msvc-14u2 @@ -1,8 +1,8 @@ #! /usr/bin/env bash -# MSVC 14U2 setup/configuration. +# MSVC 14U2 32-bit setup/configuration (note: using 64-to-32 cross-compiler). # -# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables. +# Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # # SDK @@ -25,7 +25,8 @@ LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" # VC # VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" -VCBIN="$VC\\bin" +VCBIN="$VC\\bin\\amd64_x86" +VCDLL="$VC\\bin\\amd64" INCLUDE="$VC\\include;$INCLUDE" LIB="$VC\\lib;$LIB" diff --git a/msvc-cl-common b/msvc-cl-common index e101dd8..597b0e5 100755 --- a/msvc-cl-common +++ b/msvc-cl-common @@ -147,6 +147,6 @@ export LIB # The linker may need to run mt.exe which is in the SDK. # -export WINEPATH=$SDKBIN +export WINEPATH="$VCBIN;$VCDLL;$SDKBIN" msvc_exec $diag "$VCBIN\\cl.exe" "${args[@]}" diff --git a/msvc-lib-common b/msvc-lib-common index 4cd1c51..e533829 100755 --- a/msvc-lib-common +++ b/msvc-lib-common @@ -90,6 +90,10 @@ done export LIB +# link.exe may need to run other tools (/LTCG). +# +export WINEPATH="$VCBIN;$VCDLL;$SDKBIN" + # lib.exe always sends diagnostics to stdout. # msvc_exec 1 "$VCBIN\\lib.exe" "${args[@]}" diff --git a/msvc-link-common b/msvc-link-common index a83bac9..7cd121b 100755 --- a/msvc-link-common +++ b/msvc-link-common @@ -179,7 +179,7 @@ export LIB # link.exe may need to run mt.exe which is in the SDK. # -export WINEPATH=$SDKBIN +export WINEPATH="$VCBIN;$VCDLL;$SDKBIN" # link.exe always sends diagnostics to stdout. # -- cgit v1.1