goLang依赖项的问题

时间:2016-04-02 09:31:26

标签: ubuntu go dependencies

我正在尝试编译以下github project,但是我遇到了依赖项问题。以下go get命令失败,并显示以下错误

go get -u github.com/go-gl/glfw/v3.1/glfw

失败并出现以下情况:

# github.com/go-gl/glfw/v3.1/glfw
In file included from /home/bob/go/src/github.com/go-gl/glfw/v3.1/glfw/context.go:4:0:
glfw/include/GLFW/glfw3.h:153:21: fatal error: GL/gl.h: No such file or directory
compilation terminated.

go get github.com/go-gl/gl/v2.1-core/gl

package github.com/go-gl/gl/v2.1-core/gl: cannot find package "github.com/go-gl/gl/v2.1-core/gl" in any of:
        /usr/local/go/src/github.com/go-gl/gl/v2.1-core/gl (from $GOROOT)
        /home/bob/go/src/github.com/go-gl/gl/v2.1-core/gl (from $GOPATH)

我在/usr/local/go安装了golang,以及〜/ .profile中的以下内容:

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin

1 个答案:

答案 0 :(得分:2)

对于您的第一个问题,因为您的ubuntu计算机缺少GL.h.您可以通过在go-gl github page

中按要求安装dev lib来安装它
sudo apt-get install libgl1-mesa-dev

在此之后,您可以获得核心库。我在我的亚马逊ubuntu实例上测试过并且工作正常。

如果仍然缺少某些内容,请尝试使用关键字google:

ubuntu the_missing_file_name is missing

此外,我发现此页面对您的安装问题非常有用:https://github.com/google/gxui/wiki/Installation

基本上,安装这些软件包:

sudo apt-get install libgl1-mesa-dev (or freeglut3-dev)
sudo apt-get install libxrandr-dev
sudo apt-get install libxcursor-dev
sudo apt-get install libxi-dev
sudo apt-get install libxinerama-dev

安装完所有必需的开发包后,你可以成功获得glfw:)

相关问题