Cross-compile windows version from nim on arch | linux

The most troublesome thing was to put mingw .....

arch so yay

It's good to put it in yay, but I'm a student or you who asks questions every time and thinks it's troublesome if there are many packages. There was an option at last. answer Put none in the Nanchara series. Could you make this the default?

mingw.sh


yay --answerdiff none --answerclean none --answeredit none mingw-w64-binutils-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-crt-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-gcc-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-headers-bin
yay --answerdiff none --answerclean none --answeredit none mingw-w64-winpthreads-bin

*.nim.cfg

The cross-compilation itself with nim is the nth brew, so you can write it almost exactly as it is.

Nim cross-compilation method -Qiita Nim cross-compilation method \ (Linux -> Windows version ) -Qiita

In archlinux, there is enough description in /etc/nim.cfg, so you only need to write the difference.

Since some GNU-linker options do not work with mingw-linker, it is necessary to crush the contents of the original option.

sh:*.nim.cfg


amd64.windows.gcc.path = "/usr/bin/"
amd64.windows.gcc.exe = "x86_64-w64-mingw32-gcc"
amd64.windows.gcc.linkerexe = "x86_64-w64-mingw32-gcc"
#amd64.windows.gcc.options.linker = ""
gcc.options.linker = ""

nim c --os:windows *.nim

After that, if you enter --os: windows, the output file name will also be * .exe. I haven't tried it on windows, but it worked on: P wine, so it's probably fine.

For example, if you build a certain script with os: windows, it will be like this

$ nim c --os:windows modini.nim
Hint: used config file '/etc/nim/nim.cfg' [Conf]
Hint: used config file '/etc/nim/config.nims' [Conf]
Hint: used config file '.../modini.nim.cfg' [Conf]

...

Hint:  [Link]
Hint: 42996 LOC; 0.794 sec; 47.617MiB peakmem; Debug build; proj: .../modini.nim; out: .../modini.exe [SuccessX]
$ file modini.exe 
modini.exe: PE32+ executable (console) x86-64, for MS Windows
$ wine ./modini.exe 

Recommended Posts

Cross-compile windows version from nim on arch | linux
jblas on Arch Linux
Linux (WSL) on Windows
Install Minecraft on Arch Linux
Downgrade Mcomix on Arch Linux
Linux on Windows -1-: debian introduction
Use Linux on Windows 10 (WSL2)
Setting up OpenSSH on Arch Linux
Install xgboost (python version) on Windows
WSL2 ~ Linux on Windows ~ (Part 1: Introduction)
Install Arch Linux on DeskMini A300
Rip Music CDs on Arch Linux
Create a Linux environment on Windows 10
pykintone on Windows Subsystem for Linux
[UE4] Build DedicatedServer on Windows and Linux
Build an NFS server on Arch Linux
Basic usage of Btrfs on Arch Linux
Build a Samba server on Arch Linux
Create a Linux virtual machine on Windows
Call a command from Python (Windows version)
Until you install Arch Linux on VMware
Install Windows 10 from a Linux server with PXE
Open a ZIP created on Windows in Linux
Install Anydesk Linux version on Chromebook [Result NG]
Linux on Windows -1-: debian introduction
Organize files on Windows with Linux commands-using WSL-
Boot CentOS 8 from Windows 10 with Wake On LAN
Deliver OBS footage to Zoom on Arch Linux
Get the latest Linux kernel version with Arch Linux
It's fast, garuda linux from the arch family
Build an Arch Linux environment on Raspberry Pi
Install ZIP version Python and pip on Windows 10
Arch Linux Recommendation
Run Kali Linux on Windows with GUI (without VirtualBox)
Run Tensorflow from Jupyter Notebook on Bash on Ubuntu on Windows
Install Grub on USB memory (UEFI) ~ Boot Linux from grub on USB memory ~
Open Chrome version of LINE from the command line [Linux]
How to use C216 Audio Controller on Arch Linux
Notes on upgrading discord.py from async to rewrite version
Install Docker on Arch Linux and run it remotely
A story about a Linux beginner putting Linux on a Windows tablet
Cross development environment (developing programs for windows on linux)
Make anaconda environment available from command prompt on windows