commit 5ab48ddf22fa2123e43e285133b1383cc38dfda5 Author: David Fifield david@bamsoftware.com Date: Wed Nov 28 10:28:41 2012 -0800
Add (commented) GOBUILDFLAGS to use gccgo.
gccgo allows me to build for x86 from x86_64, which I can't figure out how to do with the standard golang package on Debian. This requires the gccgo-multilib package for the -m32 option. Also add the -static-libgo option, otherwise I get ./websocket-server: error while loading shared libraries: libgo.so.0: cannot open shared object file: No such file or directory when running on a different machine. The rest of the program remains dynamically linked. Using plain -static doesn't seem like a good idea: /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libgo.a(net.o): In function `net.cgoLookupIPCNAME': (.text+0x11893): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
gccgo probably gives us better optimization; with -O3 it at least seems to inline and do something clever with the applyMask function, which historically has been the bottleneck in the Python WebSocket implementation. --- websocket-transport/Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/websocket-transport/Makefile b/websocket-transport/Makefile index b4e02e1..ac6fa08 100644 --- a/websocket-transport/Makefile +++ b/websocket-transport/Makefile @@ -4,6 +4,10 @@ BINDIR = $(PREFIX)/bin PROGRAMS = websocket-client websocket-server
GOBUILDFLAGS = +# Alternate flags to use gccgo, allowing cross-compiling for x86 from +# x86_64, and presumably better optimization. Install this package: +# apt-get install gccgo-multilib +# GOBUILDFLAGS = -compiler gccgo -gccgoflags "-O3 -m32 -static-libgo"
all: websocket-server