尝试使用”go get”命令获取geos包时出现错误。

huangapple go评论81阅读模式
英文:

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 &lt;geos_c.h&gt;
      |          ^~~~~~~~~~
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.

huangapple
  • 本文由 发表于 2021年8月4日 23:53:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/68654402.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定