dongyuying1507 2014-05-31 23:02
浏览 64
已采纳

如何在OS X,CentOS 6上构建goncurses

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?

  • 写回答

2条回答 默认 最新

  • doudanglang5826 2014-05-31 23:02
    关注

    @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/

    mkdir ~/local-pkg-config
    PKG_CONFIG_LIBDIR=~/local-pkg-config ./configure --prefix=/usr/local/ --enable-pc-files --with-pkg-config
    make && make install
    

    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:

    @@ -1,7 +1,7 @@
    -prefix=/usr/local/
    +prefix=/usr/local/Cellar/ncurses/5.9/
     exec_prefix=${prefix}
     libdir=${exec_prefix}/lib
    -includedir=${prefix}/include/ncurses
    +includedir=${prefix}/include
     major_version=5
     version=5.9.20110404
    

    Now on either platform you're set up to go get the goncurses package:

    PKG_CONFIG_PATH=~/local-pkg-config/ go get -v code.google.com/p/goncurses
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条