lime icon indicating copy to clipboard operation
lime copied to clipboard

Windows Support [$30]

Open martell opened this issue 10 years ago • 64 comments

hey @quarnster,

I'm going to take on the task of the windows port. I should have it done fairly soon.

I have discovered linking errors with mingw64 and go lang and a patch should be pushed in to the mingw64-crt soon to resolve the last linking error of pygo and other c binded depends.

--- There is a **[$30 open bounty](https://www.bountysource.com/issues/1439455-windows-support?utm_campaign=plugin&utm_content=tracker%2F282001&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F282001&utm_medium=issues&utm_source=github).

martell avatar Jan 24 '14 14:01 martell

Wow that sounds fantastic.

martell [email protected] schrieb:

hey @quarnster,

I'm going to take on the task of the windows port. I should have it done fairly soon.

I have discovered linking errors with mingw64 and go lang and a patch should be pushed in to the mingw64-crt soon to resolve the last linking error of pygo and other c binded depends.


Reply to this email directly or view it on GitHub: https://github.com/limetext/lime/issues/228

EdVanDance avatar Jan 24 '14 14:01 EdVanDance

Thank you!

adzenith avatar Jan 24 '14 15:01 adzenith

"C:\msys64\mingw32\pkg\tool\windows_386\8l.exe" -o "C:\msys64\tmp\go-build836004963\lime\3rdparty\libs\gopy_test\gopy.test.exe" -L "C:\msys64\tmp\go-build836004963\lime\3rdparty\libs\gopy_test" -L "C:\msys64\tmp\go-build836004963" "C:\msys64\tmp\go-build836004963\lime\3rdparty\libs\gopy_test\main.a" $WORK\lime\3rdparty\libs\gopy_test\gopy.test.exe PASS ok lime/3rdparty/libs/gopy 2.592s

Great success :)

martell avatar Jan 24 '14 21:01 martell

Wow, that's awesome!

adzenith avatar Jan 24 '14 21:01 adzenith

what do I do after gopy? The guide was changed awhile back because cmake was added. I have also build the qt5 bindings :)

I already have onig build in gcc and obviously python3.3 with .a libs

EDIT: It's okay I'll just follow the steps in the cmakelists manually :)

martell avatar Jan 24 '14 22:01 martell

It would be nice if you tell us how to reproduce the python build.

EdVanDance avatar Jan 24 '14 22:01 EdVanDance

I'm using msys2 and pacman. mingw-w64-x86_64-python3 is a package for it. We are usually on irc on OFTC #msys2 added new packages daily :) You can pick it up here http://sourceforge.net/projects/msys2/

I recently added go itself but we are working out the issues with it. When lime is done I'll add it as a package and the PKGBUILD script to build it ;) python and onig should be here https://github.com/martell/MINGW-packages

martell avatar Jan 24 '14 22:01 martell

I am also on msys2. I played around yesterday with it. How did you generate the static python lib? Did you you use 32bit or 64bit toolchain, go?

EdVanDance avatar Jan 24 '14 22:01 EdVanDance

Is the mentioned crt fix already online?

EdVanDance avatar Jan 24 '14 22:01 EdVanDance

https://github.com/martell/MINGW-packages Python PKGBUILD is in this repo Yes alexey applied it by hand. Myself and mingwandroid are trying to fix go's CFLAG passing for mingw64 After that it should be good to go :) ... hopefully

Just "pacman -Syu" to update the crt

martell avatar Jan 24 '14 22:01 martell

But python3 is build as a shared lib by default isn't it? With mingw (not w64) they used pexports. How did you handle that? What is wrong with the CFLAGS?

EdVanDance avatar Jan 24 '14 22:01 EdVanDance

Python3 is compiled with mingw64 so we don't need to do the exports. We get the libpython3.3m.a by default as a result https://github.com/martell/MINGW-packages/tree/master/mingw-w64-python3

We don't use visual studio for anything. Nor do we rely on visual studio builds of any library

The equivalent to pexports would be gendef. We don't need it here though http://sourceforge.net/apps/trac/mingw-w64/wiki/gendef

martell avatar Jan 24 '14 23:01 martell

Okay so I have successfully build the termbox frontend with mingw64. It closes gracefully with this message in the debug.log [2014/01/25 00:47:11 GMT] EROR (main.main:607) The handle is invalid.

