google / guetzli

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

Undefined reference to pthread_rwlock_init #66

Closed rodrigogbranco closed 7 years ago

rodrigogbranco commented 7 years ago

Hey guys,

in my system (Ubuntu Ubuntu 16.04.2 LTS 4.4.0-66-generic), I've gotten "_Undefined reference to pthread_rwlockinit" in my build.

In the file guetzli.make I've had to add -lpthread to LINKCMD variable. I don't if it was necessary in your build (maybe not), but I thought it would be interesting if you could add it in your source files.

Best regards,

Rodrigo Gonçalves de Branco

robryk commented 7 years ago

Did you by any chance try to compile a static binary?

What do the following commands print on your system?

pkg-config --silence-errors --libs gflags || pkg-config --libs libgflags
pkg-config --silence-errors --static --libs gflags || pkg-config --static --libs libgflags

Edit: fixed flags in the requested commands.

rodrigogbranco commented 7 years ago

No, I didn't.

Installing libgflags-dev through apt-get didn't work, so I checked it out https://github.com/gflags/gflags and make installed it.

Here what I got when running those commands:

-L/usr/local/lib -lgflags -L/usr/local/lib -lgflags -lpthread

robryk commented 7 years ago

Could you pull and try again? I expect that the problem is gone by virtue of the gflags dependency being gone.

rodrigogbranco commented 7 years ago

Robert, I'm now in my work desktop (Linux Mint 17.3 Rosa 3.19.0-32-generic). I could correctly clone and make it.

I got some warnings, I don't know if it's important to you, so check the log out:

==== Building guetzli (release) ==== Creating bin/Release Creating obj/Release butteraugli_comparator.cc In file included from ./guetzli/butteraugli_comparator.h:22:0, from guetzli/butteraugli_comparator.cc:17: third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:146:45: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ static void *Allocate(const size_t bytes) BUTTERAUGLI_CACHE_ALIGNED_RETURN; ^ third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:257:42: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ ConstRestrict<T *> Row(const size_t y) BUTTERAUGLI_CACHE_ALIGNED_RETURN { ^ third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:268:7: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ BUTTERAUGLI_CACHE_ALIGNED_RETURN { ^ dct_double.cc debug_print.cc entropy_encode.cc fdct.cc gamma_correct.cc guetzli.cc idct.cc jpeg_data.cc jpeg_data_decoder.cc jpeg_data_encoder.cc jpeg_data_reader.cc jpeg_data_writer.cc jpeg_huffman_decode.cc output_image.cc preprocess_downsample.cc processor.cc In file included from ./guetzli/butteraugli_comparator.h:22:0, from guetzli/processor.cc:24: third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:146:45: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ static void *Allocate(const size_t bytes) BUTTERAUGLI_CACHE_ALIGNED_RETURN; ^ third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:257:42: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ ConstRestrict<T *> Row(const size_t y) BUTTERAUGLI_CACHE_ALIGNED_RETURN { ^ third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:268:7: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ BUTTERAUGLI_CACHE_ALIGNED_RETURN { ^ quality.cc quantize.cc score.cc butteraugli.cc In file included from third_party/butteraugli/butteraugli/butteraugli.cc:32:0: third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:146:45: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ static void *Allocate(const size_t bytes) BUTTERAUGLI_CACHE_ALIGNED_RETURN; ^ third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:257:42: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ ConstRestrict<T *> Row(const size_t y) BUTTERAUGLI_CACHE_ALIGNED_RETURN { ^ third_party/butteraugli/butteraugli/butteraugli.h:129:76: warning: ‘assume_aligned’ attribute directive ignored [-Wattributes]

define BUTTERAUGLI_CACHE_ALIGNED_RETURN attribute((assume_aligned(64)))

                                                                        ^

third_party/butteraugli/butteraugli/butteraugli.h:268:7: note: in expansion of macro ‘BUTTERAUGLI_CACHE_ALIGNED_RETURN’ BUTTERAUGLI_CACHE_ALIGNED_RETURN { ^ Linking guetzli

robryk commented 7 years ago

I'm aware of them and they aren't concerning. Thanks. Please reopen if you find that it doesn't work on your other machine.

rodrigogbranco commented 7 years ago

It has worked, I could test it, thank you.