6

I am trying to build a chaincode by using go build. when i run Go build command its reporting

.\hyperledger\fabric\vendor\github.com\miekg\pkcs11\pkcs11.g‌​o:29:18: 
fatal error:ltdl.h: No such file or directory
compilation terminated

I installed libtools from this link. But I am getting the same error

surender
  • 71
  • 1
  • 1
  • 3
  • Make sure `ltdl.h` exist in `gcc`s include directory. Use `gcc -xc -E -v -` to list up the include directory. – putu Apr 26 '17 at 07:51
  • i got this .. "#include "..." search starts here: #include <...> search starts here: 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 End of search list.` – surender Apr 26 '17 at 09:19
  • You have to download developer version of the libtools and put `ltdl.h` into one of the above directory. – putu Apr 26 '17 at 09:52
  • can you share the link where to download developer version of libtools – surender Apr 26 '17 at 10:46
  • Its at the link you've mentioned in the question. Its called develover files. – putu Apr 26 '17 at 11:11

5 Answers5

16

It worked for me on ubuntu: sudo apt install libltdl-dev

Denis Glotov
  • 173
  • 1
  • 7
9

if you are using centos/RHEL 7 you can use this code

yum install libtool-ltdl-devel
Marshall Fate
  • 145
  • 1
  • 5
6

For Mac, make sure you have brew installed. This command worked for me:

brew install libtool
mahima
  • 1,875
  • 1
  • 11
  • 15
  • Leaving a breadcrumb in case someone else runs into a `libltdl is required`, i.e for installing XmlSec on OSX. This resolved my issue. – Jared Knipp Feb 05 '19 at 22:44
5

On Debian/Ubuntu environment, try using the following command:

sudo apt install libtool libltdl-dev

2

make sure to add --tags nopkcs11 to ur go build or go test command. The error should stop appearing

Example : go build --tags nopkcs11

This will compile your chaincode if you are in development and testing your code.