1
votes

I want to compile C++ project using Windows SDK 7.1 for x86_32. I'm using clean Windows XP SP3 x86_32 with latest updates. Project (name doesn't matter) is a crossplatform one, is built using Makefiles (no vcxproj/msbuild) and contains only unmanaged C++ code (no C# or other managed code).

I've installed Windows SDK 7.1 (it requires .NET Framework 2.0 to run installer and .NET Framework 4.0 to install C++ compiler), set compile environment using SetEnv.cmd script from SDK and built project successfully.

Now I need to test build on different Windows versions (2003, Vista, 7, 2008) using the same Windows SDK. I don't want to install Windows SDK from ISO every time I need to test build on clean OS - it takes a lot of time. Instead, I want to have a folder with C++ compiler, that I can copy to clean Windows instance, copy code sources next to it and run batch script to start build.

So I copied all Windows SDK files to another folder uninstalled Windows SDK, C++ Compilers and .NET Framework 2.0. Than copied Windows SDK files back to original folders (I can move them anywhere changing SetEnv.cmd script accordingly). After that build works fine.

But when I uninstalled .NET Framework 4.0, build fails on link.exe call:

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

I thought, that link.exe use some libraries or tools from .NET Framework 4.0 installation, so I copied C:\WINDOWS\Microsoft.NET folder before uninstallation and then copy it back to original place. That doesn't help.

I googled LNK1123 and only advices were: "install VS2010SP1" (that I don't use at all) and "reinstall .NET Framework 4.0" (that works, but this is exactly the thing I'm trying to avoid).

Different compilers is not an option: on Windows this project supports only compiler from VS2010 (that is included in Windows SDK 7.1).

I'm in confusion - does link.exe for x86_32 from Windows SDK 7.1 really requires .NET Framework 4.0 runtime (not some libraries or native tools) to build completely native and unmanaged C++ code (that is not going to be used with CLR in any way)?

1
Link.exe is also used to link mixed-mode assemblies. You could run dumpbin.exe /imports and see an implicit dependency on mscoree.dll, the .NET bootstrapper. The only reason you even got it started was because you probably didn't uninstall .NET properly. Random failure would be next. So yes, it most definitely requires .NET.Hans Passant
@HansPassant , thanks for the hint on delayed-load dependencies, I recheked dlls, mscoree.dll is not required for the build but msvcr100_clr0400.dll is required and was missed from system32 after framework uninstall.alexkasko

1 Answers

2
votes

Solved it, .NET Framework 4.0 runtime is not required for link.exe for unmanaged dlls. To run the copy of Windows SDK 7.1 toolchain on clean Windows XP SP3 (neither SDK nor framework have ever been installed there) these libraries must be added to %PATH%:

msvcp100.dll
msvcr100.dll
msvcr100_clr0400.dll