Page 1 of 2

Building MP under windows

Posted: Tue Apr 15, 2014 9:20 am
by Steve
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

Re: Building MP under windows

Posted: Sat Apr 19, 2014 2:42 pm
by pfalcon
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.

Re: Building MP under windows

Posted: Sun Apr 20, 2014 12:03 am
by lurch
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?

Re: Building MP under windows

Posted: Sun Apr 20, 2014 6:18 pm
by pfalcon
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...

Re: Building MP under windows

Posted: Sun Apr 20, 2014 7:37 pm
by pfalcon
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 ;-).

Re: Building MP under windows

Posted: Tue Apr 22, 2014 8:40 pm
by pfalcon
Just to clarify: it faults under Wine. Not tested under native Windows.

Re: Building MP under windows

Posted: Wed Apr 30, 2014 6:23 pm
by stijn
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?

Re: Building MP under windows

Posted: Wed Apr 30, 2014 6:51 pm
by pfalcon
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).

Re: Building MP under windows

Posted: Fri May 02, 2014 11:43 am
by stijn
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.

Re: Building MP under windows

Posted: Fri May 02, 2014 3:00 pm
by pfalcon
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.