-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.github, cli, completion: cross-compile arm64 Windows asset #797
Conversation
77b3c1c
to
80fd33b
Compare
80fd33b
to
672ddad
Compare
The new job indicated success, but didn't upload an executable. This was because on the Windows runner, the default shell is PowerShell: Run ./.github/bin/install-zig ./.github/bin/install-zig shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'" Explicitly set the shell to bash for every cross compilation job.
Fix error: CC: configlet.nim Hint: [Link] Hint: mm: refc; threads: on; opt: size; options: -d:release 92399 lines; 54.815s; 167.895MiB peakmem; proj: D:\a\configlet\configlet\src\configlet.nim; out: D:\a\configlet\configlet\configlet.exe [SuccessX] Info: Nimble data file "C:\Users\runneradmin\.nimble\nimbledata2.json" has been saved. stripping large comment section from executable... C:\Program Files\LLVM\bin\llvm-strip.exe: error: 'configlet': no such file or directory (It turns out that `llvm-strip` is installed in the Windows runners).
Some llvm-strip usage: --remove-section=section Remove <section> -R <value> Alias for --remove-section --strip-all-gnu Compatible with GNU's --strip-all --strip-all Remove non-allocated sections outside segments. .gnu.warning* and .ARM.attribute sections are not removed --strip-debug Remove all debug sections --strip-sections Remove all section headers and all sections not in segments --strip-symbol=symbol Strip <symbol> --strip-unneeded Remove all symbols not needed by relocations -S Alias for --strip-debug -s Alias for --strip-all
The build workflow ran successfully and created this release, which @ErikSchierboom Do you have access to an arm64 Windows machine? If so, could you test the above configlet? |
Hmm, why does I'll see if not stripping makes a difference, but I'd guess that the executable really is x86-64 right now. |
Unfortunately I don't. Maybe ask on the forum? |
The x86_64 Windows archive is .zip.
Try to suppress 10,000 lines of output. It printed a line for each extracted file.
dumpbin probably exists somewhere on the runner, but it wasn't found.
I don't understand why it seems to be outputting an x86_64 executable: $ .github/bin/cross-compile
[...]
Executing D:\a\configlet\configlet\nimdir\bin\nim.exe c --colors:on --noNimblePath \
-d:release --cpu:arm64 --os:windows -d:zig -d:target:aarch64-windows-gnu \
-d:NimblePkgVersion=4.0.0 \
--path:C:\Users\runneradmin\.nimble\pkgs2\parsetoml-0.7.1-586fe63467a674008c4445ed1b8ac882177d7103 \
--path:C:\Users\runneradmin\.nimble\pkgs2\jsony-1.1.5-6aeb83e7481ca8686396a568096054bc668294df \
--path:C:\Users\runneradmin\.nimble\pkgs2\supersnappy-2.1.3-36a05ee6befe3764ed8e2a6fb5d0882c2fd090f8 \
-o:D:\a\configlet\configlet\configlet.exe D:\a\configlet\configlet\src\configlet.nim
Hint: used config file 'D:\a\configlet\configlet\nimdir\config\nim.cfg' [Conf]
Hint: used config file 'D:\a\configlet\configlet\nimdir\config\config.nims' [Conf]
Hint: used config file 'D:\a\configlet\configlet\config.nims' [Conf]
...................................................................................................................................................
D:\a\configlet\configlet\src\patched_stdlib\json.nim(1[23](https://github.com/exercism/configlet/actions/runs/5894684581/job/15988813028#step:5:24)3, 7) Hint: 'typInst' is declared but not used [XDeclaredButNotUsed]
...............................................
D:\a\configlet\configlet\nimdir\lib\posix\posix.nim(1155, 13) Hint: 'sig' is declared but not used [XDeclaredButNotUsed]
CC: ../nimdir/lib/system/exceptions.nim
[...]
CC: configlet.nim
Hint: [Link]
Hint: mm: refc; threads: on; opt: size; options: -d:release
92399 lines; 54.335s; 167.895MiB peakmem; proj: D:\a\configlet\configlet\src\configlet.nim; out: D:\a\configlet\configlet\configlet.exe [SuccessX]
$ llvm-readobj configlet.exe
File: configlet.exe
Format: COFF-x86-64
Arch: x86_64
AddressSize: 64bit |
Could it be a Zig issue? Maybe try compiling a non-Nim Zig application first? Just to confirm that Zig can actually do the cross compiling to Windows Arm 64 |
Yeah, Zig can do that. And it works for me locally: $ nimble build -d:release -d:zig --cpu:arm64 --os:windows -d:target:aarch64-windows-gnu
$ file ./configlet
./configlet: PE32+ executable (console) Aarch64, for MS Windows, 6 sections
$ llvm-readobj ./configlet
File: ./configlet
Format: COFF-ARM64
Arch: aarch64
AddressSize: 64bit So I suspect that we might fix this problem if we cross compile from x86_64 Linux, rather than x86_64 Windows. But I don't know why. Anyway, I'll try that now. |
Rather than from x86_64 windows, which seemed to produce an x86_64 executable: $ llvm-readobj configlet.exe File: configlet.exe Format: COFF-x86-64 Arch: x86_64 AddressSize: 64bit despite compiling with: --cpu:arm64 --os:windows -d:zig -d:target:aarch64-windows-gnu
When cross-compiling from Linux to Windows: - output the executable with a `.exe` file extension, by passing -o to Nim - fix error for `llvm-readobj` not found
…to Windows" This reverts commit 92a278d. Nim gets passed -o:/home/runner/work/configlet/configlet/configlet which overwrites the given -o:configlet.exe
Yeah, that did it:
|
Somewhat odd and unexpected, but 🤷♂️ |
Decrease the diff size of the current PR. This won't do anything currently, since we don't do any cross-compiling on a machine where llvm-strip is available.
Make it work on Linux, macOS, and Windows.
This reverts commit 8318c80. Do this in a follow-up PR.
Not used for now. Reduce the PR diff size.
Continue the recent
zig cc
work, such that the next configlet release will have two new release assets:where the archive contains the executable:
The
aarch64-windows-gnu
target will have Tier 1 Zig support.Refs: #24
Refs: #122
Closes: #764
To-do:
.zip
, not.tar.gz