The qml build gives me this error after setting up the bindings. Two bindings in the one project must cause issues. lime/frontend/qml C:\msys64\tmp\go-build680373563/lime/3rdparty/libs/gopy/lib.a(_all.o): duplicate symbol reference: mingw_onexit in both github.com/niemeyer/qml(.text) and lime/3rdparty/libs/gopy/lib(.text)

martell avatar Jan 25 '14 02:01 martell

https://www.dropbox.com/s/2ibydge1x8k9s1w/lime.7z

I have successfully built the termbox, html and I dropped back in the qt5 main.go as the qml one wouldn't link

Termbox seems the best so far. I goes through loading all the plugins and then crashes :/ Nice log file though ;)

look in build/bin for exe's and don't move them as they are folder structure relevant

martell avatar Jan 25 '14 15:01 martell

@martell: did you try running the termbox frontend from Windows command prompt instead of mintty?

EdVanDance avatar Jan 25 '14 15:01 EdVanDance

@EdVanDance Yes I am running termbox from the windows cmd.prompt It seems as though with a bit more work on go that this can be resolved. Also we need to remove setcolormode 256 on windows as we don't have that function

martell avatar Jan 25 '14 16:01 martell

@martell I can't get it to run. I installed i686 python3 (I'm on x86_64). Opened a cmd:

set PYTHONHOME=...\msys64\mingw32\lib\python3.3
termbox.exe

And I get:

Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

EdVanDance avatar Jan 26 '14 15:01 EdVanDance

You shouldn't have to set PYTHONHOME as I've included he python dll's It works for me without that.

Now I maybe wrong but I didn't do that anyways.

The patch has been merged into the mingw64-crt and alexey will be doing an update soon ;)

martell avatar Jan 26 '14 15:01 martell

If I do not set the PYTHONPATH. I get:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Do you start the command prompt from within msys? I started it directly via Win+R.

EdVanDance avatar Jan 26 '14 15:01 EdVanDance

No I directly went to cmd like you did, PYTHONHOME is not defined on my system. I think I previously installed python onto my system with the windows installer, maybe thats why my cmd windows doesn't complain?

This could explain why it crashes at a certain point also, maybe I'm using the wrong python files

Did you install mingw python3 or msys2 python3 they are very different

martell avatar Jan 26 '14 16:01 martell

Hmm that could be the reason. But I dont't understand why it complains after setting up the PYTHONPATH. There definetly is a encodings module.

EdVanDance avatar Jan 26 '14 16:01 EdVanDance

I got it. It's just:

set PYTHONHOME=...\msys64\mingw32

Without lib\python3.3.

EdVanDance avatar Jan 26 '14 16:01 EdVanDance

Nice ;) and your output?

martell avatar Jan 26 '14 16:01 martell

Shows the file content, but does not react on key presses. And complains about 256 color mode.

EdVanDance avatar Jan 26 '14 16:01 EdVanDance

In the zip I uploaded I have all my cgo.go files for reference if you want to build from source ;) I also have a package on my mingw-packages repo for onig and go which you will need.

Can you pastebin it please :)

I get as far as here

[2014/01/25 04:08:33 GMT] INFO Python sez: Loading plugin Vintageous.jump_list_cmds [2014/01/25 04:08:33 GMT] FNST Rendering [2014/01/25 04:08:33 GMT] FNST Want to register vi_add_to_jump_list [2014/01/25 04:08:33 GMT] FNST Successfully registered command vi_add_to_jump_list [2014/01/25 04:08:33 GMT] INFO Python sez: Loading plugin Vintageous.motion_cmds [2014/01/25 04:08:33 GMT] FNST Rendering [2014/01/25 04:08:33 GMT] FNST Want to register irreversible_text

martell avatar Jan 26 '14 16:01 martell

Same here: http://pastebin.com/G2yNjmdp

EdVanDance avatar Jan 26 '14 16:01 EdVanDance

Okay Well I'll try and get alexey to merge my go package and onig shared package. That way everyone can be on the same page build wise. Here is a guide to build from start to finish reverse engineered from the cmakelists.txt ;)

https://gist.github.com/martell/c178f674188cb779b8fd

martell avatar Jan 26 '14 16:01 martell

Thanks a lot. That definitely helps a lot. Did you also try a 64bit build?

EdVanDance avatar Jan 26 '14 20:01 EdVanDance

I didn't but it should be the same. Currently making a script where you can choose which one to build :D

martell avatar Jan 26 '14 21:01 martell

Ok nice. Could you tell me the difference between the msys2 and msys64 base downloads on sourceforge?

EdVanDance avatar Jan 26 '14 21:01 EdVanDance