Closed Bug 1303212 Opened 3 years ago Closed 3 years ago

OS X Startup crash Hit MOZ_CRASH(CLOCK_MONOTONIC is absent!) at gecko-dev/mozglue/misc/TimeStamp_posix.cpp:181 after Xcode 8 Update

Categories

(Firefox Build System :: General, defect, P1, critical)

51 Branch
x86
macOS
defect

Tracking

(firefox51 fix-optional, firefox52 fixed)

RESOLVED FIXED
mozilla52
Tracking Status
firefox51 --- fix-optional
firefox52 --- fixed

People

(Reporter: mchang, Assigned: mchang)

References

Details

(Keywords: crash)

Attachments

(3 files)

Xcode decided to update itself today

clang --version
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

After building Firefox today, I'm getting a start up crash. This only seems to happen with Xcode 8 and El Capitan. The Xcode 8 update and the macOS Sierra GM I'm running on another machine don't have this problem.
Attached patch Temp FixSplinter Review
It looks like CONFIG['HAVE_CLOCK_MONOTONIC'] is true now for some reason, still trying to find out where this is defined, but this is a temporary fix.
Component: Widget: Cocoa → Build Config
Not sure you're the right person, but it looks like in Xcode 8, clock_gettime was added to the SDK. The current configure just tries to link it, but not run it. However, at runtime, clock_gettime fails with "No file or directory found". Doing a test clock_gettime outside of gecko, I get a correct link and compile but a runtime error of:

"dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /Users/masonchang/Projects/temp/./a.out (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib
"

On macOS sierra, everything works as expected and clock_gettime is implemented, but not on El Capitan. I suspect before Xcode 8, clock_gettime didn't even link.

This patch changes the check in our configure script to do a runtime check.

Just an FYI, I'm going on PTO for two weeks, so if this is properly reviewed, someone else can please try to land this. Thanks!
Attachment #8792081 - Flags: review?(mh+mozilla)
Assignee: nobody → mchang
Status: NEW → ASSIGNED
Severity: normal → critical
Keywords: crash
Priority: -- → P1
Comment on attachment 8792081 [details] [diff] [review]
Do a runtime check for clock_Gettime

Review of attachment 8792081 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/old-configure.in
@@ +1223,4 @@
>                 [for libs in "" -lrt; do
>                      _SAVE_LIBS="$LIBS"
>                      LIBS="$LIBS $libs"
> +                    AC_TRY_RUN([

AC_TRY_RUN needs to be avoided at all costs. It breaks cross-compilations (think Android).
Considering we're targeting versions of OSX that don't have the function, at least for now, we can simplify the problem and just not check for clock_gettime on that platform (assuming the test does return no currently)
Attachment #8792081 - Flags: review?(mh+mozilla) → review-
(In reply to Mike Hommey [:glandium] from comment #3)
> AC_TRY_RUN needs to be avoided at all costs. It breaks cross-compilations
> (think Android).
> Considering we're targeting versions of OSX that don't have the function, at
> least for now, we can simplify the problem and just not check for
> clock_gettime on that platform (assuming the test does return no currently)

Or we can branch out the AC_TRY_RUN using $OS_TARGET = Darwin and therewith save cross-compilation, or dumb idea?
(In reply to Mike Hommey [:glandium] from comment #3)
> AC_TRY_RUN needs to be avoided at all costs. It breaks cross-compilations
> (think Android).

I happened to do an all-platform push with this patch in the queue, and I can confirm that it breaks compilation for Android. :)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1c6e526473c2
Attachment #8793835 - Flags: review?(mh+mozilla)
The patch above is building just fine on 10.12 for me, and here's a try run to make sure it doesn't mess things up on our builders https://treeherder.mozilla.org/#/jobs?repo=try&revision=02c5273d0ae3
Attachment #8793835 - Flags: review?(mh+mozilla) → review+
Pushed by hurley@todesschaf.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e568feccbb14
Don't check for CLOCK_MONOTONIC on darwin r=glandium
Duplicate of this bug: 1304305
Duplicate of this bug: 1305738
https://hg.mozilla.org/mozilla-central/rev/e568feccbb14
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Thanks so much, Mason, Nicholas and Mike!
Mark 51 as fix-optional. If it's worth uplifting to 51, feel free to nominate it.
Well, it might be worth uplifting, but it also won't help much: currently my local Fx 51 build (tried both debug and opt) segfaults at startup. Even though it's wonderful to be able to build it, running is kind of another requirement.
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.