首页 > 其他分享 >`cargo build`报错:`failed to run custom build command for libgit2-sys v0.13.2+1.4.2`

`cargo build`报错:`failed to run custom build command for libgit2-sys v0.13.2+1.4.2`

时间:2024-01-17 15:48:51浏览次数:47  
标签:libgit2 cargo sys 报错 build git2 include

cargo build报错:failed to run custom build command for libgit2-sys v0.13.2+1.4.2

1 问题背景

在使用cargo编译cargo-cache时出现报错:

The following warnings were emitted during compilation:

warning: [email protected]+1.4.2: In file included from libgit2/src/pack.h:21,
warning: [email protected]+1.4.2:                  from libgit2/src/delta.h:10,
warning: [email protected]+1.4.2:                  from libgit2/src/apply.c:18:
warning: [email protected]+1.4.2: libgit2/src/zstream.h:12:10: fatal error: zlib.h: No such file or directory
warning: [email protected]+1.4.2:    12 | #include <zlib.h>
warning: [email protected]+1.4.2:       |          ^~~~~~~~
warning: [email protected]+1.4.2: compilation terminated.
warning: [email protected]+1.4.2: In file included from libgit2/src/attr_file.c:11:
warning: [email protected]+1.4.2: libgit2/src/filebuf.h:14:10: fatal error: zlib.h: No such file or directory
warning: [email protected]+1.4.2:    14 | #include <zlib.h>
warning: [email protected]+1.4.2:       |          ^~~~~~~~
warning: [email protected]+1.4.2: compilation terminated.

error: failed to run custom build command for `libgit2-sys v0.13.2+1.4.2`

