Linuxbrew / legacy-linuxbrew

:skull: This repository is defunct, because it has been split into https://github.com/Linuxbrew/brew and https://github.com/Linuxbrew/homebrew-core
http://linuxbrew.sh
Other
2.23k stars 297 forks source link

PIGZ Build Failure #738

Closed LeeBergstrand closed 8 years ago

LeeBergstrand commented 8 years ago
$ brew install pigz
==> Downloading http://www.zlib.net/pigz/pigz-2.3.3.tar.gz
######################################################################## 100.0%
==> make CC=/usr/bin/gcc-4.8 CFLAGS=-Os -w -pipe -march=core2
Last 15 lines from /home/leebergstrand/.cache/Homebrew/Logs/pigz/01.make:
2016-01-23 05:20:40 +0000

make
CC=/usr/bin/gcc-4.8
CFLAGS=-Os -w -pipe -march=core2

/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o pigz.o pigz.c
pigz.c:365:73: fatal error: zlib.h: No such file or directory
 #include "zlib.h"       /* deflateInit2(), deflateReset(), deflate(), */
                                                                         ^
compilation terminated.
make: *** [pigz.o] Error 1

BREW LOG:

https://gist.github.com/anonymous/ab688fb35a393524ebc2

tseemann commented 8 years ago

@LeeBergstrand can you brew install zlib and try again? It may be missing a dependency on Linux.

LeeBergstrand commented 8 years ago

After brew install zlib new errors occur:

brew install pigz
==> Downloading http://www.zlib.net/pigz/pigz-2.3.3.tar.gz
Already downloaded: /home/leebergstrand/.cache/Homebrew/pigz-2.3.3.tar.gz
==> make CC=/usr/bin/gcc-4.8 CFLAGS=-Os -w -pipe -march=core2
Last 15 lines from /home/leebergstrand/.cache/Homebrew/Logs/pigz/01.make:
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o yarn.o yarn.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o try.o try.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/deflate.o z
opfli/src/zopfli/deflate.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/blocksplitt
er.o zopfli/src/zopfli/blocksplitter.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/tree.o zopf
li/src/zopfli/tree.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/lz77.o zopf
li/src/zopfli/lz77.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/cache.o zop
fli/src/zopfli/cache.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/hash.o zopf
li/src/zopfli/hash.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/util.o zopf
li/src/zopfli/util.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/squeeze.o z
opfli/src/zopfli/squeeze.c
/usr/bin/gcc-4.8 -Os -w -pipe -march=core2 -isystem/home/leebergstrand/.linuxbrew/include  -c -o zopfli/src/zopfli/katajainen.
o zopfli/src/zopfli/katajainen.c
/usr/bin/gcc-4.8 -lz -o pigz pigz.o yarn.o try.o zopfli/src/zopfli/deflate.o zopfli/src/zopfli/blocksplitter.o zopfli/src/zopf
li/tree.o zopfli/src/zopfli/lz77.o zopfli/src/zopfli/cache.o zopfli/src/zopfli/hash.o zopfli/src/zopfli/util.o zopfli/src/zopf
li/squeeze.o zopfli/src/zopfli/katajainen.o -lpthread -lm
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
make: *** [pigz] Error 1

BREW LOG:

https://gist.github.com/anonymous/12acf2228ae2c15a2b4c

LeeBergstrand commented 8 years ago

After sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev new errors occur:

brew install pigz                                                                                       
==> Downloading http://www.zlib.net/pigz/pigz-2.3.3.tar.gz
Already downloaded: /home/leebergstrand/.cache/Homebrew/pigz-2.3.3.tar.gz
==> make CC=/usr/bin/gcc-4.8 CFLAGS=-Os -w -pipe -march=core2
Last 15 lines from /home/leebergstrand/.cache/Homebrew/Logs/pigz/01.make:
pigz.c:(.text+0x6fa1): undefined reference to `adler32'
pigz.c:(.text+0x6fa8): undefined reference to `crc32'
pigz.c:(.text+0x6fdc): undefined reference to `deflate'
pigz.c:(.text+0x703d): undefined reference to `deflatePending'
pigz.c:(.text+0x706d): undefined reference to `deflate'
pigz.c:(.text+0x70e1): undefined reference to `deflatePrime'
pigz.c:(.text+0x711b): undefined reference to `deflatePending'
pigz.c:(.text+0x7147): undefined reference to `deflate'
pigz.c:(.text+0x71bf): undefined reference to `deflate'
pigz.c:(.text+0x7431): undefined reference to `adler32'
pigz.c:(.text+0x7438): undefined reference to `crc32'
pigz.c:(.text+0x7470): undefined reference to `adler32'
pigz.c:(.text+0x7477): undefined reference to `crc32'
collect2: error: ld returned 1 exit status
make: *** [pigz] Error 1

BREW LOGS:

https://gist.github.com/a010b6178d949f3d0375

LeeBergstrand commented 8 years ago

@tseemann Looks like its having trouble finding zlib even after brew and apt-get installing lib.

sjackman commented 8 years ago

I wasn't able to reproduce this issue on my box that uses Linuxbrew's gcc, but I was able to reproduce the issue on Travis CI. https://travis-ci.org/Linuxbrew/linuxbrew/builds/104567948

This link line is broken:

https://travis-ci.org/Linuxbrew/linuxbrew/builds/104567948#L352

/usr/bin/gcc-4.6 -lz -o pigz pigz.o yarn.o try.o zopfli/src/zopfli/deflate.o zopfli/src/zopfli/blocksplitter.o zopfli/src/zopfli/tree.o zopfli/src/zopfli/lz77.o zopfli/src/zopfli/cache.o zopfli/src/zopfli/hash.o zopfli/src/zopfli/util.o zopfli/src/zopfli/squeeze.o zopfli/src/zopfli/katajainen.o -lpthread -lm

-lz should come at the end of the line, and the -L option is missing, which means that the Makefile is ignoring LDFLAGS. Please report these issues to the upstream author. If you patch the Makefile and submit a PR to the upstream author, we can include that patch in Linuxbrew until the next release of pigz that includes the patch.

sjackman commented 8 years ago

In the mean time I've added zlib as a dependency of pigz in #747.

sjackman commented 8 years ago

I forgot to mention a workaround is to install Homebrew's gcc (assuming that you're currently using the system-provided compiler): brew install gcc pigz