Andria
Andria

Reputation: 5065

Cross Compile Windows 64 Bit Assembly on Linux 64 bit

How do you compile and link a 64 bit Windows assembly program in Linux

I already know to run

nasm -f win64 generic_assembly.asm -o generic_output

But after that I can't just run

ld generic_output -o generic_executable.exe

and I have tried using GoLink.exe with wine but I am still skeptical as to whether it is actually working

Maybe I could use Mingw-w64 but I have no clue on how that would work

Any help would be appreciated I am mostly just looking for a linker that I can run from linux but otherwise a linker for Windows would also be appreciated.

Upvotes: 2

Views: 2427

Answers (1)

Andria
Andria

Reputation: 5065

To link the objects for 64 bit Windows from Linux install x86_64-w64-mingw32-gcc. To do this follow these steps:

  • Go to here and download the most recent build.
  • Unpack the archive to /opt/mingw64
  • Then do sudo ln -s /opt/mingw64/bin/x86_64-w64-mingw32-g++ /usr/bin/mingw64-g++

Now you have installed a cross compiler for Windows 64 bit, if you want the 32 bit version do the same but use this link.

Upvotes: 2

Related Questions