Caused by:
  process didn't exit successfully: `/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5908449b9984da5b/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-cfg=libgit2_vendored
  libgit2/include/git2/email.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/email.h
  libgit2/include/git2/patch.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/patch.h
  libgit2/include/git2/pack.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/pack.h
  libgit2/include/git2/credential_helpers.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/credential_helpers.h
  libgit2/include/git2/tree.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/tree.h
  libgit2/include/git2/filter.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/filter.h
  libgit2/include/git2/deprecated.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/deprecated.h
  libgit2/include/git2/attr.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/attr.h
  libgit2/include/git2/apply.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/apply.h
  libgit2/include/git2/errors.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/errors.h
  libgit2/include/git2/revparse.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/revparse.h
  libgit2/include/git2/odb.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/odb.h
  libgit2/include/git2/remote.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/remote.h
  libgit2/include/git2/net.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/net.h
  libgit2/include/git2/repository.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/repository.h
  libgit2/include/git2/index.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/index.h
  libgit2/include/git2/sys/email.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/email.h
  libgit2/include/git2/sys/alloc.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/alloc.h
  libgit2/include/git2/sys/filter.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/filter.h
  libgit2/include/git2/sys/remote.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/remote.h
  libgit2/include/git2/sys/repository.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/repository.h
  libgit2/include/git2/sys/index.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/index.h
  libgit2/include/git2/sys/refs.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/refs.h
  libgit2/include/git2/sys/diff.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/diff.h
  libgit2/include/git2/sys/commit_graph.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/commit_graph.h
  libgit2/include/git2/sys/transport.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/transport.h
  libgit2/include/git2/sys/stream.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/stream.h
  libgit2/include/git2/sys/odb_backend.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/odb_backend.h
  libgit2/include/git2/sys/refdb_backend.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/refdb_backend.h
  libgit2/include/git2/sys/path.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/path.h
  libgit2/include/git2/sys/mempack.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/mempack.h
  libgit2/include/git2/sys/hashsig.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/hashsig.h
  libgit2/include/git2/sys/merge.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/merge.h
  libgit2/include/git2/sys/credential.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/credential.h
  libgit2/include/git2/sys/config.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/config.h
  libgit2/include/git2/sys/reflog.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/reflog.h
  libgit2/include/git2/sys/openssl.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/openssl.h
  libgit2/include/git2/sys/cred.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/cred.h
  libgit2/include/git2/sys/commit.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/commit.h
  libgit2/include/git2/sys/midx.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/sys/midx.h
  libgit2/include/git2/refs.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/refs.h
  libgit2/include/git2/refspec.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/refspec.h
  libgit2/include/git2/checkout.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/checkout.h
  libgit2/include/git2/transaction.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/transaction.h
  libgit2/include/git2/mailmap.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/mailmap.h
  libgit2/include/git2/diff.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/diff.h
  libgit2/include/git2/tag.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/tag.h
  libgit2/include/git2/global.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/global.h
  libgit2/include/git2/blob.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/blob.h
  libgit2/include/git2/transport.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/transport.h
  libgit2/include/git2/oid.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/oid.h
  libgit2/include/git2/cert.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/cert.h
  libgit2/include/git2/odb_backend.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/odb_backend.h
  libgit2/include/git2/reset.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/reset.h
  libgit2/include/git2/status.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/status.h
  libgit2/include/git2/signature.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/signature.h
  libgit2/include/git2/message.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/message.h
  libgit2/include/git2/buffer.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/buffer.h
  libgit2/include/git2/describe.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/describe.h
  libgit2/include/git2/strarray.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/strarray.h
  libgit2/include/git2/stdint.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/stdint.h
  libgit2/include/git2/revert.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/revert.h
  libgit2/include/git2/cred_helpers.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/cred_helpers.h
  libgit2/include/git2/ignore.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/ignore.h
  libgit2/include/git2/graph.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/graph.h
  libgit2/include/git2/indexer.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/indexer.h
  libgit2/include/git2/stash.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/stash.h
  libgit2/include/git2/merge.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/merge.h
  libgit2/include/git2/proxy.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/proxy.h
  libgit2/include/git2/credential.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/credential.h
  libgit2/include/git2/config.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/config.h
  libgit2/include/git2/reflog.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/reflog.h
  libgit2/include/git2/branch.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/branch.h
  libgit2/include/git2/version.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/version.h
  libgit2/include/git2/pathspec.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/pathspec.h
  libgit2/include/git2/rebase.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/rebase.h
  libgit2/include/git2/types.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/types.h
  libgit2/include/git2/annotated_commit.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/annotated_commit.h
  libgit2/include/git2/object.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/object.h
  libgit2/include/git2/revwalk.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/revwalk.h
  libgit2/include/git2/refdb.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/refdb.h
  libgit2/include/git2/worktree.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/worktree.h
  libgit2/include/git2/oidarray.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/oidarray.h
  libgit2/include/git2/blame.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/blame.h
  libgit2/include/git2/trace.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/trace.h
  libgit2/include/git2/commit.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/commit.h
  libgit2/include/git2/submodule.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/submodule.h
  libgit2/include/git2/cherrypick.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/cherrypick.h
  libgit2/include/git2/notes.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/notes.h
  libgit2/include/git2/clone.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/clone.h
  libgit2/include/git2/common.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2/common.h
  libgit2/include/git2.h => /home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include/git2.h
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/alloc.o" "-c" "libgit2/src/alloc.c"
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/annotated_commit.o" "-c" "libgit2/src/annotated_commit.c"
  exit status: 0
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/apply.o" "-c" "libgit2/src/apply.c"
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/attr.o" "-c" "libgit2/src/attr.c"
  exit status: 0
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/attr_file.o" "-c" "libgit2/src/attr_file.c"
  cargo:warning=In file included from libgit2/src/pack.h:21,
  cargo:warning=                 from libgit2/src/delta.h:10,
  cargo:warning=                 from libgit2/src/apply.c:18:
  cargo:warning=libgit2/src/zstream.h:12:10: fatal error: zlib.h: No such file or directory
  cargo:warning=   12 | #include <zlib.h>
  cargo:warning=      |          ^~~~~~~~
  cargo:warning=compilation terminated.
  exit status: 1
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/attrcache.o" "-c" "libgit2/src/attrcache.c"
  cargo:warning=In file included from libgit2/src/attr_file.c:11:
  cargo:warning=libgit2/src/filebuf.h:14:10: fatal error: zlib.h: No such file or directory
  cargo:warning=   14 | #include <zlib.h>
  cargo:warning=      |          ^~~~~~~~
  cargo:warning=compilation terminated.
  exit status: 1
  exit status: 0
  exit status: 0

  --- stderr


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/include" "-I" "libgit2/src" "-I" "libgit2/deps/http-parser" "-I" "libgit2/deps/pcre" "-fvisibility=hidden" "-DGIT_REGEX_BUILTIN=1" "-DHAVE_STDINT_H=1" "-DHAVE_MEMMOVE=1" "-DNO_RECURSE=1" "-DNEWLINE=10" "-DPOSIX_MALLOC_THRESHOLD=10" "-DLINK_SIZE=2" "-DPARENS_NEST_LIMIT=250" "-DMATCH_LIMIT=10000000" "-DMATCH_LIMIT_RECURSION=MATCH_LIMIT" "-DMAX_NAME_SIZE=32" "-DMAX_NAME_COUNT=10000" "-DSHA1DC_NO_STANDARD_INCLUDES=1" "-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"" "-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"" "-o" "/home/yann/Github/cargo-cache-0.8.3/target/debug/build/libgit2-sys-5ab9663e3b04c38d/out/build/libgit2/src/apply.o" "-c" "libgit2/src/apply.c" with args "cc" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...

