google / guetzli

Perceptual JPEG encoder
Apache License 2.0
12.9k stars 976 forks source link

Fails to link with libgflags_nothreads.so: undefined reference to `pthread_rwlock_unlock' #14

Closed shrx closed 7 years ago

shrx commented 7 years ago

Building with gcc 6, make fails with:

Linking guetzli
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgflags_nothreads.so: undefined reference to `pthread_rwlock_unlock'
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgflags_nothreads.so: undefined reference to `pthread_rwlock_init'
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgflags_nothreads.so: undefined reference to `pthread_rwlock_destroy'
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libgflags_nothreads.so: undefined reference to `pthread_rwlock_wrlock'
collect2: error: ld returned 1 exit status
guetzli.make:103: recipe for target 'bin/Release/guetzli' failed
make[1]: *** [bin/Release/guetzli] Error 1
Makefile:28: recipe for target 'guetzli' failed
make: *** [guetzli] Error 2
robryk commented 7 years ago

This seems bizarre (the nothreads version of gflags using pthreads). Adding -lpthread is a fine workaround. Can you specify what version of gflags you have and where is it from (e.g. what package in what distro?), so that I can bug gflags people about this?

WyohKnott commented 7 years ago

I have the same bug with gflags version 2.1.2 on Fedora 25 x86_64.

steffenweber commented 7 years ago

I had the same issue on Gentoo Linux and fixed it by upgrading from gflags 2.1.2 to gflags 2.2.0.

shrx commented 7 years ago

@robryk I have libgflags-dev 2.1.2-3 (the latest available) installed on Xubuntu 16.10.