lorenz / winsysroot

Automatically assemble Windows Sysroots directly from Microsoft sources
Other
3 stars 0 forks source link

build windows sysroot from iso? #1

Open bdlmt opened 7 months ago

bdlmt commented 7 months ago

Hi, I'm attempting to create a windows sysroot on linux, to compile an old app that uses SDK 6.1. I was able to download an iso image from Microsoft, which contains mostly cab files and an installer. Running the installer via wine seems to be a rabbit hole of dependencies, so I'm trying to avoid it.

Is there a way to point your winsysroot project at one of microsoft's iso images, to extract everything from those cab files and construct a usable sysroot?

lorenz commented 7 months ago

First, the Windows SDK itself is not enough to build a working sysroot. The sysroot is composed of a component of Visual Studio called VCTools and a Windows SDK. Second, the code is designed to work with Microsoft manifests to figure out what it needs, which your old ISO most likely lacks. You can try to adapt the code in sdk.go to work with a MSI file, but 6.1 is very old and might not work and you still need VCTools. Also I would be surprised if LLVM just works with headers that old. These headers were only written for the Visual Studio compiler back then.

bdlmt commented 7 months ago

First, the Windows SDK itself is not enough to build a working sysroot. The sysroot is composed of a component of Visual Studio called VCTools and a Windows SDK. Second, the code is designed to work with Microsoft manifests to figure out what it needs, which your old ISO most likely lacks. You can try to adapt the code in sdk.go to work with a MSI file, but 6.1 is very old and might not work and you still need VCTools.

Okay, thanks for the info. I'll take a look at VCTools, and check to see if the 6.1 SDK included manifests.

Also I would be surprised if LLVM just works with headers that old. These headers were only written for the Visual Studio compiler back then.

The clang-cl driver uses -fms-extensions and -fms-compatibility, so that part may be fine.

I'm attempting to replicate an old build. Worst case, I may give up on that and just update the app source to build against a newer SDK. Either that or spin up a VM to install VS2008 and SDK 6.1, and create a sysroot from there.

Thanks again for the response, and for making this project available.

lorenz commented 7 months ago

If by 6.1 you really mean the NT 6.1 aka Windows 7/2008R2 SDK, it definitely does not include manifests. These were never included in any ISOs and are only used for web component installs (which AFAIK started with 14 aka Visual Studio 2015).

The VCTools are part of a normal Visual Studio install, but I'm not sure you can get them standalone (well, officially you still can't but this does it anyways) for versions before the manifest-based web installers (so Visual Studio 2015+).

While clang-cl does have Microsoft header compatibility (which is still required even for the latest SDKs), most clang-cl porting work was done on much later SDKs and modern SDKs also have explicit clang compatibility defines.