Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Support [$30] #228

Open
martell opened this issue Jan 24, 2014 · 64 comments
Open

Windows Support [$30] #228

martell opened this issue Jan 24, 2014 · 64 comments

Comments

@martell
Copy link

martell commented Jan 24, 2014

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).
@EdVanDance
Copy link
Contributor

Wow that sounds fantastic.

martell notifications@github.com 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:
#228

@adzenith
Copy link
Contributor

Thank you!

@martell
Copy link
Author

martell commented Jan 24, 2014

"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 :)

@adzenith
Copy link
Contributor

Wow, that's awesome!

@martell
Copy link
Author

martell commented Jan 24, 2014

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 :)

@EdVanDance
Copy link
Contributor

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

@martell
Copy link
Author

martell commented Jan 24, 2014

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

@EdVanDance
Copy link
Contributor

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
Copy link
Contributor

Is the mentioned crt fix already online?

@martell
Copy link
Author

martell commented Jan 24, 2014

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

@EdVanDance
Copy link
Contributor

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?

@martell
Copy link
Author

martell commented Jan 24, 2014

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
Copy link
Author

martell commented Jan 25, 2014

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
Copy link
Author

martell commented Jan 25, 2014

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

@EdVanDance
Copy link
Contributor

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

@martell
Copy link
Author

martell commented Jan 25, 2014

@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

@EdVanDance
Copy link
Contributor

@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.

@martell
Copy link
Author

martell commented Jan 26, 2014

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 ;)

@EdVanDance
Copy link
Contributor

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.

@martell
Copy link
Author

martell commented Jan 26, 2014

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

@EdVanDance
Copy link
Contributor

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
Copy link
Contributor

I got it.
It's just:

set PYTHONHOME=...\msys64\mingw32

Without lib\python3.3.

@martell
Copy link
Author

martell commented Jan 26, 2014

Nice ;) and your output?

@EdVanDance
Copy link
Contributor

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

@martell
Copy link
Author

martell commented Jan 26, 2014

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

@EdVanDance
Copy link
Contributor

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

@martell
Copy link
Author

martell commented Jan 26, 2014

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

@EdVanDance
Copy link
Contributor

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

@martell
Copy link
Author

martell commented Jan 26, 2014

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

@EdVanDance
Copy link
Contributor

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

@akavel
Copy link

akavel commented May 16, 2014

Are the Python features required for a working Lime? I tried commenting out import of gopy & sublime (and three lines that depend on it) in both frontend/html and frontend/termbox, and also replaced import of rubex with import (rubex "regexp"); both html & termbox built and run on Windows, but weirdly, in unusable way:

  • html had problems interpreting keys (strange symbols like "&" and others appeared both in Firefox and Chromium)
  • termbox didn't show cursor, and bottom half of screen was weirdly shifted and rapidly scrolling down on every keypress

any ideas? :)

@zoli
Copy link
Member

zoli commented May 17, 2014

About the termbox you can get information from log file that is created with every build and you should know we have vintageous plugin that gives some vim features so you should press i first then start typing.

@zoli zoli added the build label Aug 15, 2014
@martell
Copy link
Author

martell commented Oct 17, 2014

@zoli we weren't able to build for quite awhile as msys updated mingw python to 3.4 which gopy and go 1.3.1 has only just fixed.

Now that the python3.4 issues have been resolved I am looking at using msys2 and mingw-64 and go to build lime text.

Here is my current error

$ go get github.com/limetext/lime/frontend/termbox # github.com/limetext/gopy/lib ..\..\..\mingw64\src\github.com\limetext\gopy\lib\utils.c: In function 'cinit': ..\..\..\mingw64\src\github.com\limetext\gopy\lib\utils.c:503:11: error: 'sigaltstack' undeclared (first use in this function) stub(&sigaltstack); ^ ..\..\..\mingw64\src\github.com\limetext\gopy\lib\utils.c:503:11: note: each undeclared identifier is reported only once for each function it appears in ..\..\..\mingw64\src\github.com\limetext\gopy\lib\utils.c:504:11: error: 'signal' undeclared (first use in this function) stub(&signal); ^ ..\..\..\mingw64\src\github.com\limetext\gopy\lib\utils.c:505:11: error: 'sigaction' undeclared (first use in this function) stub(&sigaction);

It seems this commit breaks gopy on windows
limetext/gopy@8b1545f


Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.

@martell
Copy link
Author

martell commented Oct 18, 2014

If I comment them out i get this error
github.com/limetext/gopy/lib(.text): undefined: github.com/limetext/gopy/lib(/4292) github.com/limetext/gopy/lib(.text): undefined: github.com/limetext/gopy/lib(/6573) github.com/limetext/gopy/lib(.text): undefined: github.com/limetext/gopy/lib(/6545) github.com/limetext/gopy/lib(.text): undefined: github.com/limetext/gopy/lib(/6513) too many errors
@quarnster have you any ideas?

here is the build guide for building limetext in msys2 on windows
https://gist.github.com/martell/8588075

