msvc2013onwine icon indicating copy to clipboard operation
msvc2013onwine copied to clipboard

This script helps you set up an MSVC 2013 Update 4 installation on Linux to run under wine.

Instructions

Before you start, make sure you have a Windows machine with a working Python environment (I have used the Python that comes with MozillaBuild) with lots of free disk space.

On the Windows machine, first download and install Visual C++ 2013 Community Edition from http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx. Then, run python package_from_installed.py. It will take a while, and once it finishes successfully, there should be a .zip file in the current working directory. That is your Visual C++ installation, packaged and ready to be transfered into a Linux machine.

On the Linux machine, extract the ZIP package somewhere. Then, you can run MSVC like this:

$ cd /path/to/win_toolchain_2013 $ export INCLUDE="$PWD/VC/include;$PWD/win8sdk/Include/shared/;$PWD/win8sdk/Include/um/;$PWD/win8sdk/Include/winrt/" $ export LIB="$PWD/VC/lib;$PWD/win8sdk/Lib/winv6.3/um/x86" $ echo "#include " > test.cpp $ echo "int main() { std::cout << "Hello from MSVC"; }" >> test.cpp $ export WINEDEBUG=-all # to turn off wine's warnings about unimplemented stuff $ cp sys32/msvcr120.dll VC/bin # need the native version of this DLL $ export WINEDLLOVERRIDES="*msvcr120=n" # tell wine to use the native DLL $ wine VC/bin/cl.exe test.cpp Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101.1 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

test.cpp /media/ehsan/KINGSTON/win_toolchain_2013/VC/include\xlocale(337) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc Microsoft (R) Incremental Linker Version 12.00.31101.1 Copyright (C) Microsoft Corporation. All rights reserved.

/out:test.exe test.obj $ wine ./test.exe Hello from MSVC

Acknowledgements

Thanks to the Chromium project's depot_tools. The package_from_installed.py script originally comes from commit 797060631a486e61dec3bab8b30f35765328660f of that project.