OS X, Centos 6 and Debian Squeeze all come with v5.7 of ncurses, but the go wrapper "goncurses" requires 5.9. Trying to build it on any of those platforms will give you an error like this:
$ go get -v code.google.com/p/goncurses
code.google.com/p/goncurses
# code.google.com/p/goncurses
/tmp/go-build527609801/code.google.com/p/goncurses/_obj/goncurses.o:
In function 'ncurses_is_subwin':src/code.google.com/p/goncurses/goncurses.c:71: undefined reference to `is_subwin'
/tmp/go-build527609801/code.google.com/p/goncurses/_obj/goncurses.o:
In function 'ncurses_is_pad':src/code.google.com/p/goncurses/goncurses.c:63: undefined reference to `is_pad'
You can use homebrew to install ncurses v5.9 on os x, and build from source into /usr/local/ on linux, but how do you get go
to use your upgraded ncurses when building?
@JimB answered my other question How to change lib path for "go build" with a suggestion to leverage pkg-config, which solution will look like this:
On CentOS 6 you can build ncurses from source like this, which will put the .pc files that drive pkg-config into your own directory instead of /usr/lib64/pkgconfig/
On OS X you can install ncurses from homebrew. Homebrew usually puts .pc files along with the package, e.g.
/usr/local/Cellar/pango/1.34.1/lib/pkgconfig/pango.pc
. For some reason homebrew doesn't have any .pc files with its ncurses, but I successfully grabbed the CentOS ones into ~/local-pkg-config and changed them to suit:Now on either platform you're set up to go get the goncurses package:
This Gist is a modified
ncurses
formula for Homebrew that adds the.pc
files to the keg. If you installncurses
with it, use thePKG_CONFIG_PATH
environment variable to point pkg-config to the.pc
files, before callinggo build
orgo run
.