I have noticed that when using go build
the binary result can be in excess of 2MB; but using gccgo
the binary is less than 35k.
The other issue that I noticed when using gccgo
is that the produced binary isn't runnable on another linux box (missing libgo.so
I believe) but the go build
binary runs just fine (so I imagine its because the binary includes all that is necessary to run?); is there a way to do this with gccgo
?
You have to use the -static flag:
Use the -static option to do a fully static link (the default for the gc compiler).