a go 1.3.3 package will hit the servers tomorrow hopefully :)

@quarnster
Copy link
Member

cinit should be ifdef-ed out for windows or something as it's not relevant there. Regarding the linking error, does it find the python lib correctly?

@martell
Copy link
Author

martell commented Oct 19, 2014

Yes it finds the libraries correctly.
pkg-config is adding the /mingw64/include/python3 include dir.
So I do expect it to also add the lib correctly.
The error message doesn't really help much :(
We are in uncharted territory so i will try to force -lpython3
Post back soon

@martell
Copy link
Author

martell commented Oct 19, 2014

Okay so here are my results.
pkg-config is finding the lib correctly because here is a test on regex with and without onig installed

without:
$ go test github.com/limetext/rubex testmain github.com/limetext/rubex(.text): undefined: onig_free github.com/limetext/rubex(.text): undefined: onig_number_of_captures github.com/limetext/rubex(.text): undefined: onig_number_of_names github.com/limetext/rubex(.text): undefined: onig_region_free github.com/limetext/rubex(.text): undefined: github.com/limetext/rubex(/63) github.com/limetext/rubex(.text): undefined: onig_region_new github.com/limetext/rubex(.text): undefined: github.com/limetext/rubex(/30) github.com/limetext/rubex(.text): undefined: onig_new github.com/limetext/rubex(.text): undefined: onig_error_code_to_str github.com/limetext/rubex(.text): undefined: onig_search github.com/limetext/rubex(.text): undefined: onig_error_code_to_str github.com/limetext/rubex(.text): undefined: onig_match github.com/limetext/rubex(.text): undefined: onig_name_to_backref_number github.com/limetext/rubex(.text): undefined: onig_foreach_name FAIL github.com/limetext/rubex [build failed]

with:
$ go test github.com/limetext/rubex testmain github.com/limetext/rubex(.text): undefined: github.com/limetext/rubex(/63) github.com/limetext/rubex(.text): undefined: github.com/limetext/rubex(/30) FAIL github.com/limetext/rubex [build failed]

Edit: seems 32bit go on windows prints a more meaningful error

$ go get github.com/limetext/lime/frontend/termbox github.com/limetext/lime/frontend/termbox github.com/limetext/gopy/lib(.text): undefined: _get_output_format github.com/limetext/gopy/lib(.text): undefined: ___lc_codepage_func github.com/limetext/gopy/lib(.text): undefined: ___lc_codepage_func github.com/limetext/gopy/lib(.text): undefined: ___lc_codepage_func github.com/limetext/gopy/lib(.text): undefined: ___lc_codepage_func github.com/limetext/gopy/lib(.text): undefined: ___lc_codepage_func

@martell
Copy link
Author

martell commented Oct 19, 2014

to solve this link error I must link against the visual studio runtime unfortunately i have to pick a c++ runtime also like v110 or v110 which is annoying for a mingw-w64 application.

okay so now I can actually build :)
Hopefully I will have an exe shortly

EDIT: I can build the termbox but

qml front end gives me this
See same error as above on Jan 25th

$ go build
github.com/limetext/lime/frontend/qml
C:/msys64/mingw32/pkg/windows_386/gopkg.in/qml.v1.a(_all.o): duplicate symbol reference: mingw_onexit in both github.com/limetext/gopy/lib(.text) and gopkg.in/qml%2ev1(.text)

@martell
Copy link
Author

martell commented Oct 19, 2014

Here is my termbox output:

Seems a bit better than a few months ago but it still crashes

