swiftlang / swift-installer-scripts

Apache License 2.0
68 stars 34 forks source link

Windows ARM64 installer.exe installs the multi-arch SDK under Program Files (x86) when Program Files was selected #301

Open egorzhdan opened 1 month ago

egorzhdan commented 1 month ago

Description

If I run the installer and customize the installation path to be Program Files with no arch suffix, the installer still installs the SDK into Program Files (x86), despite the fact that the SDK contains slices for ARM64 as well as x86.

Reproduction

Try out an installer.exe artifact from https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/

Expected behavior

I expect the installer to respect the custom installation path I selected and install the SDK under that path.

Environment

ARM64 Windows 11

Additional information

No response

egorzhdan commented 1 month ago

cc @compnerd @shahmishal

compnerd commented 1 month ago

I believe that this is intentional. The %ProgramFiles(x86)% is the universal location - x86, x64, and arm64 will always have this location. This is how we get away installing the content irrespective of the architecture.

egorzhdan commented 1 month ago

I see. This seems a bit confusing to me, but I don't use Windows often, so I don't have a strong opinion on the choice of the default Program Files directory ("Program Files (x86)" vs "Program Files (arm)" vs "Program Files").

I do believe, however, that we shouldn't be installing things to or modifying any files outside of the explicitly selected installation path.

compnerd commented 1 month ago

Yeah, the problem is that you cannot install a foreign architecture except for x86. That is, we would not be able to install the ARM64 SDK on X64 IIRC.

tristanlabelle commented 1 month ago

This is probably because the installer itself runs as an x86 program, so what it thinks of as "Program Files" is actually "Program Files (x86)".

But also, since the installer is per-user, forcing it to install to a machine-wide location might have unintended effects. For example, I think we only set SDKROOT as a user environment variable.

This issue would be better suited for apple/swift-installer-scripts