Is it possible to build Linux executables on Windows with lxn/walk?

344 views
Skip to first unread message

洪嘉鴻

unread,
Apr 8, 2020, 7:08:18 AM4/8/20
to golang-nuts
Hello everyone:
I use golang with Win10. I want to build GUI executables which can work on Linux.
I found this and I could build GUI executable which can work on Windows.
However, I couldn't build GUI executable which can work on Linux with the followings:

       cd %~dp0
       set GOOS=linux
       set GOARCH=amd64
       go build -v -o gradientcomposite gradientcomposite.go
       pause
      
Is there something wrong with cross-compiler or could "lxn/walk" only work on Windows?

Any help is appreciated.
Thank you very much!
Max

sanye

unread,
Apr 8, 2020, 7:21:55 AM4/8/20
to golan...@googlegroups.com
lxn/walk use lxn/win, which wraps windows api,so you can not use it under linux

Any help is appreciated.
Thank you very much!
Max
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/437a3c1c-17aa-4d41-9560-3cabde2aa16f%40googlegroups.com.

洪嘉鴻

unread,
Apr 8, 2020, 9:43:58 AM4/8/20
to golang-nuts
I see.
Thank you very much!
Max

sanye於 2020年4月8日星期三 UTC+8下午3時21分55秒寫道:


On 4/8/20 3:08 PM, 洪嘉鴻 wrote:
Hello everyone:
I use golang with Win10. I want to build GUI executables which can work on Linux.
I found this and I could build GUI executable which can work on Windows.
However, I couldn't build GUI executable which can work on Linux with the followings:

       cd %~dp0
       set GOOS=linux
       set GOARCH=amd64
       go build -v -o gradientcomposite gradientcomposite.go
       pause
      
Is there something wrong with cross-compiler or could "lxn/walk" only work on Windows?
lxn/walk use lxn/win, which wraps windows api,so you can not use it under linux

Any help is appreciated.
Thank you very much!
Max
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.

Kevin Chadwick

unread,
Apr 8, 2020, 10:34:43 AM4/8/20
to golang-nuts@googlegroups.com >> golang-nuts
On 2020-04-08 10:43, 洪嘉鴻 wrote:
> lxn/walk use lxn/win, which wraps windows api,so you can not use it under linux

You could also look into wsl.

The key is to understand go.exe calls go from Windows with a wsl shell.

Also copying wsl env variables to Windows execution.

env GOOS=windows WSLENV=GOOS go.exe build

Alternatively you could maintain two installs of go. Linux/Windows

Kevin Chadwick

unread,
Apr 8, 2020, 10:43:06 AM4/8/20
to golang-nuts@googlegroups.com >> golang-nuts

>> lxn/walk use lxn/win, which wraps windows api,so you can not use it under linux

> You could also look into wsl.

oops, ignore my last.

I'm not sure there is a "Good" cross platform scenario for GO/html that matches
GOs cross platform abilities, at the moment. Desktop sure but not really, mobile
and desktop at the same time, fyne maybe.

I'm looking at running chrome with --app and and then webview on mobile, both
with a local http server.

Philip Chapman

unread,
Apr 8, 2020, 11:01:51 AM4/8/20
to Kevin Chadwick, golang-nuts@googlegroups.com >> golang-nuts
There are a few options, but it rather depends on what you need to do.  The most similar to walk for linux would be go-gtk3.  However, for cross-platform, probably the QT bindings.  If you want to go the embedded html route, there are a few different options.  I personally like Wails.  Here is a breakdown of some of the options so that you can research which one fits your needs:


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f6edf972-3f86-6eee-cc92-3568970ed8ef%40gmail.com.


--
Philip A. Chapman
Java Software Development
Enterprise, Web, and Desktop

Kevin Chadwick

unread,
Apr 8, 2020, 2:29:14 PM4/8/20
to golang-nuts
On 2020-04-08 12:00, Philip Chapman wrote:
> I personally like Wails.  Here is a breakdown of some of the options so that you
> can research which one fits your needs:

Interesting, though I assume cross compilation is far from what Go offers and
similar to fyne. IOW, it will be painful unless you run multiple virtual
machines/OS and compile natively?

Philip Chapman

