https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63731
--- Comment #4 from Yohei Ueda <yohei at jp dot ibm.com> --- Thank you for the correction. I need to use the following instructions to enable netgo with GC. $ go version go version devel +ae495517bd72 Fri Nov 14 11:43:01 2014 +1100 linux/amd64 $ go build -ldflags '-linkmode external -extldflags -static' -a -tags netgo lookup.go $ ./lookup 209.132.180.131 Now, I have a question about how to do the same thing with GCCGO. I think the -a option for the go command is essential to enable netgo, but the -a option seems not working with the standard GO library of GCCGO. $ go build -compiler gccgo -gccgoflags '-static' -a -tags netgo lookup.go # command-line-arguments /usr/local/gccgo-216834/lib/gcc/x86_64-unknown-linux-gnu/5.0.0/../../../../lib64/libgo.a(net.o): In function `net.cgoLookupPort': /home/yohei/gccgo.216834/bld/x86_64-unknown-linux-gnu/libgo/../../../src/libgo/go/net/cgo_unix.go:83: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking $ ./lookup lookup gcc.gnu.org: Name or service not known $ LD_LIBRARY_PATH=/lib/x86_64-linux-gnu ./lookup 209.132.180.131 I confirmed that the source code exists under $GOROOT/src where $GOROOT is the value reported by go env GOROOT. I also put libgo/go in the GCC source code into $(PREFIX)/src/pkg.