Description
Current behavior 😯
On the GitHub release pages where binaries can be downloaded, the four archives named to indicate that they are i686-pc-windows-msvc
builds are actually all x86_64-pc-windows-msvc
builds.
I don't believe this is specific to recent versions. But in the current latest version the affected archives are:
- gitoxide-lean-v0.37.0-i686-pc-windows-msvc.zip
- gitoxide-max-pure-v0.37.0-i686-pc-windows-msvc.zip
- gitoxide-max-v0.37.0-i686-pc-windows-msvc.zip
- gitoxide-small-v0.37.0-i686-pc-windows-msvc.zip
Downloading these releases from a releases page or using gh release download
, or attempting to automatically download and install them using cargo binstall
, obtains 64-bit executables instead.
This problem appears specific to the 32-bit Windows releases. Other releases all appear to be of the claimed architecture.
The cause?
The release workflow contains win32-msvc
jobs that are meant to build and produce archives of 32-bit Windows executables. But this is producing archives of 64-bit executables instead.
I'm not sure exactly what is going on. It seems to me from the build output that those jobs' behavior may be accidentally equivalent in effect to that of the win-msvc
jobs--that is, they may be building the wrong target. But I may just be reading the build output wrong.
However, separately from the compilation itself, it looks like there is a bug in the "Build archive" step, where it accounts for the target that was built on Unix-like systems but does not account for it on Windows:
That shows that, on Windows, the files being copied for inclusion in the archive are specified as:
target/release/${{ env.EXE_NAME }}.exe target/release/gix.exe
While, in contrast, on other operating systems, they are specified as:
target/${{ matrix.target }}/release/${{ env.EXE_NAME }} target/${{ matrix.target }}/release/gix
If that is not the full cause, or the needed fix is not immediately apparent when you look at it, then I would be pleased to investigate further and try to fix it.
I am not sure of the best way is to experiment with this, but it looks feasible. In my fork, I could remove the "Upload release archive" step check the output in some other way. Or if necessary I could leave it in and publish "releases" from my fork while testing.
Expected behavior 🤔
The releases for Windows marked i686
should target that architecture rather than x86_64
.
(If some builds with particular feature configuration cannot be produced, then they can simply be omitted. But I suspect they all can be built. In particular, rust-lang/libz-sys#197 does not seem to affect local cross-compilation from a 64-bit Windows machine.)
Git behavior
32-bit builds of Git for Windows offered for download are 32-bit, targeting i686.
Steps to reproduce 🕹
This can be verified manually, by attempting to install a 32-bit build with cargo binstall
and examining the result, or semi-automatically by downloading all archives of a release and checking which of them match the archive names.
Demonstration with cargo binstall
This is from a 32-bit Windows 10 system:
PS C:\Users\ek> cargo binstall gitoxide
INFO resolve: Resolving package: 'gitoxide'
WARN The package gitoxide v0.37.0 (i686-pc-windows-msvc) has been downloaded from github.com
INFO This will install the following binaries:
INFO - ein.exe (ein.exe -> C:\Users\ek\.cargo\bin\ein.exe)
INFO - gix.exe (gix.exe -> C:\Users\ek\.cargo\bin\gix.exe)
Do you wish to continue? yes/[no]
? y
INFO Installing binaries...
INFO Done in 26.3840891s
PS C:\Users\ek> gix
ResourceUnavailable: Program 'gix.exe' failed to run: An error occurred trying to start process 'C:\Users\ek\.cargo\bin\gix.exe' with working directory 'C:\Users\ek'. The specified executable is not a valid application for this OS platform.At line:1 char:1
+ gix
+ ~~~.
PS C:\Users\ek> ein
ResourceUnavailable: Program 'ein.exe' failed to run: An error occurred trying to start process 'C:\Users\ek\.cargo\bin\ein.exe' with working directory 'C:\Users\ek'. The specified executable is not a valid application for this OS platform.At line:1 char:1
+ ein
+ ~~~.
PS C:\Users\ek> &'C:\Program Files\Git\usr\bin\file' 'C:\Users\ek\.cargo\bin\gix.exe'
C:\Users\ek\.cargo\bin\gix.exe: PE32+ executable (console) x86-64, for MS Windows
PS C:\Users\ek> &'C:\Program Files\Git\usr\bin\file' 'C:\Users\ek\.cargo\bin\ein.exe'
C:\Users\ek\.cargo\bin\ein.exe: PE32+ executable (console) x86-64, for MS Windows
Demonstration checking binaries in all archives of a release
Downloading all archives of a release can be done with the gh
command. I did the following in PowerShell on a Windows system with 7-Zip installed (providing the 7z
command) and with the MSYS2 file
command made available in the PATH
:
mkdir gitoxide-v0.37.0-release
cd gitoxide-v0.37.0-release
gh release -R byron/gitoxide download v0.37.0
gci | %{ 7z x $_ }
gci *.tar | %{ 7z x $_ }
file */gix* */ein*
file */gix* */ein* | sls -raw i686
This confirmed that all i686-pc-windows-msvc
archives were affected, with their executables being x86_64
rather than i686
, and that no other archives were affected. The full transcript is in this gist. The most useful part is the output of the last command, which is:
gitoxide-lean-v0.37.0-i686-pc-windows-msvc/gix.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-max-pure-v0.37.0-i686-pc-windows-msvc/gix.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-max-v0.37.0-i686-pc-windows-msvc/gix.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-small-v0.37.0-i686-pc-windows-msvc/gix.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-lean-v0.37.0-i686-pc-windows-msvc/ein.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-max-pure-v0.37.0-i686-pc-windows-msvc/ein.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-max-v0.37.0-i686-pc-windows-msvc/ein.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections
gitoxide-small-v0.37.0-i686-pc-windows-msvc/ein.exe: PE32+ executable (console) x86-64, for MS Windows, 5 sections