10

I want to develop a programm in Go with a multi-OS GUI in wxWidgets, my dev environment is WinXP x86.

I wanted to use the wxWidgets Go wrapper wxGo, but the documentation is very succint and the project seems dead since 2 years.

I encountered some errors with the go get github.com/JeroenD/wxGo and go install github.com/JeroenD/wxGo

Result of go get github.com/JeroenD/wxGo:

package github.com/JeroenD/wxGo
    imports github.com/JeroenD/wxGo
    imports github.com/JeroenD/wxGo: no Go source files in C:\Documents and Settings\dell\Mes documents\gopath\src\github.com\JeroenD\wxGo

Result of go install github.com/JeroenD/wxGo:

can't load package: package github.com/JeroenD/wxGo: no Go source files in C:\Documents and Settings\dell\Mes documents\gopath\src\github.com\JeroenD\wxGo

I tried to follow the Building.txt doc from JeroenD's github. First time, I downloaded and installed wxWidgets, the sample codes were able to compile (with MinGW), but I was not able to compile the wxWidgets library from source. The second time, I downloaded and installed wxPack, with libs/dll already compiled. Here, the problem is I can't compile the wxWidgets samples.

As stated in the Buiding.txt doc from JeroenD's github, I installed SWIGWIN, but did not compile it from source as SWIG now supports Go (from SWIG's documentation). But now, I don't know what to do with a wrapper (wxGo), wxWidgets dll/libs, and SWIG. I think I read that SWIG needs *.i files to make bindings from language to another, but I can't find any in my wxWidgets folder, perhaps I have to take these files from another wxWidgets binding (wxLua and wxPython have these in their repos).

My goal is just to get the wxWidgets lib working with Go to be able to write a multi OS GUI in wxWidgets, I'm a bit surprised that nobody had posted problems with JeroenD's package nor wanted to get wxWidgets working with Go.

As you may ask, building a gtk GUI with go-gtk is not a solution, as it is needed in my project to have a multi-OS GUI looking OS native (if you have a multi-OS GUI lib which looks native and is simpler to use, please tell me).

Lomanic
  • 371
  • 4
  • 15

3 Answers3

3

According to the Building.txt file:

To build the wxGo library:
cd wx
make install

So, despite this being a Go package, it doesn't seem to use any actual Go code (if you look in github.com/JeroenD/wxGo you won't see any .go files).

I think, in cases like this, you need to use git (instead of go get) and make install instead of go install.

On windows you may want to get the Git for Windows installer to make this process a bit simpler.

Once it's built it looks like you can use

import "wx"

as usual in your go code (minimal example at https://github.com/JeroenD/wxGo/blob/master/example/minimal/minimal.go)

Intermernet
  • 18,604
  • 4
  • 49
  • 61
  • I'm on Windows (with MinGW), so the command that I did was `%GOPATH%\src\github.comJeroenD\wxGo\wx>mingw32-make install`, with the following result: `Makefile:12: C:\Go\/src/Make.inc: No such file or directory Makefile:28: C:\Go\/src/Make.pkg: No such file or directory mingw32-make: *** No rule to make target 'C:\Go\/src/Make.pkg'. Stop.` I then placed the Make.pkg file from JeroenD's github in the %GOROOT%\src\ folder, and now the result of the previous command is: `C:\Go\/src/Make.pkg:9: /src/Make.common: No such file or directory C:\Go\/src/Make.pkg:61: *** missing separator. Stop.` – Lomanic Jul 16 '13 at 08:08
  • Try running mingw32-make from Git-Bash (the version of Bash that comes with Git for Windows) instead of CMD.EXE or Powershell as it may want the file separators to be forward-slashes instead of back-slashes. – Intermernet Jul 16 '13 at 08:54
  • No, the Git-Bash didn't help (exact same result). I downloaded the required `Make.common` and `Make.inc` files from [golang's github](https://github.com/niemeyer/golang/blob/master/src) and put them in the %GOROOT%\src\ folder. My error was then the missing "-intgosize 32" argument at the line n°212 of %GOROOT%\src\Make.pkg. Here are my new errors: My comment is too long, here it is: [link](http://pastebin.com/Qa9jqWTT) I'm now looking for dlimpexp.h and version.h – Lomanic Jul 16 '13 at 09:17
  • If you manage to get it working, can you please provide an answer to your question and mark it correct? It will be useful for others in the future. Thanks! – Intermernet Jul 16 '13 at 09:23
  • Ok, downloaded and put in %GOPATH%\src\github.comJeroenD\wxGo\wx folder [dlimpexp.h](https://raw.github.com/tagged/wx/master/include/wx/dlimpexp.h) and [version.h](https://raw.github.com/tagged/wx/master/include/wx/version.h) (taken from [wx github](https://github.com/tagged/wx/tree/master/include/wx), I have the same error. – Lomanic Jul 16 '13 at 09:26
  • I rather plan to fork JeroenD's github repo to apply my changes and improve documentation. – Lomanic Jul 16 '13 at 09:28
  • Excellent :-) I'll watch the repo for the fork! – Intermernet Jul 16 '13 at 09:29
  • Well, [wx github](https://github.com/tagged/wx/tree/master/include/wx) was just a 5 years old copy of the [official wxWidgets svn](http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/). I found them in my wxWidgets install (C:\wxWidgets2.8\include\wx, from my wxPack install). It looks like SWIG can't find these header files... – Lomanic Jul 16 '13 at 09:57
  • After doing what I explained in [my doc](https://github.com/Lomanic/wxGo/blob/133ac4f277f0564c53e943bc3f5c5c7931d23a46/support/Building.txt), I now have last one error: `mingw32-make: *** No rule to make target '_obj/wx-wx.dll', needed by 'C:\Go\/pkg /windows_386/swig/wx-wx.dll'. Stop.` If someone is able to make it work go ahead and post your solution here, otherwise I think that I will give up with this and make my app in python/wxPython... I think that the way used in JeroenD's repo is obsolete, (previous go1 perhaps), as it talks about files not distributed anymore (Make.pkg for example). – Lomanic Jul 17 '13 at 11:31
2

wxGO wxWidgets wrapper for GO is live here wxGO MultiOS

  • 1
    as this seems that is not maintained anymore [as per 2020] , are there suitable alternatives? – dawez Aug 10 '20 at 11:17
-4

QML may be a better choice, it helps deal with wxWidget or QT underwear.

Maadiah
  • 431
  • 6
  • 20
  • 1
    QML seems a great tool, but is designed for Qt, so I think it is out of my scope, I didn't read anything relative to deal with wxWidgets with QML. Could you point me a link or explain how it helps with wxWidgets ? – Lomanic Nov 05 '13 at 18:26