Closed Bug 1686405 Opened 4 years ago Closed 4 years ago

Undefined symbol: (anonymous namespace)::NowIncludingSuspendMs() ../../mozglue/misc/Uptime.o

Categories

(Core :: mozglue, defect, P5)

defect

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox84 --- unaffected
firefox85 --- unaffected
firefox86 --- wontfix
firefox87 --- wontfix
firefox88 --- wontfix
firefox89 --- fixed

People

(Reporter: petr.sumbera, Assigned: petr.sumbera)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

Firefox build on Solaris failed with following:

16:05.13 Undefined                      first referenced
16:05.13  symbol                            in file
16:05.13 (anonymous namespace)::NowIncludingSuspendMs() ../../mozglue/misc/Uptime.o  (symbol scope specifies local binding)
16:05.13 (anonymous namespace)::NowExcludingSuspendMs() ../../mozglue/misc/Uptime.o  (symbol scope specifies local binding)
16:05.13 ld: fatal: symbol referencing errors
16:05.13 collect2: error: ld returned 1 exit status
16:05.14 gmake[4]: *** [/builds/psumbera/mozilla-central-build/config/rules.mk:420: ../../dist/bin/firefox] Error 1
16:05.14 gmake[3]: *** [/builds/psumbera/mozilla-central-build/config/recurse.mk:72: browser/app/target] Error 2

The first bad revision is:

changeset: 562789:5d540daa09b9
user: Paul Adenot <paul@paul.cx>
date: Tue Jan 12 04:34:59 2021 -0800
description:
Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld

Differential Revision: https://phabricator.services.mozilla.com/D99138

My mozconfig file is:

ac_add_options --with-system-icu
ac_add_options --with-system-libevent
ac_add_options --with-system-zlib
ac_add_options --enable-js-shell
ac_add_options --prefix=/opt/firefox
ac_add_options --enable-jemalloc
ac_add_options --enable-replace-malloc
ac_add_options --enable-pulseaudio
ac_add_options --enable-debug
ac_add_options --disable-install-strip
# use gcc (not clang)
ac_add_options --enable-release
ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-optimize
ac_add_options --disable-geckodriver
# https://bugzilla.mozilla.org/show_bug.cgi?id=1547217
ac_add_options --disable-verify-mar
# no nasm on intel yet
ac_add_options --disable-av1
Regressed by: 1205985
Has Regression Range: --- → yes

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → General
Product: Firefox → Firefox Build System

Set release status flags based on info from the regressing bug 1205985

Following makes it compile on Solaris again:

--- a/mozglue/misc/Uptime.cpp   Tue Jan 05 10:57:21 2021 +0100
+++ b/mozglue/misc/Uptime.cpp   Thu Jan 14 17:16:15 2021 +0100
@@ -79,7 +79,7 @@
 }
 #endif  // XP_WIN

-#if defined(XP_LINUX)  // including Android
+#if defined(XP_LINUX) || defined(XP_SOLARIS) // including Android
 #  include <time.h>

 // Number of nanoseconds in a millisecond.

But maybe XP_UNIX should be used instead?

I guess there is similar issue on BSD. Jan can you please confirm it?

Flags: needinfo?(jbeich)
Attached patch fixSplinter Review

(In reply to Petr Sumbera from comment #3)

I guess there is similar issue on BSD. Jan can you please confirm it?

Yep, see below. I've adjusted your fix to unbreak on BSDs:

$ c++ --version
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-rc2-0-g43ff75f2c3f)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

$ echo "ac_add_options --enable-warnings-as-errors" >>.mozconfig
$ ./mach build
[...]
mozglue/misc/Uptime.cpp:24:17: error: function '(anonymous namespace)::NowIncludingSuspendMs' has internal linkage but is not defined [-Werror,-Wundefined-internal]
Maybe<uint64_t> NowIncludingSuspendMs();
                ^
mozglue/misc/Uptime.cpp:124:30: note: used here
  mStartIncludingSuspendMs = NowIncludingSuspendMs();
                             ^
