如何更改“去建立”的lib路径 [英] How to change lib path for "go build"

查看:163
本文介绍了如何更改“去建立”的lib路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用goncurses。在Centos 6上,ncurses库是旧的(5.7,想要5.9),所以我从源代码创建了ncurses并将它安装到/ usr / lib,/ usr / include等。



我该如何告诉去得到运行在/ usr / lib而不是/ lib系统中的东西?



这是我当前的输出:

  $ go get -v code.google.com/p/goncurses 
code.google.com/p/ goncurses
#code.google.com/p/goncurses
/tmp/go-build076024492/code.google.com/p/goncurses/_obj/goncurses.o:在函数`ncurses_is_subwin'中:
src / code.google.com / p / goncurses / goncurses.c:71:对`is_subwin'的未定义引用
/tmp/go-build076024492/code.google.com/p/goncurses/_obj/goncurses .o:函数`ncurses_is_pad':
src / code.google.com / p / goncurses / goncurses.c:63:未定义的引用'is_pad'
collect2:ld返回1退出状态

我试过了 LD_LIBRARY_PATH = / usr / lib -ccflags = -I / usr / lib'不会改变任何行为。



我知道这是一个简单的问题,但我的google-fu失败

c $ c> pkg-config 来获得正确的构建路径。



如果你可以得到 pkg-config 在你的系统上输出ncurses的正确路径 - 从那里开始做正确的事情。您的其他选项当然是分叉goncurses代码,并编辑源代码中的 #cgo 指令。


I'm trying to work with goncurses. On Centos 6 the ncurses library is old (5.7, wants 5.9), so I built ncurses from source and installed it into /usr/lib, /usr/include, etc.

How do I tell "go get" to run against the stuff in /usr/lib instead of the system stuff in /lib?

This is my currenty output:

$ go get -v code.google.com/p/goncurses
code.google.com/p/goncurses
# code.google.com/p/goncurses
/tmp/go-build076024492/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-build076024492/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'
collect2: ld returned 1 exit status

I've tried different variations on LD_LIBRARY_PATH=/usr/lib and -ccflags = '-I /usr/lib' with out any change in behavior.

I know it's a simple question, but my google-fu is failing me right now.

解决方案

The goncurses package is relying on pkg-config to get the proper paths for building.

If you can get pkg-config to output the correct paths for ncurses on your system -- go will do the right thing from there. Your other option is of course to fork the goncurses code, and edit the #cgo directives in the source.

这篇关于如何更改“去建立”的lib路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