The Code Buccaneer
The Code Buccaneer

Reputation: 777

Fabric-sdk-go 'ld.exe: cannot find -lltdl' error

When I try to get the fabric-sdk-go I get the following error:

$ go get github.com/hyperledger/fabric-sdk-go/pkg/fabric-client
# github.com/hyperledger/fabric-sdk-go/vendor/github.com/miekg/pkcs11
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lltdl
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lltdl
collect2.exe: error: ld returned 1 exit status

Does anyone have an idea what is the issue and how to resolve this?

Upvotes: 1

Views: 430

Answers (1)

putu
putu

Reputation: 6444

The error message told us that the library libltdl which is required by github.com/miekg/pkcs11 is missing. Although you didn't mention it explicitly, I think you're using MSYS2 as the development environment. Do the following steps to install the missing library.

  1. Search for the missing library, type pacman -Ss ltdl in MSYS2 terminal to get the exact package name. Here, ltdl is the keyword related to missing library which we got from error message. You should get something like:

    msys/libltdl 2.4.6-2  
        A system independent dlopen wrapper for GNU libtool
    

    From the result we know that the missing library is provided in libltdl package. It seems trivial, but sometimes a library may be provided by more than one package, e.g. a package which has prefix mingw-w64-i686-* for 32-bit system and the other with prefix mingw-w64-x86_64-* for 64-bit system.

  2. Install the package by: pacman -S libltdl.
  3. Reinstall the go package by: go get -v github.com/hyperledger/fabric-sdk-go/pkg/fabric-client.

Upvotes: 1

Related Questions