dsf4354353452 2018-08-20 10:43
浏览 190
已采纳

运行带有dep的vet时找不到头文件

I get this error when running go vet in my project, with vendored dependencies.

$ go vet ./...
# <project path...>/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:10: fatal error: libsecp256k1/include/secp256k1.h: No such file or directory
 #include "libsecp256k1/include/secp256k1.h"

I thought that this was a dependency missing in the development environment, but when looking at the original project source, the include path is relative to the source file.

Why can the file not be found?

  • 写回答

2条回答 默认 最新

  • duanchendu69495 2018-08-20 10:43
    关注

    Some dependency management tools for go do not vendor all code that is referenced by the project. This means that in some circumstances C code, that can be used in go files with cgo, are not included in the vendor directory.

    I have encountered this issue twice with two separate vendoring tools, but there is work to support these use cases.

    The simplest method I have found so far is to use govendor and then import the complete directory to ensure that all the required files are there. This is a very simple solution that ignores a lot of the complexity around including c dependencies in go projects, but fixes the issue whilst there is no permanent fix for the issue.

    go get github.com/kardianos/govendor
    govendor init
    govendor add +e
    # Remove the directory that is missing the c dependencies
    rm -rf ./vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/
    # Add the file and include all files
    # https://github.com/kardianos/govendor/issues/247
    govendor add github.com/ethereum/go-ethereum/crypto/secp256k1/^
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