Building on Windows with MinGW

By wbahnassi

Expert (118)

wbahnassi's picture

07-06-2020, 02:11

Hi, I'm trying to build openMSX on Windows through MinGW. However, it's failing miserably right from the get-go. I installed MinGW into C:\MinGW. During installation I ticked the C++ compiler and MSYS base tools. All good. Launched a shell from C:\MinGW\msys\1.0\msys.bat and navigated to openMSX folder and entered ./configure just to be greeted with:

$ ./configure
Using Python: python3
Error determining MSYS root: b'  File "", line 1\r\n    import sys ; print sys.argv[1]\r\n                       ^\r\nSyntaxError: invalid syntax\r\n'
Exit code 1
Traceback (most recent call last):
  File "build/detectsys.py", line 5, in 
    from executils import captureStdout
  File "c:\Users\wbahnassi\Desktop\openMSX\build\executils.py", line 1, in 
    from msysutils import msysActive, msysShell
  File "c:\Users\wbahnassi\Desktop\openMSX\build\msysutils.py", line 70, in 
    msysMounts = _determineMounts()
  File "c:\Users\wbahnassi\Desktop\openMSX\build\msysutils.py", line 25, in _determineMounts
    raise OSError('Error determining MSYS root')
OSError: Error determining MSYS root
build/main.mk:126: *** No platform specified using OPENMSX_TARGET_CPU and OPENMSX_TARGET_OS and autodetection of local platform failed.  Stop.

I double-checked that my openMSX files are all ending with LF instead of CRLF (adjusted git's config to do so), and Notepad++ confirms that too, so I'm lost as to where the CRLF is creeping in from. After all, those are code-generated lines from msysutils.py:

# Figure out the root directory of MSYS.
	proc = Popen(
		[ msysShell(), '-c', '"%s" -c \'import sys ; print sys.argv[1]\' /' % sys.executable.replace('\\', '\\\\') ],
		stdin = None,
		stdout = PIPE,
		stderr = PIPE,
		)

There doesn't seem to be any new-line characters involved.. Help?

Cheers!

Login or register to post comments

By sdsnatcher73

Paragon (1147)

sdsnatcher73's picture

07-06-2020, 07:54

I’ve tried several ways (with mingw, mingw64, mingw on top of Cygwin) but ultimately was never able to build openMSX that way. What did work for me is using Windows Subsystem for Linux (aka WSL). I installed Ubuntu from the Windows Store, installed mingw through apt and cross compile openMSX for Windows on Linux on Windows (fun right).

You can look in the GitHub actions for Windows In the repo to find the steps to build correctly.

By wbahnassi

Expert (118)

wbahnassi's picture

07-06-2020, 12:59

Oof.. and here I was hoping to be able to make Windows compile openMSX for Android.

By Manuel

Ascended (16974)

Manuel's picture

07-06-2020, 13:06

In the past we built the Windows version always with MinGW/MSYS (on Windows itself), so it has worked.... and the cross compile also works. So I expect it shouldn't be too hard to get it working again. mth is the expert here, though.