2 解决问题

2.1 可能原因1:zlib库缺失

解决方案:安装zlib库即可。

对debian/ubuntu,在命令行执行如下命令:

$ sudo apt-get install zlib1g-dev

2.2 可能原因2:环境变量冲突

由于我已经安装了zlib库,且该头文件没有缺失。在排查了很久的问题后,发现是anaconda/miniconda的环境变量导致。由于anaconda/miniconda默认将其环境变量添加在PATH的头部,导致cargo build时尝试从anaconda/miniconda的环境变量中找依赖,最后出现冲突。

解决方案:

  • 方案1:将anaconda/miniconda添加的环境变量从PATH中删除,或者移动到PATH末尾。
  • 方案2:conda deactivate退出虚拟环境后,再进行编译。

相似问题:Linking error on OSX

标签:libgit2,cargo,sys,报错,build,git2,include
From: https://www.cnblogs.com/yann-qu/p/17970158

相关文章

  • 鸿蒙ArkTs,重新配置签名(真机运行报错而控制台没有报错的解决方法)
     找到如下路径,删除该代码段,重新认证。 找到项目结构  重新配置签名 点击SignIn,会自动跳入华为官网,登录华为账号后,授权登录,弹出如下页面 再次回到IDE,会弹出如下页面,点击Agree同意   随后IDE会自动生成签名文件,点击OK后,会看到根目录的build-profile.json......
  • vite 生产打包后报错 xx is not a constructor
    版本vite:"^5.0.11"解决方法添加optimizeDeps.disabled=false和build.commonjsOptions.include=[]。vite.config.tsimport{defineConfig}from'vite'importreactfrom'@vitejs/plugin-react'exportdefaultdefineConfig({plu......
  • systemtap首次运行.stp时奇怪报错解决
    一句话:更换合适版本。不管是源码编译还是直接安装的预编译包,版本必须与你的kernel匹配,不然就是一堆奇怪的报错,正面去解决是不可能的。 你可能会遇到这些编译输出:----------------------------------------------------------------------------------------------------------......
  • python 连接mysql 报错 打包 报错
    mysql.connector.connect(auth_plugin='mysql_native_password',host=lis[0],database=lis[1],user=lis[2],password=lis[3])auth_plugin='mysql_native_password'Python连接MySQL报错:mysql.connector.errors.NotSupportedError:Authenticationplugin......
  • 关于提交git出现“lint-staged“报错
    因为提交推送前会触发pre-commit勾子,由于代码出现不规范被检测到所以禁止提交,如果想取消这个提交前校验可以卸载掉husky,这里以npm为例输入命令:npm  uninstallhusky--save其他两种解决办法:1:进入项目的.git文件夹这个文件夹默认为隐藏的,可先设置显示,再进入hooks文件夹,删除pre......
  • jenkins启动报错:Failed Loading global config
    jenkins启动报错:FailedLoadingglobalconfig 问题起因:想在构建项目中使用复选框(ExtendedChoiceParameter),需要安装ExtendedChoiceParameter插件,但是因为版本过低的原因,导致插件无法正常安装。然后根据提示,就在jenkins的web页面进行了自动升级。但是在升级过程中......
  • getx getbuilder使用方法
    CounterBinding:classCounterBindingextendsBindings{@overridevoiddependencies(){Get.lazyPut(()=>CounterController());}}CounterController:classCounterControllerextendsGetxController{intcount=0;voidincrease(){......
  • git pull 报错:ssh: connect to host github.com port 22: Connection timed out
    在执行gitpull时提示错误:ssh:connecttohostgithub.comport22:Connectiontimedout解决方案:添加config文件vim~/.ssh/config添加如下内容Hostgithub.comHostnamessh.github.comPort443ssh:connecttohostgithub.comport22:Connectionti......
  • Elasticsearch索引不存在时,查询接口报错怎么办?
    1、索引不存在,报错:type=index_not_found_exception,reason=nosuchindex解决办法:DSL:GET/text_index_003/_search?ignore_unavailable=truejava代码:NativeSearchQuerysearchQuery=newNativeSearchQueryBuilder().withIndicesOptions(IndicesOpti......
  • vscode报错Pylance client: couldn‘t create connection to server.解决
    问题描述:一打开vscode,右下角就弹报错,Pylanceclient:couldn’tcreateconnectiontoserver.,让我打开output,打开后似乎是在说连不上server因为连不上server,所以我的python代码没法解析,尝试重开vscode也没用问题解决:点开左侧的拓展,找到PythonExtensionPack,这就是解析python代......