Building MP under windows

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Steve
Posts: 2
Joined: Tue Apr 15, 2014 9:07 am

Building MP under windows

Post by Steve » Tue Apr 15, 2014 9:20 am

Hi,

If I build using the ./unix make and cygwin the build works but I get
the following linker warnings:

LINK micropython
/usr/bin/ld: symbol `ffi_type_pointer' missing from main hash table
/usr/bin/ld: symbol `ffi_type_sint32' missing from main hash table
/usr/bin/ld: symbol `ffi_type_sint64' missing from main hash table
/usr/bin/ld: symbol `ffi_type_sint8' missing from main hash table
/usr/bin/ld: symbol `ffi_type_uint32' missing from main hash table
/usr/bin/ld: symbol `ffi_type_uint64' missing from main hash table
/usr/bin/ld: symbol `ffi_type_uint8' missing from main hash table
/usr/bin/ld: symbol `ffi_type_void' missing from main hash table

If I build using the ./windows make and cygwin the build fails:

LINK micropython.exe
/usr/bin/ld: cannot find -lmman
collect2: error: ld returned 1 exit status
../py/mkrules.mk:72: recipe for target 'micropython.exe' failed
make: *** [micropython.exe] Error 1

Can someone tell me what the preferred tool chain is for building mincropython.exe is on Windows.

Cheers, Steve

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building MP under windows

Post by pfalcon » Sat Apr 19, 2014 2:42 pm

As README suggests, to build unix/ you either need to have libffi developement files installed, or disable building against it.

windows/ once was supposed to be built with mingw32, but likely bitrotted since then.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
lurch
Posts: 11
Joined: Sat Apr 12, 2014 2:21 pm
Location: Cambridge, UK
Contact:

Re: Building MP under windows

Post by lurch » Sun Apr 20, 2014 12:03 am

pfalcon wrote:windows/ once was supposed to be built with mingw32, but likely bitrotted since then.
Is there anything Travis-alike that we can use to test the windows version of uPy? ;)
How "officially supported" is the windows port, or should it be considered as deprecated / super-low-priority?

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building MP under windows

Post by pfalcon » Sun Apr 20, 2014 6:18 pm

Well, it was just 1-2 patches to duplicate code from unix port, submitter didn't address issues raised, so that's it. I don't think it makes sense to call it "deprecated" - nice to be portable everywhere, but priority depends on its users' patch submission I guess...
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building MP under windows

Post by pfalcon » Sun Apr 20, 2014 7:37 pm

Okay, turns out I still have mingw32 crosscompiler installed. So, I unbroke windows build. Caveat: it starts up in interactive mode, but faults on running scripts. Patches welcome ;-).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building MP under windows

Post by pfalcon » Tue Apr 22, 2014 8:40 pm

Just to clarify: it faults under Wine. Not tested under native Windows.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

stijn
Posts: 337
Joined: Thu Apr 24, 2014 9:13 am

Re: Building MP under windows

Post by stijn » Wed Apr 30, 2014 6:23 pm

The fault on running scripts might be due to the unix/main.c expecting a path with forward slashes, can you check if that is the problem?

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building MP under windows

Post by pfalcon » Wed Apr 30, 2014 6:51 pm

As I mentioned in review comments, all paths are forward slashes (the others are not really paths ;-)). The faults are saw were related to NLR (like NLR stack underflow and just segfaults).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

stijn
Posts: 337
Joined: Thu Apr 24, 2014 9:13 am

Re: Building MP under windows

Post by stijn » Fri May 02, 2014 11:43 am

It does not matter what slashes you are using. On windows _fullpath() returns backslashes, always. So whatever you use as file argument, it will crash when passing it a file argument. And that yields NLR faults. Now I didn't check with wine, but if it's implementation of _fullpath() is like the one on windows the behaviour would be exactly the same. And that happens to be the behaviour you are witnessing.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Building MP under windows

Post by pfalcon » Fri May 02, 2014 3:00 pm

Thanks, it's always helpful to have good description, rather than read between the lines. But I still don't get how you got from backslashes to NLR failure - segfault from NULL on strchr('/') should not cause NLR fault (at least directly). Well, I'll leave that to you.

And we discussed in pullreq comments best practices to deal with that - please have windows/lib.c (or whatever name you have good reasons for) to implement realpath() for Windows, with POSIXy behavior.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply