-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Static build? #512
Comments
Agree it'd be great to have a possibility to create a static build. For example ubuntu/debian seems not provide the Trying to compile statically on ubuntu, we'll get the following...
|
Wondering if this could be solved with fyne-cross. |
Yes, fyne_cross could solve it. |
Any chance to do without cgo? The way I understand it, Go cross-compilation for other architectures and OSes only works as long as cgo is not used. |
Actually cross-compilation is possible with cGo enabled, you just have to add some additional tools. We have the process written up on the website https://fyne.io/develop/cross-compiling.html. If we did it without cGo we would be relying on software renderers and no graphics card assistance so performance would be significantly degraded. |
Thanks for the explanation @andydotxyz. A big reason for me to use Go is that Go binaries produced on the latest Linux distribution will also run on older target systems. Is this still true when using cGo? |
Yes it works on older systems, to an extent. You wound be able to go back to a previous major release. For example if linked to libX11.so.6 it won’t work on a system so old it uses libX11.so.5... honestly I don’t know how far back you can go without trouble. But you could build on the older system if you have trouble :) |
Reading more on X11 static linking it seems like it's not recommended. |
Let's say someone compiles an app on the latest Ubuntu. Will the same binary still run on, say, Ubuntu gutsy? |
If the OpenGL library is compatible it should. Unfortunately if we static compile the GL driver this does not ensure complete compatibility... as well as bigger apps they will be tied to the graphics card vendor so won’t be as portable as you’d like either. It’s a trade off but I think dynamic linking to the graphics driver is probably best. |
Does this issue need further work? I think we reached the conclusion that it's "as static as makes sense"? |
From looking at your answers it seems like dynamically linking or dlopening graphics drivers (such as nvidia) makes sense, while other things could be statically linked. Do I read you correctly? If so, it would be great if it could be done in a way which allows the application to still run on a system that lacks e.g., the nvidia driver, albeit with lower performance. |
Yes, Fyne links everything statically apart from the graphics driver (and system APIs such as macOS or X11). |
Perhaps you can share the problem that you are having so we can try and solve it directly? |
I would like to build, ideally without the need for CGo and gcc, a GUI application that will run on any Linux distribution with as few dependencies as possible. Especially, I would like to be able to compile the Go code on e.g., Ubuntu 20.04, and know for sure that the binary will be able to run on, e.g, CentOS 6. |
Fyne will probably never work without CGo, the types of system integrations we are aiming to deliver cannot be done without accessing native libraries. I don’t know how different Ubuntu 20.04 and CentOS 6 are, but until there is a report of what doesn’t work it’s tough to try and fix the issue. |
That is unfortunate to hear, but I understand. The main reason I am using Go is that it can compile down to binaries that do not use any libraries from the system, and hence can run on any Linux distribution. Let's close this here for now, at least until someone can provide a concrete example of incompatibilities. Thanks for taking the time to respond, appreciate it. |
Ok thanks. |
Is your feature request related to a problem? Please describe.
I'm always frustrated when applications don't run on my Linux desktop because the developer used a more recent system to compile, making the binary unable to run on my system. I am happy with typical Go programs, because they are linked statically, which means they pretty always run on my machine, as they don't need any libraries on the system.
Is it possible to construct a solution with the existing API?
I don't know
Describe the solution you'd like
Statically linked binaries using Fyne.
Not this:
The text was updated successfully, but these errors were encountered: