Enable using Microsoft Visual Studio x64 tools in incredibuild - c++

We have VS2010 pro and Incredibuild 4.62 installed. We are trying to compile to x64 platform, therefore we run
"C:\Program Files (x86)\Xoreax\IncrediBuild\BuildConsole.exe" something.sln /MINWINVER=7 /build release|x64
The issue is that this uses 32 bit cl.exe to compile 64 bit object files, which may be slow and runs into memory issues.
It prints to the console: Setting environment for using Microsoft Visual Studio 2010 x64 cross tools.
It should do x64 tools simply.

My name is Victor and I am from the IncrediBuild support team.
When you are building for the x64 platform in Visual Studio, by default, the compiler that is being used is actually the cross compiler located in the “x86_amd64” folder.
In order to ensure full compatibility to Visual Studio builds, IncrediBuild has to use the same compilers that are being used in Non-IncrediBuild builds.
From our experience – the 32 bit cross compiler and the 64 bit compilers have the same speed, and we have never encountered a state where a compiler running out of memory, so using the native x64 toolset would not yield any benefits.
If however you would like to make the switch to the native x64 toolset – you need to define a new toolset with Visual Studio, which points to the x64 tools.
Once the toolset is defined, and is set to be used in the projects properties - IncrediBuild will use it automatically.

Related

How to compile C++ app for Windows XP in MSVS?

As I read this article, it is enough to download most recent MSVS 2022 and then install toolset C++ Windows XP Support for VS 2017 (v141) tools [Deprecated].
After that in Visual Studio inside project properties I set this toolset. According to linked article it is enough to compile C++ app with XP support.
But after my .exe file is created if I run it on XP 64-bit SP2 then it shows error that CompareStringEx function is not found in KERNEL32.DLL.
Hence it appears that it is not enough to use this toolset. Something else is needed.
In some other places I see that one needs also to add define /D_USING_V110_SDK71_ when compiling and option /SUBSYSTEM:CONSOLE,5.01 when linking. In my project properties I also tried to add this two options, but still CompareStringEx is inside import table of final application.
As suggested by #BenVoigt, I did defines /DWINVER=0x0502 /D_WIN32_WINNT=0x0502. Also set C++ standard to /std:c++14 (I would set C++11 but this MSVS version allows to set only C++14 at minimum). Still some non-XP symbols remain in final EXE like InitializeSRWLock that is possibly used by C++11's std::mutex in my code.
Does anyone know everything what is needed in order to compile fully XP-compatible application?
Update. I managed to build working XP application by doing things above plus setting C++ CRT runtime to Multi Threaded DLL, i.e. using dynamic DLL linkage of CRT. Also as suggested by #ChuckWalbourn (down x86 or x64 redists), I downloaded older version of msvcp140.dll.
But it is very important for my project to have statically linked runtime (C++ CRT), i.e. use Multi Threaded value for Runtime field in project properties. Only if it is REALLY not possible only then I will use DLL CRT. Until then solution about how to link CRT statically are welcome, of course to produce XP-compatible EXE.
TL;DR For Window XP VC++ REDIST support, install https://aka.ms/vs/15/release/VC_redist.x86.exe on your Windows XP system
-or-
if you are doing "side-by-side application local deployment", then use the DLLs from C:\Program Files\Microsoft Visual Studio\2022\<edition>\VC\Redist\MSVC\14.16.27012\x86\Microsoft.VC141.CRT.
If you want the latest bug fixes to the CRT, you can also download the REDIST for VS 2019 (16.7) per the link on Microsoft Docs.
For Windows XP targeting, you use the v141_xp Platform Toolset installed by Visual Studio (VS 2017, VS 2019, or VS 2022) which is the latest VS 2017 (v141) C++ compiler using an included Windows 7.1A SDK.
Make sure you have installed (for VS 2022) the following individual components since you are using MFC:
Microsoft.VisualStudio.Component.WinXP: C++ Windows XP Support for VS 2017 (v141) tools [Deprecated]
Microsoft.VisualStudio.Component.VC.v141.x86.x64: MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)
Microsoft.VisualStudio.Component.VC.v141.MFC: C++ MFC for v141 build tools (x86 & x64)
If you are doing DirectX development, be sure to read this blog post as well for various implications of using the Windows 7.1A SDK.
For deployment to Windows XP, you can install the latest VS 2017 Visual C++ REDIST or use VS 2019 Visual C++ up to VS 2019 (16.7). After that the REDIST DLLs themselves are not compatible with Windows XP.
On your development system with VS 2022 installed, you are going to have a newer set of Visual C++ REDIST files which are binary compatible with your v141_xp Platform Toolset built EXE, but those VC++ REDIST DLLs are not compatible with Windows XP.
IOW: If you look at a dumpbin /imports of the 14.30 (v143 version), 14.29 (v142 latest version), and/or 14.16 (v141 latest version ) copies of msvcp140.dll you will see different imports. The msvcp140.dll sitting in your C:\windows\SysWOW64 folder is going to be the 14.30 version.