mozglue/misc/Uptime.cpp:25:17: error: function '(anonymous namespace)::NowExcludingSuspendMs' has internal linkage but is not defined [-Werror,-Wundefined-internal]
Maybe<uint64_t> NowExcludingSuspendMs();
                ^
mozglue/misc/Uptime.cpp:125:30: note: used here
  mStartExcludingSuspendMs = NowExcludingSuspendMs();
                             ^
2 errors generated.
Flags: needinfo?(jbeich)

define CLOCK_BOOTTIME CLOCK_UPTIME is what I did at first too, but that seems to be wrong. (bug 1686713 - https://phabricator.services.mozilla.com/D101748 - now changed)

Linux: MONOTONIC excludes so BOOTTIME was added to include (https://lwn.net/Articles/420142/)

OpenBSD: UPTIME was added to exclude (https://github.com/openbsd/src/commit/e206ca2e9 actually handled differently), BOOTTIME does the same as MONOTONIC (https://github.com/openbsd/src/commit/b50bd52298d2), so MONOTONIC includes

FreeBSD: UPTIME does the same as MONOTONIC (https://github.com/freebsd/freebsd-src/commit/5eefd88949), so IIUC MONOTONIC excludes ( confirmed by ipv6 timeouts not expiring @ https://lists.freebsd.org/pipermail/freebsd-arch/2013-August/014707.html ?), no actual way to include it seems >_<

Paul, any ideas here? The first comment indicates this was caused by D99138.

Flags: needinfo?(padenot)

I can review, but it's unclear to me what to do on BSD and Solaris for BOOTTIME, or even if it exists. In any case, this is for telemetry purposes, if you don't care about this, then just make it return Nothing(), and it will compile (maybe in a separate block). I can land a patch quickly for this, if downstream wants.

Flags: needinfo?(padenot)

As for Solaris there doesn't seem to be any alternative for BOOTTIME. So for us is Nothing() good enough.

Fwiw, just stumbled upon this issue on OpenBSD too, fails the same when building 86.0b1, at the linking firefox binary step:

ld: error: undefined symbol: (anonymous namespace)::NowIncludingSuspendMs()                
>>> referenced by Uptime.cpp:124 (/usr/obj/ports/firefox-86.0beta1/firefox-86.0/mozglue/misc/Uptime.cpp:124)           
>>>               ../../mozglue/misc/Uptime.o:(mozilla::InitializeUptime())                                            
>>> referenced by Uptime.cpp:132 (/usr/obj/ports/firefox-86.0beta1/firefox-86.0/mozglue/misc/Uptime.cpp:132)           
>>>               ../../mozglue/misc/Uptime.o:(mozilla::ProcessUptimeMs())                                             
                                                                                                                       
ld: error: undefined symbol: (anonymous namespace)::NowExcludingSuspendMs()                                            
>>> referenced by Uptime.cpp:125 (/usr/obj/ports/firefox-86.0beta1/firefox-86.0/mozglue/misc/Uptime.cpp:125)           
>>>               ../../mozglue/misc/Uptime.o:(mozilla::InitializeUptime())                                            
>>> referenced by Uptime.cpp:143 (/usr/obj/ports/firefox-86.0beta1/firefox-86.0/mozglue/misc/Uptime.cpp:143)           
>>>               ../../mozglue/misc/Uptime.o:(mozilla::ProcessUptimeExcludingSuspendMs())
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)   

testing https://bug1686405.bmoattachments.org/attachment.cgi?id=9197204 as a potential fix, thanks jan !

Component: General → mozglue
Product: Firefox Build System → Core

The product::component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P5 → --
Priority: -- → P5

I'm leaving possible BSD improvements for now. Work can be done later via Bug 1686713.

Assignee: nobody → petr.sumbera

Comment on attachment 9210999 [details]
Bug 1686405 - Fix tier-3 build. r?glandium

this patch tested on openbsd instead of https://bug1686405.bmoattachments.org/attachment.cgi?id=9197204, 88.0b1 builds fine

Attachment #9210999 - Flags: feedback+
Flags: needinfo?(petr.sumbera) → needinfo?(padenot)
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: