我正尝试使用go build
构建链代码。当我运行Go build命令时,它报告
.\hyperledger\fabric\vendor\github.com\miekg\pkcs11\pkcs11.go:29:18:
fatal error:ltdl.h: No such file or directory
compilation terminated
我从这个链接安装了libtools。但我仍然遇到相同的错误。
我正尝试使用go build
构建链代码。当我运行Go build命令时,它报告
.\hyperledger\fabric\vendor\github.com\miekg\pkcs11\pkcs11.go:29:18:
fatal error:ltdl.h: No such file or directory
compilation terminated
我从这个链接安装了libtools。但我仍然遇到相同的错误。
这在我的 Ubuntu 上有效:
sudo apt install libltdl-dev
如果您正在使用CentOS/RHEL 7,您可以使用以下代码:
yum install libtool-ltdl-devel
对于Mac电脑,请确保您已经安装了brew。以下命令适用于我:
brew install libtool
sudo apt安装libtool libltdl-dev
请确保在您的go build或go test命令中添加--tags nopkcs11。这样错误就不会再出现了。
例如:go build --tags nopkcs11
如果您正在开发和测试代码,这将编译您的链码。
gcc
的include目录中存在ltdl.h
。使用gcc -xc -E -v -
列出include目录。 - putu"#include "..." 搜索从这里开始:
#include <...> 搜索从这里开始: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/include C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../include C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/include-fixed C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/include 搜索列表结束。 - surenderltdl.h
文件放入上述目录之一。 - putu