英文:
Getting error when trying to 'go get' the geos package
问题
我尝试运行一个新的Golang项目,我已经安装了所有的东西,但是我遇到了以下问题:
$ go get github.com/paulsmith/gogeos/geos
#### #github.com/paulsmith/gogeos/geos
In file included from ..\..\go\pkg\mod\github.com\paulsmith\gogeos@v0.1.2\geos\coordseq.go:4:
./geos.h:1:10: fatal error: geos_c.h: No such file or directory
1 | #include <geos_c.h>
| ^~~~~~~~~~
compilation terminated.
英文:
i have tried to run a new project of golang i've installed everything but I faced the following problem
$ go get github.com/paulsmith/gogeos/geos
#### #github.com/paulsmith/gogeos/geos
In file included from ..\..\go\pkg\mod\github.com\paulsmith\gogeos@v0.1.2\geos\coordseq.go:4:
./geos.h:1:10: fatal error: geos_c.h: No such file or directory
1 | #include <geos_c.h>
| ^~~~~~~~~~
compilation terminated.
答案1
得分: 2
根据项目页面上的安装说明,看起来你需要先安装GEOS;请参考这部分:https://github.com/paulsmith/gogeos#requirements
在Ubuntu上,可以简单地使用$ apt-get install libgeos-dev
进行安装,但上面的链接也提供了从源代码安装的说明。
在你的情况下,Go包很可能使用cgo
从GEOS加载C代码,但由于未安装GEOS且cgo
无法找到头文件,所以加载失败。
英文:
Looking at the installation instructions on the project's page, it seems like you have to install GEOS first; see this part: https://github.com/paulsmith/gogeos#requirements
It can be as easy as $ apt-get install libgeos-dev
on Ubuntu, but the link above has instructions for a from-source installation as well.
What happens in your case is that the Go package likely uses cgo
to load C code from GEOS, and it fails immediately because GEOS is not installed, and cgo
cannot find the headers files.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论