英文:
Issues with goLang dependencies
问题
我正在尝试编译以下的 GitHub 项目链接,但是我在处理依赖项时遇到了问题。以下的 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
英文:
I'm trying to compile the following github project, however I'm having issues with the dependencies. The following go get commands fails with the errors noted below
go get -u github.com/go-gl/glfw/v3.1/glfw
fails with the following:
# 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.
and
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)
I have golang installed in /usr/local/go
and the following in ~/.profile:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin
答案1
得分: 2
对于你的第一个问题,这是因为你的Ubuntu机器缺少GL.h文件。你可以通过安装开发库来解决这个问题,具体要求在他们的go-gl github页面中有说明:
sudo apt-get install libgl1-mesa-dev
安装完成后,你可以获取核心库。我在我的亚马逊Ubuntu实例上进行了测试,一切正常。
如果还有其他缺失的内容,可以尝试使用关键词在Google上搜索:
ubuntu 缺失的文件名 is missing
此外,我发现这个页面对于你的安装问题非常有用:https://github.com/google/gxui/wiki/Installation
基本上,安装以下这些软件包:
sudo apt-get install libgl1-mesa-dev (或者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了
英文:
For your first question, it's because GL.h is missing from your ubuntu machine. You could get it installed by installing the dev lib as stated as requirement in their go-gl github page:
sudo apt-get install libgl1-mesa-dev
After this, you could go get the core lib. I've tested on my amazon ubuntu instance and worked fine.
If there still are something missing, try google using the key word:
ubuntu the_missing_file_name is missing
Also, I find this page very useful for your installing issues: https://github.com/google/gxui/wiki/Installation
Basically, install these packages:
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
After you installed all the required dev packages, you could go get glfw successfully
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论