[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*WindowEvent).Call:94) OnNewWindow(2)
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnNew(4)
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnActivated(4)
[2014/10/19 11:32:41 BST] [EROR] (main.setColorMode:614) Unable to use 256 color mode: SetColorMode not implemented on Windows
[2014/10/19 11:32:41 BST] [EROR] (github.com/limetext/lime/backend/packages.func·001:98) Error on walking: GetFileAttributesEx ../../3rdparty/bundles/User: The system cannot find the file specified.
[2014/10/19 11:32:41 BST] [EROR] (github.com/limetext/lime/backend/packages.ScanPackets:110) Can't walk: GetFileAttributesEx ../../3rdparty/bundles/User: The system cannot find the file specified.
[2014/10/19 11:32:41 BST] [INFO] (github.com/limetext/lime/backend.(*Editor).loadKeyBinding:183) Loaded ..\..\packages\Default\Default (OSX).sublime-keymap
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(&{0x12760400})
[2014/10/19 11:32:41 BST] [INFO] (github.com/limetext/lime/backend.(*Editor).loadKeyBinding:183) Loaded ..\..\packages\Default\Default.sublime-keymap
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(&{0x12760420})
[2014/10/19 11:32:41 BST] [INFO] (github.com/limetext/lime/backend.(*Editor).loadKeyBinding:183) Loaded ..\..\packages\Default\Default (OSX).sublime-keymap
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(&{0x127ce180})
[2014/10/19 11:32:41 BST] [INFO] (github.com/limetext/lime/backend.(*Editor).loadKeyBinding:183) Loaded ..\..\packages\Default\Default.sublime-keymap
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(&{0x127ce1a0})
[2014/10/19 11:32:41 BST] [INFO] (github.com/limetext/lime/backend.(*Editor).loadSetting:199) Loaded ../../packages/Default/Preferences.sublime-settings
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(&{0x127e83b0})
[2014/10/19 11:32:41 BST] [INFO] (github.com/limetext/lime/backend.(*Editor).loadSetting:199) Loaded ../../packages/Default/Preferences (Windows).sublime-settings
[2014/10/19 11:32:41 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(&{0x127d2270})
[2014/10/19 11:32:41 BST] [EROR] (github.com/limetext/lime/backend/packages.(*Packet).Get:47) Couldn't read file: open ../../3rdparty/bundles/User/Preferences.sublime-settings: The system cannot find the path specified.
[2014/10/19 11:32:41 BST] [EROR] (github.com/limetext/lime/backend.(*Editor).loadSetting:197) 1,1: Unexpected EOF, 0-0: "JSON" - Data: ""

[2014/10/19 11:32:41 BST] [FNST] (main.(*tbfe).renderthread:437) Rendering
[2014/10/19 11:32:41 BST] [FNST] (main.(*tbfe).renderthread:437) Rendering
[2014/10/19 11:32:41 BST] [FNST] (main.(*tbfe).renderthread:437) Rendering

@quarnster
Copy link
Member

Nice work! What's the backtrace for the crash?

If you launch it with "./termbox main.go" does it try and display this file correctly?

If you comment out the gopy import + calls, does it still crash? If not, it might be one of the standard Go mingw issues.

@martell
Copy link
Author

martell commented Oct 19, 2014

@quarnster: I have no idea about the back trace :(
I don't understand go lang well enough.
How do I even debug it ?

I don't get to see the output here is the log though

[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*WindowEvent).Call:94) OnNewWindow(2)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnNew(4)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnActivated(4)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnModified(4)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnSelectionModified(4)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnLoad(4)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*Editor).Watch:414) Watch(C:\msys64\mingw32\src\github.com\limetext\lime\frontend\termbox\main.go (4))
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnDeactivated(4)
[2014/10/19 15:26:09 BST] [FNST] (github.com/limetext/lime/backend.(*ViewEvent).Call:60) OnActivated(4)

I will try removing the gopy imports and see

@quarnster
Copy link
Member

@martell, Backtrace should be dumped to the terminal normally, except in this case we are hijacking the terminal to render some UI so it won't work ;)

Try this patch and see if you get something useful in the log:

diff --git a/frontend/termbox/main.go b/frontend/termbox/main.go
index 4ff2426..bdecd51 100644
--- a/frontend/termbox/main.go
+++ b/frontend/termbox/main.go
@@ -711,7 +711,9 @@ func main() {
                termbox.Close()
                log4go.Debug(util.Prof)
                if err := recover(); err != nil {
-                       log4go.Crash(err)
+                       log4go.Debug(err)
+                       log4go.Debug("%s", string(debug.Stack()))
+                       time.Sleep(time.Second) // TODO: see issue #260
                }
        }()

@quarnster quarnster changed the title Windows Support Windows Support [$20] Dec 18, 2014
@quarnster quarnster changed the title Windows Support [$20] Windows Support [$30] Jan 13, 2015
@techtonik
Copy link

Can this thread be reset into new issue with status update?

@martell
Copy link
Author

martell commented Jul 26, 2015

@techtonik No need to close :)
I will try updating the packages we have for go and do a few patches on them to see where we stand on this now

@martell
Copy link
Author

martell commented Jul 31, 2015

Okay so it seems that currently we are still at the same stage where part of the go language itself does not work properly on windows.

I am exploring 2 different possible solutions to this.
Both will require a bit of time to test.
I'll be back in about a week with an update

@techtonik
Copy link

Week is passed. This issue needs to be reticketed with short summary - for now it is impossible to take action on it given all the limitation of real life and free time.

@stayorgo
Copy link

martell, which part of the go language fails to work properly on windows? Also I think you mean the go implementation rather than the language itself?

@kolkov
Copy link

kolkov commented Nov 21, 2015

Hi! What news about porting on windows? Do you have any progress?

@ricochet1k
Copy link
Member

I don't entirely know what the problems used to be, but Lime-QML builds and runs fine for me in Windows. Here's my instructions: https://github.com/ricochet1k/lime-qml/wiki/Building-on-Windows-using-MSYS2

@sergeevabc
Copy link

The year is 2017, the month is June, i.e. 1250 days passed since issue was created.
Err… Hello? Could we try some pre-compiled Windows binary at last, please?

@loki8989
Copy link

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

@z505
Copy link

z505 commented Sep 17, 2019

unsub me from this

@techtonik
Copy link

Here..

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests