Closed Bug 1287325 Opened 4 years ago Closed 4 years ago

XCB detection poisons later stages of configure

Categories

(Firefox Build System :: General, defect)

Unspecified
FreeBSD
defect
Not set

Tracking

(firefox50 fixed)

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: jbeich, Unassigned)

References

Details

(Keywords: regression)

Attachments

(1 file)

After bug 1286649 configure leaks XLIBS into non-X11 checks which later breaks build if XLIBS depends on non-empty XLDFLAGS. For one, -lxcb has to be accompanied by -L/usr/local/lib at least on DragonFly and FreeBSD.

$ ./mach build
[...]
 0:03.97 checking for XDrawLines in -lX11... yes
 0:03.98 checking for XextAddDisplay in -lXext... yes
 0:04.00 checking for XtFree in -lXt... yes
 0:04.02 checking for XGetXCBConnection in -lX11-xcb... yes
 0:04.04 checking for xcb_shm_query_version in -lxcb-shm... yes
 0:04.06 checking for xcb_connect in -lxcb... yes
 0:04.08 checking for X11/extensions/scrnsaver.h... yes
 0:04.09 checking for XScreenSaverQueryInfo in -lXss... yes
 0:04.11 checking for pthread_create in -lpthreads... no
 0:04.11 checking for pthread_create in -lpthread... no
 0:04.13 checking for pthread_create in -lc_r... no
 0:04.13 checking for pthread_create in -lc... no
 0:04.14 checking whether /usr/bin/clang -std=gnu99 needs -traditional... no
 0:04.16 checking for 8-bit clean memcmp... no
 0:04.16 checking for stat64... no
 0:04.17 checking for lstat64... no
 0:04.17 checking for truncate64... no
 0:04.19 checking for statvfs64... no
 0:04.19 checking for statvfs... no
 0:04.20 checking for statfs64... no
 0:04.21 checking for statfs... no
 0:04.22 checking for getpagesize... no
 0:04.23 checking for gmtime_r... no
 0:04.24 checking for localtime_r... no
 0:04.25 checking for arc4random... no
 0:04.26 checking for arc4random_buf... no
 0:04.26 checking for mallinfo... no
 0:04.28 checking for gettid... no
 0:04.28 checking for lchown... no
 0:04.30 checking for setpriority... no
 0:04.30 checking for strerror... no
 0:04.31 checking for syscall... no
 0:04.33 checking for clock_gettime(CLOCK_MONOTONIC)... no
[...]
 0:07.18 ==============================
 0:07.18 ERROR PROCESSING MOZBUILD FILE
 0:07.18 ==============================
 0:07.18
 0:07.18 The error occurred while processing the following file:
 0:07.18
 0:07.18     /mozilla-inbound/mozglue/misc/moz.build
 0:07.18
 0:07.18 A moz.build file called the error() function.
 0:07.18
 0:07.18 The error it encountered is:
 0:07.18
 0:07.18     No TimeStamp implementation on this platform.  Build will not succeed
 0:07.18

$ cat /objdir/config.log
[...]
configure:11536: checking for clock_gettime(CLOCK_MONOTONIC)
configure:11552: /usr/bin/clang -std=gnu99 -o conftest  -fno-strict-aliasing -ffunction-sections -fdata-sections -fno-math-errno -Qunused-arguments   -I/usr/local/include  -Wl,-z,noexecstack -Wl,-z,text conftest.c -lxcb -lxcb-shm -lX11-xcb   1>&5
/usr/bin/ld: cannot find -lxcb
Acording to autoconf docs polluting LIBS is the default behavior. So, let's take advantage of it instead of tweaking XLIBS.

 -- Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
          ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
[...]
     ACTION-IF-FOUND is a list of shell commands to run if the link with
     the library succeeds; ACTION-IF-NOT-FOUND is a list of shell
     commands to run if the link fails.  If ACTION-IF-FOUND is not
     specified, the default action will add '-lLIBRARY' to 'LIBS' and
     define 'HAVE_LIBLIBRARY' (in all capitals).
Comment on attachment 8771776 [details]
Bug 1287325 - Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649.

Oops, incomplete. Adding one more AC_SUBST_LIST is probably not a good idea.

$ ./mach build
 9:42.23 libxul.so
 9:47.08 ../../widget/nsShmImage.o: In function `nsShmImage::nsShmImage(_XDisplay*, unsigned long, Visual*, unsigned int)':
 9:47.08 /mozilla-inbound/widget/nsShmImage.cpp:(.text._ZN10nsShmImageC2EP9_XDisplaymP6Visualj+0x3c): warning: undefined reference to `XGetXCBConnection'
 9:47.08 ../../widget/nsShmImage.o: In function `nsShmImage::DestroyImage()':
 9:47.08 /mozilla-inbound/widget/nsShmImage.cpp:(.text._ZN10nsShmImage12DestroyImageEv+0x10): warning: undefined reference to `xcb_free_gc'
 9:47.08 /mozilla-inbound/widget/nsShmImage.cpp:(.text._ZN10nsShmImage12DestroyImageEv+0x27): warning: undefined reference to `xcb_free_pixmap'
 9:47.08 /mozilla-inbound/widget/nsShmImage.cpp:(.text._ZN10nsShmImage12DestroyImageEv+0x3e): warning: undefined reference to `xcb_shm_detach_checked'
[...]
Attachment #8771776 - Attachment is obsolete: true
Attachment #8771776 - Flags: review?(mh+mozilla)
Comment on attachment 8771776 [details]
Bug 1287325 - Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/64784/diff/1-2/
Attachment #8771776 - Attachment description: Bug 1287325 - Restore old LIBS before AC_CHECK_LIB after bug 1286649. → Bug 1287325 - Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649.
Attachment #8771776 - Attachment is obsolete: false
Attachment #8771776 - Flags: review?(mh+mozilla)
Fwiw, also hitting that bug on OpenBSD.
Comment on attachment 8771776 [details]
Bug 1287325 - Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649.

https://reviewboard.mozilla.org/r/64784/#review62122

This breaks Linux builds, but this is going in the right  direction. The XCB libraries now need to be added to OS_LIBS when linking libxul instead of the build system relying on them being in OS_LIBS already.
Attachment #8771776 - Flags: review?(mh+mozilla) → review-
https://reviewboard.mozilla.org/r/64784/#review62122

Doh, I forgot to retrigger Try build after v2.
Comment on attachment 8771776 [details]
Bug 1287325 - Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649.

Can you review again? Try build is green.
Attachment #8771776 - Flags: review?(mh+mozilla)
Comment on attachment 8771776 [details]
Bug 1287325 - Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649.

https://reviewboard.mozilla.org/r/64784/#review62368
Attachment #8771776 - Flags: review- → review+
Attachment #8771776 - Flags: review?(mh+mozilla)
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5fa1e6c05e0c
Prevent AC_CHECK_LIB from polluting LIBS after bug 1286649. r=glandium
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/5fa1e6c05e0c
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.