Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 486878 - www-client/chromium-30.0.1599.66 build error - undefined reference to `WebPDemuxDelete'/etc
Summary: www-client/chromium-30.0.1599.66 build error - undefined reference to `WebPDe...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chromium Project
URL:
Whiteboard: ht-wanted
Keywords:
Depends on:
Blocks: 486742
  Show dependency tree
 
Reported: 2013-10-03 13:08 UTC by Richard Freeman
Modified: 2013-10-09 21:49 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log.bz2,455.99 KB, application/x-bzip)
2013-10-03 13:09 UTC, Richard Freeman
Details
emerge --info (einfo.txt,7.68 KB, text/plain)
2013-10-03 13:10 UTC, Richard Freeman
Details
emerge -pqv output (epqv.txt,442 bytes, text/plain)
2013-10-03 13:10 UTC, Richard Freeman
Details
environment (env,182.42 KB, text/plain)
2013-10-03 13:10 UTC, Richard Freeman
Details
libwebp build log (b2.log,160.62 KB, text/x-log)
2013-10-04 02:30 UTC, Richard Freeman
Details
floppym's libwebp build log (media-libs:libwebp-0.3.1:20131003-235832.log,239.37 KB, text/plain)
2013-10-04 02:40 UTC, Mike Gilbert
Details
config log (config.log,57.15 KB, text/x-log)
2013-10-04 11:31 UTC, Richard Freeman
Details
phajdanjr-libwebp-build-log.gz (media-libs:libwebp-0.3.1:20131009-212933.log.gz,15.86 KB, application/x-gzip)
2013-10-09 21:48 UTC, Paweł Hajdan, Jr. (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Freeman gentoo-dev 2013-10-03 13:08:08 UTC
Seems related to bug 466180?
Comment 1 Richard Freeman gentoo-dev 2013-10-03 13:09:52 UTC
Created attachment 360054 [details]
build log
Comment 2 Richard Freeman gentoo-dev 2013-10-03 13:10:12 UTC
Created attachment 360056 [details]
emerge --info
Comment 3 Richard Freeman gentoo-dev 2013-10-03 13:10:30 UTC
Created attachment 360058 [details]
emerge -pqv output
Comment 4 Richard Freeman gentoo-dev 2013-10-03 13:10:45 UTC
Created attachment 360060 [details]
environment
Comment 5 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-10-03 15:48:03 UTC
I see -lwebp but not -lwebpdemux in the command-line.

What version of libwebp are you using?

When you unpack chromium sources and run 'python tools/compile_test/compile_test.py --code "int main() { return 0; }" --run-linker --on-success "-lwebp -lwebpdemux" --on-failure "-lwebp" -- -lwebpdemux', what does it print?

As a more basic test, please try compiling the simple program from above manually and link webp and webpdemux and post what happens.
Comment 6 Richard Freeman gentoo-dev 2013-10-03 16:44:55 UTC
(In reply to Paweł Hajdan, Jr. from comment #5)
> I see -lwebp but not -lwebpdemux in the command-line.
> 
> What version of libwebp are you using?

0.3.1

> 
> When you unpack chromium sources and run 'python
> tools/compile_test/compile_test.py --code "int main() { return 0; }"
> --run-linker --on-success "-lwebp -lwebpdemux" --on-failure "-lwebp" --
> -lwebpdemux', what does it print?

-lwebp

> 
> As a more basic test, please try compiling the simple program from above
> manually and link webp and webpdemux and post what happens.

cat > test.c
int main() { return 0; }

gcc -lwebp -lwebpdemux -o test test.c
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libwebp.so: undefined reference to `pthread_join'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libwebp.so: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
Comment 7 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-10-03 19:50:01 UTC
(In reply to Richard Freeman from comment #6)
> gcc -lwebp -lwebpdemux -o test test.c
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libwebp.so:
> undefined reference to `pthread_join'
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libwebp.so:
> undefined reference to `pthread_create'
> collect2: error: ld returned 1 exit status

Does revdep-rebuild rebuild anything? What if you just re-emerge libwebp?
Comment 8 Mike Gilbert gentoo-dev 2013-10-03 19:59:59 UTC
It seems like your libwebpdemux might be missing a NEEDED entry for libpthread.
Comment 9 Richard Freeman gentoo-dev 2013-10-03 20:22:22 UTC
(In reply to Paweł Hajdan, Jr. from comment #7)
> (In reply to Richard Freeman from comment #6)
> > gcc -lwebp -lwebpdemux -o test test.c
> > /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libwebp.so:
> > undefined reference to `pthread_join'
> > /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/libwebp.so:
> > undefined reference to `pthread_create'
> > collect2: error: ld returned 1 exit status
> 
> Does revdep-rebuild rebuild anything? What if you just re-emerge libwebp?

No, and no difference, at least not to the output of the command above (I didn't try rebuilding all of chromium yet, but I will kick that off now before I head out for the evening).
Comment 10 Mike Gilbert gentoo-dev 2013-10-03 20:44:54 UTC
Could you attach a libwebp build log?
Comment 11 Richard Freeman gentoo-dev 2013-10-04 02:30:51 UTC
Created attachment 360092 [details]
libwebp build log
Comment 12 Mike Gilbert gentoo-dev 2013-10-04 02:40:06 UTC
Created attachment 360094 [details]
floppym's libwebp build log

Interesting, configure seems to be misdetecting the -pthread switch. From your log:

configure: checking for threading support...
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... no
configure: checking if threading is enabled... yes

From my log:

configure: checking for threading support...
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... no
configure: checking if threading is enabled... yes
Comment 13 Mike Gilbert gentoo-dev 2013-10-04 03:02:49 UTC
Maybe check config.log to see exactly how configure is compiling the test program for that.
Comment 14 Richard Freeman gentoo-dev 2013-10-04 11:31:21 UTC
Created attachment 360102 [details]
config log

From my config.log:
checking whether pthreads work without any flags
x86_64-pc-linux-gnu-gcc -o conftest -march=amdfam10 -Os -pipe -frename-registers -fweb -freorder-blocks -freor
der-blocks-and-partition -flto=5 -funit-at-a-time -ftree-pre -fgcse-sm -fgcse-las -fgcse-after-reload -fmerge-all-constants -ftree-vectorize -ftree-parallelize-loops=4 -mabm -msse4a -fstack-protector   -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -Wl,--sort-common -march=amdfam10 -Os -pipe -frename-registers -fweb -freorder-blocks -freorder-blocks-and-partition -flto=5 -funit-at-a-time -ftree-pre -fgcse-sm -fgcse-las -fgcse-after-reload -fmerge-all-constants -ftree-vectorize -ftree-parallelize-loops=4 -mabm -msse4a -fstack-protector conftest.c
$? = 0
Comment 15 Richard Freeman gentoo-dev 2013-10-04 13:00:02 UTC
I did some testing and dropping -ftree-parallelize-loops=4 results in:
/tmp/ccMFkAMY.ltrans0.ltrans.o: In function `main':
ccMFkAMY.ltrans0.o:(.text.startup+0x14): undefined reference to `pthread_create'
ccMFkAMY.ltrans0.o:(.text.startup+0x1f): undefined reference to `pthread_join'
ccMFkAMY.ltrans0.o:(.text.startup+0x48): undefined reference to `__pthread_register_cancel'
ccMFkAMY.ltrans0.o:(.text.startup+0x52): undefined reference to `__pthread_unregister_cancel'
collect2: error: ld returned 1 exit status

Including that parameter results in a successful compilation of conftest.c.

So, it seems that this option is what is causing issues.
Comment 16 Richard Freeman gentoo-dev 2013-10-04 13:22:43 UTC
Something else which is odd - my CFLAGS are being added to the command line twice.

If I try to override them using /etc/portage/env then I get both my default CFLAGs and my override CFLAGs in the command line.  

Something is appending default flags to the command line, alongside whatever logic is taking into account /etc/portage/env.  As a result I couldn't test different CFLAGS by just overriding the environment variable - I had to create my own conftest.c and manually run the command lines outside of portage.
Comment 17 Richard Freeman gentoo-dev 2013-10-04 14:04:04 UTC
(In reply to Richard Freeman from comment #16)
> Something else which is odd - my CFLAGS are being added to the command line
> twice.
> 
> If I try to override them using /etc/portage/env then I get both my default
> CFLAGs and my override CFLAGs in the command line.  
> 
> Something is appending default flags to the command line, alongside whatever
> logic is taking into account /etc/portage/env.  As a result I couldn't test
> different CFLAGS by just overriding the environment variable - I had to
> create my own conftest.c and manually run the command lines outside of
> portage.


Disregard just this post - I figured out the cause of that and it is unrelated.

So, libwebp is definitely fixable by using more tame CFLAGS.  Even so, that issue might still be useful to somebody.
Comment 18 Mike Gilbert gentoo-dev 2013-10-04 15:20:14 UTC
Looking through the gcc manual:

       -ftree-parallelize-loops=n
           Parallelize loops, i.e., split their iteration space to run in n
           threads.  This is only possible for loops whose iterations are
           independent and can be arbitrarily reordered.  The optimization is
           only profitable on multiprocessor machines, for loops that are CPU-
           intensive, rather than constrained e.g. by memory bandwidth.  This
           option implies -pthread, and thus is only supported on targets that
           have support for -pthread.

So, -ftree-parallelize-loops implies -pthread, which causes the configure behavior we see.

This is the libtool command that is run to link libwebpdemux:

/bin/sh ../../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -Wall -Wdeclaration-after-statement -Wextra -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition -Wshadow -Wunused-but-set-variable -Wunused -Wvla -march=amdfam10 -Os -pipe -frename-registers -fweb -freorder-blocks -freorder-blocks-and-partition -flto=5 -funit-at-a-time -ftree-pre -fgcse-sm -fgcse-las -fgcse-after-reload -fmerge-all-constants -ftree-vectorize -ftree-parallelize-loops=4 -mabm -msse4a -fstack-protector  -no-undefined -version-info 0:1:0 -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -Wl,--sort-common -march=amdfam10 -Os -pipe -frename-registers -fweb -freorder-blocks -freorder-blocks-and-partition -flto=5 -funit-at-a-time -ftree-pre -fgcse-sm -fgcse-las -fgcse-after-reload -fmerge-all-constants -ftree-vectorize -ftree-parallelize-loops=4 -mabm -msse4a -fstack-protector -o libwebpdemux.la -rpath /usr/lib64 demux.lo ../libwebp.la 
libtool: link: x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/demux.o   -Wl,-rpath -Wl,/var/tmp/portage/media-libs/libwebp-0.3.1/work/libwebp-0.3.1-amd64/src/.libs ../.libs/libwebp.so  -march=amdfam10 -Os -flto=5 -mabm -msse4a -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -Wl,--sort-common -march=amdfam10 -Os -flto=5 -mabm -msse4a   -Wl,-soname -Wl,libwebpdemux.so.0 -o .libs/libwebpdemux.so.0.0.1

I wonder if libtool is stripping the -ftree-parallelize-loops=4 option from the linker command?
Comment 19 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-10-04 15:44:25 UTC
(In reply to Mike Gilbert from comment #18)
> I wonder if libtool is stripping the -ftree-parallelize-loops=4 option from
> the linker command?

First we are pretty aggressively stripping CFLAGS in chromium.

Then actually the compile_test.py above doesn't respect CFLAGS. I think that would address the problem here.

Let's keep this bug open while I figure out the fix - thank you very much for identifying which CFLAG is causing the problem.

I might also end up stripping flags in libwebp.
Comment 20 Mike Gilbert gentoo-dev 2013-10-04 15:47:58 UTC
(In reply to Paweł Hajdan, Jr. from comment #19)
> (In reply to Mike Gilbert from comment #18)
> > I wonder if libtool is stripping the -ftree-parallelize-loops=4 option from
> > the linker command?
> 
> First we are pretty aggressively stripping CFLAGS in chromium.
> 
> Then actually the compile_test.py above doesn't respect CFLAGS. I think that
> would address the problem here.
> 

I am fairly sure that the problem should be resolved in the libwebp package. It should be adding a DT_NEEDED libpthread.so.1 entry to libwebpdemux.so, but something is preventing that.

I think the CFLAGS used to compile chromium are irrelevant.
Comment 21 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-10-09 21:48:05 UTC
Created attachment 360534 [details]
phajdanjr-libwebp-build-log.gz
Comment 22 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-10-09 21:49:59 UTC
I can't repro here. I've tried adding "-ftree-parallelize-loops=4 -fopenmp" to CFLAGS, rebuilding libwebp and rebuilding chromium. It works. My libwebpdemux.so and libwebp.so have libpthread.so in DT_NEEDED.