Error building peer: "bzip2 data invalid" in goshim.tar.bz2

2.9k views Asked by At

Some users experience a failure building the peer as follows:

$ make peer
Building docker ccenv-image
docker build  -t hyperledger/fabric-ccenv build/image/ccenv
Sending build context to Docker daemon 20.19 MB
Step 1 : FROM hyperledger/fabric-baseimage:x86_64-0.2.2
 ---> 4ac07a26ca7a
Step 2 : COPY payload/chaintool payload/protoc-gen-go /usr/local/bin/
 ---> Using cache
 ---> 027688f7aea9
Step 3 : ADD payload/goshim.tar.bz2 $GOPATH/src/
Error processing tar file(bzip2 data invalid: bad magic value in continuation file): 
make: *** [build/image/ccenv/.dummy-x86_64-0.7.0] Error 1
5

There are 5 answers

4
Gregory Haskins On

This is a known issue on OSX due to incompatibilities between bsdtar (that ships with OSX) and gnutar (what docker is expecting).

It can be fixed simply by ensuring that gnutar is available on the path as "tar". In OSX, this can be accomplished with

brew install gnu-tar --with-default-names

0
Max Peng On

OS: Mac Catalina(10.15.2)

Homebrew: 2.2.3

go: 1.13.6

I got the same issue and solved by:

brew install gnu-tar
brew install libtool

Then:

export PATH=$PATH:/usr/local/Cellar/gnu-tar/1.32/libexec/gnubin

Remember to replace the version(1.32) to your installed version in the path.

cd $GOPATH/src/github.com/hyperledger/fabric
make clean
make peer
0
Nick G On

I managed to solve this problem on OSX with a combination of the above responses. Start from scratch and clone the fabric repo. Next, install the homebrew package

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Take care of the gnutar issue brew install gnu-tar --with-default-names

And finally brew install libtool

Then proceed with your make commands

1
Gerard Duch On

I've solved this problem doing these commands:

cd $GOPATH/src/github.com/hyperledger/fabric
brew install gnu-tar --with-default-names
brew install libtool
make clean
make peer

(OS: macOS Sierra version 10.12.5)

0
zzinny On

To add a little more explanation to the answer from @Gregory Haskins,

--with-default-names option is unavailable now.

Instead, add gnu-tar location to PATH so that gnu-tar is found and runs before bsdtar(of macOS).

This can be accomplished with

export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"