-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
Allow running a statically-compiled Linux executable #212
Comments
👍 to this and to #190. No we just need to find someone to implement it! |
That's actually one of the ideas for our GSoC application. On Thu, Feb 13, 2014 at 5:48 PM, Pekka Enberg notifications@github.comwrote:
|
Hi, can you please explain how this issue is different from #190? I see you Is the difference the word static? Do you actually mean a static executable |
Now that I'm back to a computer with a decent keyboard, I can expand on my previous answer. First, can you please explain to me why the Go people even want static linking? Static linking has so many problems: It generates huge executables, it waste tons of memory when different processes running together cannot share text pages ("shared libraries" got their name for a reason). It creates security problems when it's not enough to update a library, you also need to update all the programs that used it. Almost 10 years ago, Solaris 10 came out with an announcement: Static libc is no longer provided. You can no longer create static executables (if they use libc). Hardly anyone cried. Why would Go want to bring it back? Is it possible to compile go programs so that its runtime does not run Linux system calls directly, but rather use glibc (and links to it dynamically)? If I understand correctly, this is possible (with gccgo), so what's the benefit of not doing this? Second, I want to explain what it would take to get OSv to run executables which are statically linked with libc.a - or executables which directly use Linux system calls and don't use libc at all. |
@nyh I assume it's to avoid Go version dependency issues but I couldn't really find a reference for it. Not that it really matters much why Go decided to go for static linking. If we want to run Go programs on OSv, that's what we have to support. |
On Thu, Feb 13, 2014 at 11:11 PM, nyh notifications@github.com wrote:
Nadav. wrt sharing pages: what are you talking about? For us that's
Well, let them. So what ? |
On Thu, Feb 13, 2014 at 12:41:25PM -0800, Glauber Costa wrote:
|
On Fri, Feb 14, 2014 at 10:06 PM, Gleb Natapov notifications@github.comwrote:
That's my definition of rare. |
On Fri, Feb 14, 2014 at 10:08:19AM -0800, Glauber Costa wrote:
|
On Fri, Feb 14, 2014 at 10:13 PM, Gleb Natapov notifications@github.comwrote:
This is what I mean by rare. The rest is a semantic discussion I have no
|
On Fri, Feb 14, 2014 at 10:16:56AM -0800, Glauber Costa wrote:
|
On Fri, Feb 14, 2014 at 10:43 PM, Gleb Natapov notifications@github.comwrote:
|
JFTR... ( @nyh ) golang executables, as produced by the native go toolchain, are not only statically compiled but do NOT use glibc at all. Everything is implemented without any libc call, yes syscalls too. If you use an up to date go toolchain you can also compile a go executable without using the libc resolver at all. Instead an internal one will be used, producing static executables even when network libraries are used. IMHO the most elegant way to integrate golang with OSv would be to add another architecture to the runtime which than can use native OSv methods to access the environment (network, ...). |
@nyh Reasoning behind Go's decision to use static executable is, having a very stable execution among different servers. If the kernel is identical (and mostly it is), there could be little differences between running it in one server or another. One of the JVM guys who now works on Go mentioned in a talk his frustration of finding subtle bugs when moving a JVM program between different JVMs among different servers. You can see Rob Pike's objection to dynamic linking (back in plan9, and obviously now as one of Go's authors) here |
On Thu, Jul 3, 2014 at 10:04 AM, Elazar Leibovich notifications@github.com
With all due respect to Rob Pike (and I have a lot of it!), I remember Nadav Har'El |
@nyh OTOH, I would pay good money to see you have that discussion with Mr. Pike. 😄 |
But I guess this isn't the question now... If Go uses static executables,
|
JFTR... It's not a big deal if osv does not support running go executables compiled for the linux platform. IMHO there is no need to wast time on this! Go executables are distributed in source form and installed with a simple |
@gebi I think it won't be easy to patch Go into producing PIC'd ELF, since they use their own C compiler and linker. As of using gccgo, I paste my thought from the mailing list:
The main benefit of the ability to run native Linux ELF files, is that it allows someone not familiar with OSv to play with it, and try his favorite programs on OSv with minimal friction. |
There is also a plan for golang 1.5 to enable packaging the go library as a shared lib. I think they may also allow you to compile a go app to .so, So that it doesn't need to be an executable won't this allow golang to work out the box in osv? |
Modern golang already supports compiling the executable as a shared library or PIE, so Go is no longer a reason to support statically-linked executables. |
@nyh, should it be closed because of the reasons stated in last comment? |
Well, the original request - wanting to run statically-linked executables on OSv - still stands. It's just that now that it's not needed for Go, it is even lower priority than it was. And 90% of the arguments above, about why Go uses static executables, become irrelevant. Maybe we should open a new, clean, issue and close this one. |
OSv currently can only run position-independent shared objects.
This means we usually can't run a random Linux application without recompiling it (with
-fPIC -shared
), unless we're lucky and the application is already mostly a .so (like is the case in the JVM).It is, as detailed below, desireable to allow running a single statically compiled executable, as created for example by the Go programming language (Golang).
The Go programming language was created with the needs of server farms at Google, cloud computing, multicore processors and concurrency in mind and excels for use to write network servers and is positioned as such. Consequentially, its popularity has grown along with the trend in virtualization and cloud computing.
Running virtualized network servers in the cloud efficiently is also a primary use-case of OSv.
Because of this use-case overlap and bright future for the Go language in cloud computing, I created this ticket in the hope that the feature of running its statically compiled executables will be given an amount of priority and be available in one of the next releases.
This issue is possibly related to:
The text was updated successfully, but these errors were encountered: