Bug 30910

Summary: cairo-1.10.0 fails to build when ld emits debug logging
Product: cairo Reporter: Jeremy Huddleston Sequoia <jeremyhu>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: doutriaux1, soren.sandmann
Version: 1.10.1   
Hardware: Other   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=579190
Whiteboard:
i915 platform: i915 features:

Description Jeremy Huddleston Sequoia 2010-10-15 13:20:24 UTC
cairo assumes that pthreads are not available, then it fails to build:


./configure  --prefix=/opt/X11 --disable-static --disable-dependency-tracking --disable-nls --cache-file=/tmp/X11libs.roots/X11libs~obj/configure.cache --x-include=$X11_PREFIX/include --x-lib=$X11_PREFIX/lib --disable-quartz --enable-xlib --enable-xlib-xrender --enable-xcb --disable-specs --disable-devel-docs 
...

config.log shows that the conftest.c tests succeeded, but you still chose to 

configure:32573: checking for cairo's pthread featureconfigure:32685: gcc -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include/pixman-1 -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include/libpng14 -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include -o conftest -D_REENTRANT -D__DEBUG__ -D_FORTIFY_SOURCE=2 -pipe
  -L/tmp/X11libs.roots/X11libs~dst/opt/X11/lib conftest.c -lpthread >&5
[Logging for XBS] Used dynamic library: /usr/lib/libSystem.B.dylib
[Logging for XBS] Used dynamic library: /usr/lib/libSystem.B.dylib
[Logging for XBS] Used indirect dynamic library: /usr/lib/system/libmathCommon.A.dylib
configure:32685: $? = 0configure:32804: gcc -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include/pixman-1 -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include/libpng14 -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include -o conftest -pthread -D__DEBUG__ -D_FORTIFY_SOURCE=2 -pipe  -L
/tmp/X11libs.roots/X11libs~dst/opt/X11/lib conftest.c  >&5
[Logging for XBS] Used dynamic library: /usr/lib/libSystem.B.dylib
[Logging for XBS] Used indirect dynamic library: /usr/lib/system/libmathCommon.A.dylib
configure:32804: $? = 0configure:32885: gcc -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include/pixman-1 -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include/libpng14 -I/tmp/X11libs.roots/X11libs~dst/opt/X11/include -o conftest -D_REENTRANT -D__DEBUG__ -D_FORTIFY_SOURCE=2 -pipe
  -L/tmp/X11libs.roots/X11libs~dst/opt/X11/lib conftest.c  >&5
[Logging for XBS] Used dynamic library: /usr/lib/libSystem.B.dylib
[Logging for XBS] Used indirect dynamic library: /usr/lib/system/libmathCommon.A.dylib
configure:32885: $? = 0
configure:32951: checking whether cairo's pthread feature could be enabled
configure:32955: result: no (can't link with -lpthread or -pthread)


Passing --enable-pthread to force it on fails:

checking for cairo's pthread feature... 
configure: error: pthread requested but not found
returned code 1 at ./build line 21.
Comment 1 Jeremy Huddleston Sequoia 2010-10-15 13:29:33 UTC
I believe the problem is this hunk in CAIRO_CC_TRY_LINK_WITH_ENV_SILENT in build/aclocal.cairo.m4 
        if test "x$cairo_cc_stderr" != "x"; then
                cairo_cc_flag=no
        fi
Comment 2 Jeremy Huddleston Sequoia 2010-10-15 13:39:45 UTC
Yep.  A simple bypass of that check gets us building right:
gsed -i 's:test "x$cairo_cc_stderr" != "x":false:' configures

What's the reasoning behind checking stderr?  Perhaps there is a better way to achieve those ends...
Comment 3 Andrea Canciani 2011-01-25 14:01:49 UTC
*** Bug 33417 has been marked as a duplicate of this bug. ***
Comment 4 David Stone 2011-04-20 11:47:35 UTC
I just want to say that this bug makes it impossible to build on osx with 10.4u SDK because ld always gives a warning about an object compiled with -mlong-branch which is no longer needed. Configure really needs to ignore these warnings. Editing configure as mentioned fixes the problem.
Comment 5 Bryce Harrington 2014-07-09 00:28:01 UTC
I attempted to repro the problem on ubuntu 14.04, with these steps:


sudo mkdir /usr/lib/x86_64-linux-gnu/tmp
sudo mv /usr/lib/x86_64-linux-gnu/libpthread* /usr/lib/x86_64-linux-gnu/tmp/

./configure --disable-static --disable-dependency-tracking --disable-nls --disable-quartz --enable-xlib --enable-xlib-xrender --enable-xcb --disable-specs --disable-devel-docs --disable-pthread

Yet this results in a successful config (I didn't try to build it).  If I change to --enable-pthread, it fails to build (obviously), but then:

sudo mv /usr/lib/x86_64-linux-gnu/tmp/* /usr/lib/x86_64-linux-gnu/
sudo rmdir /usr/lib/x86_64-linux-gnu/tmp

./configure --disable-static --disable-dependency-tracking --disable-nls --disable-quartz --enable-xlib --enable-xlib-xrender --enable-xcb --disable-specs --disable-devel-docs --disable-pthread

Is this still an issue on OSX?  If so, anyone want to propose a patch?
Comment 6 Jeremy Huddleston Sequoia 2014-07-15 04:12:40 UTC
Yes, it is still an issue.  We just disable the buggy '"x$cairo_cc_stderr" != "x"' logic, but that's not really a portable solution for you:


diff -Naurp cairo-1.12.2.orig/configure cairo-1.12.2/configure
--- cairo-1.12.2.orig/configure	2012-04-29 11:49:59.000000000 -0700
+++ cairo-1.12.2/configure	2012-05-03 11:23:49.000000000 -0700
@@ -18044,7 +18044,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -18091,7 +18091,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -18161,7 +18161,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -18217,7 +18217,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -19663,7 +19663,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -19710,7 +19710,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -32692,7 +32692,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
 
@@ -32811,7 +32811,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false ; then
 		cairo_cc_flag=no
 	fi
 
@@ -32892,7 +32892,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-	if test "x$cairo_cc_stderr" != "x"; then
+	if false; then
 		cairo_cc_flag=no
 	fi
Comment 7 Matt Turner 2017-02-25 23:51:17 UTC
Occurs when -Wl,--build-id is in LDFLAGS.
Comment 8 GitLab Migration User 2018-08-25 13:39:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/121.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.