what is msvc_x64_x64 and how is different from msvc_x64

I am using visual studio 2019 with cmake project. When opening cmake settings UI in visual studio IDE, it shows a list of toolset for a C++ project.
From the list of toolsets, I have msvc_x64 and msvc_x64_x64. I want to build on native x64, so I can simply select msvc_x64.
But why there is two toolset named x64 and x64_x64?
Is it the same thing or they are maintaining two names for some sort of backward compatibility?
As per docs, I can understand the naming conventions for toolsets such as msvc_x86_x64, amd64, x64_arm etc.. I would like to learn about x64 and x64_x64 and why these two exist?
Is there any difference between two ? If so can I get some documentation about it?
msvc_x64
This toolset is to target x64 with the x86 version of MSVC.
msvc_x64_x64
This toolset is to target x64 with the x64 version of MSVC.

Visual Studio 2015 - missing 64 bit compiler

Currently I'm working with Visual Studio 2015 on a 32-Bit computer and create 32-bit applications in C++/CLI.
As far as I remember one could choose between creating 32 and 64-Bit applications in previous Visual Studio versions, if one has installed the 64-Bit compiler too.
Today I was trying to get the same functionality out of the 2015's version of Visual Studio, but I'm not able to find any option to install the 64-Bit compiler.
In the compiler-settings I can only choose between ARM and 32-Bit (no 64-Bit, no "any platform"). Running the Visual Studio Setup from the Windows system preferences also shows no possibility to install the 64-Bit compiler (or maybe i just don't know what to install).
QUESTION: How can I install the 64-Bit C++ compiler for Visual Studio 2015 on a 32-Bit computer?
#GSerg gave the aswer I needed in his first comment - thank you for your help!
The compiler seems to be installed by default. I just wasn't able to find the way to set the platform.

Automatically building for best available platform in visual c++ (equivalent to gcc's -march=native)

I would like to distribute Visual Studio project files as part of a source only distribution in such a way that it will automatically build for the native architecture of the user's machine. So, if they have 64 bit it will build for it, if they have AVX or AVX2 it will build for those. This is what gcc's -march=native flag does. I haven't been able to find an equivalent to this with visual studio - does it exist or is there a workaround? I'm using Visual Studio Express 2013, and I'd like it to be something that would work with one of the free Express versions as most users won't have access to one of the paid versions. Thanks!

visual studio 2008 C++ no x64 platform

I installed Visual Studio 2008 on my Windows 7 x64 laptop together with installation of Service Pack 1.
Now I want to add x64 platform to my C++ solution. But there is no x64 platform available in the configuration manager for my project. I'm sure I manually selected x64 support during the Visual Studio installation and it was installed.
What is wrong with my setup?
If I recall, VS 2008 Pro doesn't install the 64-bit compiler and tools by default. You have to explicitly select them during the installation.
Control Panel -> Uninstall Programs.
Select Visual Studio and click Uninstall/Change.
Wait. Wait some more. Click Next.
Choose Add or Remove Features.
Expand MSVC 2008 -> Language Tools -> Visual C++.
Select X64 Compilers and Tools.
You'll probably need your original installation media.
Once the 64-bit compiler and tools are installed, you should be able to add a 64-bit configuration to your solution.
See "Use Visual Studio to build 64-bit application" for all you need to build x64 apps with Visual Studio 2008.
Visual Studio 2008 only comes with x64 compiler with the Professional editions and higher. You can download the free Windows SDK from MSDN to get the x64 compiler.
If your projects don't have the x64 configuration, just add that configuration via the configuration manager. I don't remember if 2008 created the x64 configuration by default but I suspect not.
I also seem to remember that you can just add the x64 configuration to the solution and it will prompt on whether or not to add it to all of the contained projects but my memory is rusty on that one.
Regardless, once you've got the configurations added, you'll need to modify anything you'd modified before in project settings. Output paths, library dependencies, etc. The New Configuration "Wizard" is pretty dumb.