构建错误:lzma.h文件或目录不存在

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

go building error: lzma.h No such file or directory

问题

我正在构建payload-dumper-go,并且遇到了这个错误:

❯ go build
# github.com/spencercw/go-xz
/home/ecarroll/go/pkg/mod/github.com/spencercw/go-xz@v0.0.0-20181128201811-c82a2123b492/compression.go:36:10: 致命错误: lzma.h: 没有那个文件或目录
   36 | #include <lzma.h>
      |          ^~~~~~~~
编译终止。
英文:

I'm building payload-dumper-go, and I get this error,

❯ go build
# github.com/spencercw/go-xz
/home/ecarroll/go/pkg/mod/github.com/spencercw/go-xz@v0.0.0-20181128201811-c82a2123b492/compression.go:36:10: fatal error: lzma.h: No such file or directory
   36 | #include &lt;lzma.h&gt;
      |          ^~~~~~~~
compilation terminated.

答案1

得分: 1

这是一个更简单的“下次”方法。

github.com/ssut/payload-dumper-go 使用 Github Actions 进行构建和测试。

检查它的 .github/workflows/build.yml 文件:

...
步骤:
  - 名称:安装依赖项
    运行:
      sudo apt -y update
      sudo apt -y install git golang liblzma-dev
...

最后引用的一行包含所需的依赖项,即 gitgolangliblzma-dev

英文:

Here's an easier way for "next time".

github.com/ssut/payload-dumper-go uses Github Actions for building and testing.

Checking its .github/workflows/build.yml file:

...
steps:
  - name: Install dependencies
    run: |
      sudo apt -y update
      sudo apt -y install git golang liblzma-dev
...

The last quoted line contains the needed dependencies, namely git, golang and liblzma-dev.

答案2

得分: 0

我通过尝试Debian上的所有lzma相关内容来解决这个问题。实际上需要安装的软件包是:

sudo apt install liblzma-dev

以下是无法正常工作的软件包:

  • lzma-dev
  • golang-github-kjk-lzma-dev
英文:

I solve this by brute force trying all lzma stuff that Debian had. The actually packaged needed was,

sudo apt install liblzma-dev

packages that didn't work,

  • lzma-dev
  • golang-github-kjk-lzma-dev

huangapple
  • 本文由 发表于 2022年7月11日 00:42:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/72930201.html
匿名

发表评论

匿名网友

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

确定