mirror of
https://github.com/limetext/lime.git
synced 2024-11-23 19:47:23 +03:00
Page:
Building on Windows
Pages
Architectural Overview
Building on Arch Linux
Building on CentOS 7
Building on Debian Stretch
Building on Fedora 21
Building on Raspberry Pi 2 and 3
Building on Ubuntu 14.04
Building on Ubuntu 16.04
Building on Vagrant
Building on Windows
Building on macOS
Building
Contributing
FAQ
Forking
Goals
HTML Architecture and Development Guide
Home
Implementing commands
QML Architecture & Development Guide
Quick notes on debugging a Go program with lldb
Troubleshooting
23
Building on Windows
valentjeruk edited this page 2022-10-20 19:42:19 +03:00
This article is a stub and is based on the discussion in #119!
NB: gopy currently fails very badly on Windows, so do NOT expect to have working or even fully built code after following these instructions. We are working on solutions.
- TODO: all of this installation is quite polluting. It should be possible to keep it all in one directory, and use bat files to set correct paths and variables etc before building.
- TODO? Explain why glib and glib-dev are needed? (glib and glib-dev are dependencies for Qt5 itself or maybe not, see here:https://groups.google.com/forum/#!topic/go-qml/hDBaSzlAP50)
- TODO: It should be possible to build in 64 bit at a later time, but first priority is getting 32 bit build working. Qt5 could be skipped altogether, it's also possible to use a prebuilt qt5 binary for 64 bits and mingw-64 has been used successfully to build other go projects that interface with C libraries.
Building on windows requires mingw, currently it is only possible to use 32 bit version of mingw for qt5, so for now we are confined to 32 bit setup, even on 64 bit Windows.
MinGW
- install mingw32/msys mingw32(because qt5 for mingw only has 32bit): http://sourceforge.net/projects/mingw/files/latest/download
Qt5 (optional)
- install Qt for mingw32 here: http://download.qt.io/official_releases/qt/5.11/5.11.2/
- download pkg-config from http://sourceforge.net/projects/pkgconfiglite/files/ and select the latest version and extract to c:\MinGW\bin
- download glib bin and dev version from http://www.gtk.org/download/windows.php and extract content to c:\MinGW
Go
- uninstall Go amd64 if it is installed and install Go386 instead: https://code.google.com/p/go/downloads/detail?name=go1.2rc2.windows-386.msi
Environment Variable
- set GOARCH=386
- set CPATH=C:\MinGW\include;C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include;C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtCore\5.1.1\QtCore
- set LIBRARY_PATH=C:\MinGW\lib;C:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib
- set PATH=C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin;C:\MinGW\bin;%path% (!important, put Qt's path in front of MinGW's path otherwise it'll complain libstdc++-6.dll missing as Qt's path contains a different libstd++-6.dll)
Python3
- Download and install python3 win32 from http://www.python.org/download/
- Download pexport (bin version) from http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/pexports-0.46/ and extract to c:\MinGW
- Start msys shell(usually located at C:\MinGW\msys\1.0\msys.bat)and run pexports to create a static linking library from python dll:
$ mount c:/mingw32 /mingw
$ pexports /c/Windows/SysWOW64/python33.dll >py33.def
$ dlltool -D python33.dll -d py33.def -l libpython33.a
$ cp libpython33.a c:/mingw/lib
libffi
- Download libffi from ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz and extract it to anywhere
- Start msys shell(usually located at C:\MinGW\msys\1.0\msys.bat) cd to the extracted directory and run:
$ mount c:/mingw32 /mingw
$ ./configure --prefix=/mingw
$ make
$ make install
Change cgo.go (lime/3rdparty/libs/gopy/lib/cgo.go)
TODO: Supposedly it's possible to have flags per architecture in #cgo
directives. This would simplify the build
package py
// #cgo CFLAGS: -Ic:/python33/include
// #cgo LDFLAGS: -Lc:/Python33/libs -Lc:/mingw/lib -ldl -lpython33
// #cgo pkg-config: libffi
import "C"
Build instructions (modified for win)
Install required components
- Go 1.1 or Go 1.2
- Download a binary package from http://golang.org/doc/install
- Python3
- use regular Python3, 32 bit version as stated above
- Oniguruma
- Download onig-5.9.5.tar.gz from http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.5.tar.gz
- Start msys shell(usually located at C:\MinGW\msys\1.0\msys.bat)and run:
$ mount c:/mingw32 /mingw # if this is not mounted before
$ ./configure --prefix=/mingw
$ make
$ make install
- qt5 (Skip this!) (this is way, way broken at the moment, don't even try it unless you want to fix it)(the windows build is also so far from being functional that this is not even a consideration yet)
- Follow the instructions at go-qt5
Compiling Python3 - not needed!
Set up a cozy environment
- set GOROOT=<go installation directory> e.g
set GOROOT=C:\Go_1_1_w32
- create the following directory
mkdir %GOROOT%\lime-build
- create the following file and name it set_env_vars.bat in the newly created directory
set GOPATH=%GOROOT%\lime-build
set GOARCH=386
set CPATH=C:\MinGW\include;C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include;C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtCore\5.1.1\QtCore
set LIBRARY_PATH=C:\MinGW\lib;C:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib
set PATH=C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin;C:\MinGW\bin;%path%
open cmd.exe and stay in the shell for building
cd %GOROOT%\lime-build
set_env_vars.bat
Download the needed repositories, this will end up in the GOPATH
go get -d code.google.com/p/log4go github.com/quarnster/parser github.com/quarnster/util github.com/howeyc/fsnotify
git clone --recursive https://github.com/limetext/lime.git %GOPATH%\src\lime
Modify gopy's cgo.go settings in some editor (e.g. notepad.. ehemm)
notepad %GOPATH%\src\lime\3rdparty\libs\gopy\lib\cgo.go
Example of cgo.go
settings on Windows:
package py
// #cgo CFLAGS: -Ic:/python33/include
// #cgo LDFLAGS: -Lc:/Python33/libs -Lc:/mingw/lib -ldl -lpython33
// #cgo pkg-config: libffi
import "C"
Make sure gopy works
cd %GOPATH%\src\lime\3rdparty\libs\gopy
go install
go test
A successful run of go test
will output something similar to (hint: this will not happen):
PASS
ok lime/3rdparty/libs/gopy 5.299s
As gopy tests fail badly on windows, this as far as we can go currently. Stay tuned!