5

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
Gregory Haskins
  • 311
  • 2
  • 6

5 Answers5

16

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

Gregory Haskins
  • 311
  • 2
  • 6
  • 2
    It is worth noting that if you've gotten the error, then you need to nuke the fabric directory, and pull it again from the repo. Just running 'make peer' again won't work (the messed up bz2 file is still there). – J Steven Perry Jan 31 '17 at 21:53
  • Also note that this error may still occur if you have an older version of gnu-tar already installed, you will need to run 'brew unlink gnu-tar' and then the above install command. Ive tested this sequence of cmds after experiencing the issue with 1.28 of gnu-tar installed, unlink + install resolved the issue. – Matt Rkiouak Feb 14 '17 at 19:44
  • J Steven Perry indeed...this was very worth noting. Should be referenced somewhere in the docs I would go so far as to say. – Richard John Catalano Oct 26 '17 at 17:24
  • 1
    hint to who is comming here at '21: The option `--with-default-names` is *NOT* available anymore. However, it worked also without that option. – Ric Hard Feb 04 '21 at 19:55
8

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"

zzinny
  • 163
  • 2
  • 7
1

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

Nick G
  • 44
  • 2
1

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)

1

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
Community
  • 1
  • 1
Max Peng
  • 2,879
  • 1
  • 26
  • 43