<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - x11-libs/cairo-1.12.12 fails to compile using clang+lto"
href="https://bugs.freedesktop.org/show_bug.cgi?id=63310">63310</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>chris@chris-wilson.co.uk
</td>
</tr>
<tr>
<th>Summary</th>
<td>x11-libs/cairo-1.12.12 fails to compile using clang+lto
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>cairo-bugs@cairographics.org
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Reporter</th>
<td>abendstund@gmail.com
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>1.12.12
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Product</th>
<td>cairo
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=77662" name="attach_77662" title="cairo-1.12.12-make-ac-float-endianess-test-llvm-bitcode-save.patch">attachment 77662</a> <a href="attachment.cgi?id=77662&action=edit" title="cairo-1.12.12-make-ac-float-endianess-test-llvm-bitcode-save.patch">[details]</a></span>
cairo-1.12.12-make-ac-float-endianess-test-llvm-bitcode-save.patch
I've posted this to bugs.gentoo.org before
<a href="https://bugs.gentoo.org/show_bug.cgi?id=464982">https://bugs.gentoo.org/show_bug.cgi?id=464982</a>
As requested there, I repost the patches here. There are two issues I
encountered when compiling cairo with "clang -O4":
1) bitcode representation of object files makes float endianess test in
configure break (see attached patch)
2) "automatic configuration" of pthreads does not work while explicitly
--enable-pthread=yes to configure does
If "--enable-pthread=yes" configure option is not passed, the default is "auto"
instead of "yes", which basically runs the first block of the following lines
in
cairo-1.12.12/build/configure.ac.pthread (around line 220)
-- >8 --
dnl Check if we can use libc's stubs in libcairo.
dnl Only do this if the user hasn't explicitly enabled
dnl pthreads, but is relying on automatic configuration.
have_pthread="no"
if test "x$enable_pthread" != "xyes"; then
CAIRO_CHECK_PTHREAD(
[pthread], [-D_REENTRANT], [],
[libcairo_pthread_program],
[have_pthread=yes],
[])
fi
dnl Default to using the real pthreads for libcairo.
if test "x$have_pthread" != "xyes"; then
have_pthread="$have_real_pthread";
pthread_CFLAGS="$real_pthread_CFLAGS";
pthread_LIBS="$real_pthread_LIBS";
fi
-- >8 --
This automatic configuration apparently does not work if clang -O4 is used,
even though libcairo_pthread_program seems to succeed.
Or in other words: using libc stubs as a pthread provider currently does not
work if clang -O4 is in use, the automatically configured stubs make the
compile quit with
libtool: link: clang -march=native -pipe -fomit-frame-pointer -O4
-finline-limit=1200 -march=native -pipe -fomit-frame-pointer -O4 -Wl,-O1
-Wl,--hash-style=gnu -Wl,--sort-common -Wl,-z -Wl,norelro -o
.libs/cairo-analyse-trace cairo-analyse-trace.o cairo-error.o -Wl,--as-needed
../util/cairo-script/.libs/libcairo-script-interpreter.so
../util/cairo-missing/.libs/libcairo-missing.a ./.libs/libcairoperf.a
../boilerplate/.libs/libcairoboilerplate.a
/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/src/.libs/libcairo.so
../src/.libs/libcairo.so -lpixman-1 -lfontconfig -lfreetype -lEGL -ldl -lpng15
-lxcb-shm -lxcb-render -lxcb -lXrender -lX11 -lXext -lz -lGL -lOpenVG -lrt -lm
/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/src/.libs/libcairo.so:
error: undefined reference to 'pthread_mutexattr_settype'
/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/src/.libs/libcairo.so:
error: undefined reference to 'pthread_mutexattr_init'
/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/src/.libs/libcairo.so:
error: undefined reference to 'pthread_mutexattr_destroy'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [cairo-analyse-trace] Error 1
make[4]: Leaving directory
`/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/perf'
make[3]: Leaving directory
`/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/perf'
make[2]: Leaving directory
`/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12/perf'
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: Leaving directory
`/var/tmp/paludis/x11-libs-cairo-1.12.12-r1/work/cairo-1.12.12'
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
I'm unsure about a proper fix for this, but thought about
- patch configure.ac.pthread to use real_pthread as an automatic
configuration
i.e. throw out libc stubs, use real_pthread if libcairo_pthread_program
Thanks</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>