unread,
Apr 8, 2020, 3:58:32 PM4/8/20
to Kevin Chadwick, golang-nuts
I do think that yes, you would have to set up some compile environment.  Compiling for Linux from Windows could be possible through an open source/free VM such as VirtualBox or maybe through Window's linux compatibility layer (https://docs.microsoft.com/en-us/windows/wsl/about)  though I am no expert on the latter.  Compiling for OSX is outside of my experience, but I rather doubt that there are proper cross compile options there.  The issue is less with golang or even the CPU, but more so with having the proper dependencies for each OS.  In this case, Fyne may be a better solution than others.  I've not tried it though, so your mileage may vary.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.


--
Philip A. Chapman

洪嘉鴻

unread,
Apr 9, 2020, 3:01:02 AM4/9/20
to golang-nuts
I want to run executables on both Windows and Linux.
I don't think it is convenient to maintain 2 codes with lxn/walk on Windows and go-gtk3 on Linux.
Therefore, I'm trying to look for something that could work on both Windows and Linux.
I'll try the breakdown you offered.
Thank you very much!
Max

Philip Chapman於 2020年4月8日星期三 UTC+8下午7時01分51秒寫道:
There are a few options, but it rather depends on what you need to do.  The most similar to walk for linux would be go-gtk3.  However, for cross-platform, probably the QT bindings.  If you want to go the embedded html route, there are a few different options.  I personally like Wails.  Here is a breakdown of some of the options so that you can research which one fits your needs:


On Wed, Apr 8, 2020 at 3:42 AM Kevin Chadwick <m8il...@gmail.com> wrote:

>> lxn/walk use lxn/win, which wraps windows api,so you can not use it under linux

> You could also look into wsl.

oops, ignore my last.

I'm not sure there is a "Good" cross platform scenario for GO/html that matches
GOs cross platform abilities, at the moment. Desktop sure but not really, mobile
and desktop at the same time, fyne maybe.

I'm looking at running chrome with --app and and then webview on mobile, both
with a local http server.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.

洪嘉鴻

unread,
Apr 9, 2020, 3:08:16 AM4/9/20
to golang-nuts
I've found this that could run chrome.
However, I'm not sure whether it could run chrome with mobile or not.
Thanks for your replying!
Max

Kevin Chadwick於 2020年4月8日星期三 UTC+8下午6時43分06秒寫道:

Ronny Bangsund

unread,
Apr 9, 2020, 3:14:35 AM4/9/20
to golang-nuts
On Thursday, April 9, 2020 at 5:01:02 AM UTC+2, 洪嘉鴻 wrote:
I want to run executables on both Windows and Linux.
I don't think it is convenient to maintain 2 codes with lxn/walk on Windows and go-gtk3 on Linux.
Yeah, it gets messy quickly. It can be done, but then you're probably writing another abstraction layer anyway.
 
I started on a hobby project in Fyne today, and combined with fyne-cross I had Linux, macOS and Windows building up and running within minutes. There are some elementary widgets and features (mainly listviews, treeviews and systray stuff) I wish for, but their development process means they'd rather have something working than ship half-done features. That sort of thing makes me think it's the most promising Go GUI/app framework right now.

洪嘉鴻

unread,
Apr 9, 2020, 4:03:24 AM4/9/20
to golang-nuts
Excuse me.
Did you mean this?
Thank you very much!
Max

Ronny Bangsund於 2020年4月9日星期四 UTC+8上午11時14分35秒寫道:

Ronny Bangsund

unread,
Apr 9, 2020, 4:40:41 AM4/9/20
to golang-nuts


On Thursday, April 9, 2020 at 6:03:24 AM UTC+2, 洪嘉鴻 wrote:
Excuse me.
Did you mean this?
Thank you very much!
Yes, that's the one, Docs at https://fyne.io and the cross-builder/packager at https://github.com/lucor/fyne-cross

洪嘉鴻

unread,
Apr 9, 2020, 5:37:36 AM4/9/20
to golang-nuts
I see.
I'll try it.
Thank you very much!
Max

Ronny Bangsund於 2020年4月9日星期四 UTC+8下午12時40分41秒寫道:
Reply all
Reply to author
Forward
0 new messages