Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exec: "gcc": executable file not found in %PATH% when trying go build

I am using Windows 10. When I tried to build Chaincode it reported this error

# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11 
exec: "gcc": executable file not found in %PATH%

My chaincode imports:

import (
    "fmt"
    "strconv"

    "github.com/hyperledger/fabric/core/chaincode/shim"
    pb "github.com/hyperledger/fabric/protos/peer"
)

It's running fine in Docker.

like image 709
jaswanth Avatar asked Apr 24 '17 05:04

jaswanth


2 Answers

gcc (the GNU Compiler Collection) provides a C compiler. On Windows, install TDM-GCC. The github.com/miekg/pkcs11 package uses cgo. Cgo enables the creation of Go packages that call C code.

like image 79
peterSO Avatar answered Nov 10 '22 15:11

peterSO


If you are running Ubuntu do:

apt-get install build-essential

This solved the problem. It installs the gcc/g++ compilers and libraries.

like image 129
mahima Avatar answered Nov 10 '22 15:11

mahima