Windows Subsystem for Linux - compiling

To Update

sudo apt-get update
sudo apt-get upgrade

You'll need Git

sudo apt-get install git

To clone the repository

cd /home
git clone

which clones the repo into the /home/ren-c/ directory

To compile for Linux

Install Make

sudo apt-get install make

Get r3-make

cd /home/ren-c/make
sudo chmod +x r3-make

And compile

cd /home/ren-c/make
make -f makefile.boot

and this should compile with no errors. You should end up with a r3 which is already executable. Just type ./r3

To Install a cross compiler for Windows

Instructions on SO

sudo apt-get install mingw-w64

Then you can create 32-bit Windows executable with:

i686-w64-mingw32-gcc -o main32.exe main.c

And 64-bit Windows executable with:

x86_64-w64-mingw32-gcc -o main64.exe main.c

Note that these Windows executables will not work inside Linux Subsystem, only outside of it.

Need to Fix something?

cd /home/ren-c/src
grep -r thefunctionIwanttofix

Disk space left?

To see if you're running out of disk space


PS: need the commands for compiling ren-c here as well

I tried this, and it worked.

However, it doesn't make a lot of sense to me to do this when VirtualBox is free and available.

With a virtual machine, you have a convenient disk image file that is effectively a computer. You can snapshot it, send it around on the internet, etc. You do not have to deal with whatever quirks of the Microsoft-specific hosting are.

As I understand it, this is more of a hypervisor, and so it may perform better than your average VM. But still, I would not think it worth it.

When I am compiling on the windows side, I can use linux command line tools like grep and find to search etc.

Also when I used a vm, there was also the issue of the mouse not working so well inside the vm, and ports needed to be on a different address. Whereas server testing on linux uses the same port as the windows side.

VMs default to simulating a wired network connection. But you can choose to give them more direct access to the host's network interface if you wish.

and how do you easily solve moving files across from the vm to windows? Here I just can use cp but with a vm I think I have to set up network shares.

If you have the tools installed in the VM, you can mount a folder on the host like any other drive.

You can also drag and drop files with the extensions, though I don't ever do that.

I'm sure that this can be easily argued ad infinitum

but for the thread, what are the specific commands to cross compile to windows ( I guess I can look at the travis-ci .yml to find out! ).

Well, how about you be the person who supports people interested the Windowsy-Linux.

And I will field questions about building in a VM.

Of course, this will be a problem if you start asking me questions and I deem the weirdness to be coming from your choice. :slight_smile:

("slight smile" says Discourse)

Well, this thread is to help people like myself have an easier transition to using linux tools however they chose to use them.