local builds fail with ~/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: hidden symbol 'arc4random_buf' is not defined locally

RESOLVED FIXED in Firefox 67

Status

()

defect
--
blocker
RESOLVED FIXED
6 months ago
3 months ago

People

(Reporter: mac198442, Assigned: glandium)

Tracking

({regression})

Trunk
Firefox 67
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr60 wontfix, firefox65 wontfix, firefox66 wontfix, firefox67 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Reporter

Description

6 months ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

Try to build Fennec using current trunk and android-ndk-15c (the newest NDK that ever worked for me)


Actual results:

104:33.57 /home/mac/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: hidden symbol 'arc4random_buf' is not defined locally
105:19.14 /home/mac/.mozbuild/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: hidden symbol 'arc4random_buf' is not defined locally



Expected results:

The build should have completed
Reporter

Updated

6 months ago
Severity: normal → blocker
Reporter

Comment 2

6 months ago
hg bisect identified this:

The first bad revision is:
changeset:   451973:e63ef8bbd6a1
user:        Peter Van der Beken <peterv@propagandism.org>
date:        Thu Dec 27 15:13:11 2018 +0000
summary:     Bug 1374012 - Update to Expat 2.2.1. Part 2a: Better hashing. r=erahm
Has Regression Range: --- → yes
Keywords: regression
Reporter

Updated

6 months ago
Flags: needinfo?(peterv)
Reporter

Comment 3

6 months ago
I suspect something like what was done in bug 1282141 is now required in parser/expat/lib/xmlparse.c.
(In reply to mac198442 from comment #3)
> I suspect something like what was done in bug 1282141 is now required in
> parser/expat/lib/xmlparse.c.

Yeah, sadly, looks like this is needed here as well.

We probably don't see that in automation 'cuz we're using our own clang builds and newer headers.
Duplicate of this bug: 1516735
Is there a workaround for this beyond using a pre-{bug 1374012] m-c? Having to do so is becoming more and more unwieldy as time passes.
(In reply to Botond Ballo [:botond] from comment #6)
> Is there a workaround for this beyond using a pre-{bug 1374012] m-c? Having
> to do so is becoming more and more unwieldy as time passes.

I tried running |mach bootstrap| to update my NDK, but that just resulted in a different linker error (bug 1517875).
Reporter

Comment 8

6 months ago
You can try this:

diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c
--- a/parser/expat/lib/xmlparse.c
+++ b/parser/expat/lib/xmlparse.c
@@ -834,17 +834,17 @@ ENTROPY_DEBUG(const char * label, unsign
   return entropy;
 }
 
 static unsigned long
 generate_hash_secret_salt(XML_Parser parser)
 {
   unsigned long entropy;
   (void)parser;
-#if defined(HAVE_ARC4RANDOM_BUF) || defined(__CloudABI__)
+#if !defined(__ANDROID__) && (defined(HAVE_ARC4RANDOM_BUF) || defined(__CloudABI__))
   (void)gather_time_entropy;
   arc4random_buf(&entropy, sizeof(entropy));
   return ENTROPY_DEBUG("arc4random_buf", entropy);
 #else
   /* Try high quality providers first .. */
 #ifdef _WIN32
   if (writeRandomBytes_RtlGenRandom((void *)&entropy, sizeof(entropy))) {
     return ENTROPY_DEBUG("RtlGenRandom", entropy);
I ended up manually downloading NDK r18b, and was able to successfully build with that.
Reporter

Comment 10

6 months ago
How odd perhaps I should investigate why my NDK r18b builds fail.
Reporter

Comment 11

6 months ago
I should have mentioned in comment #8 that i can successfully build with NDK r15c with this patch applied.

Comment 12

5 months ago

We are hitting that as well preparing Tor Browser builds for Android for the upcoming release.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 13

5 months ago

Setting the right dependency in the hope that it saves at least someone else some time when hitting this bug.

Blocks: 1374012

(In reply to Georg Koppen from comment #12)

We are hitting that as well preparing Tor Browser builds for Android for the upcoming release.

Just FYI: I would be most pleased if Tor for Android used the same configuration that m-c does, namely what is produced by the mach bootstrap changes in Bug 1477487.

Assignee

Updated

5 months ago
Assignee: nobody → mh+mozilla
Attachment #9042042 - Attachment is obsolete: true
Assignee

Comment 16

5 months ago

The function has been in bionic (Android's libc since the first commit
in the upstream repository), but it's not been in stdlib.h until
recently. As it happens, we have a similar declaration in
xpcom/base/nsUUIDGenerator.cpp.

Flags: needinfo?(peterv)

Comment 17

5 months ago
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/57664c81a1de
Add a function declaration for arc4random_buf in expat. r=peterv

Comment 18

5 months ago
bugherder
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67

Is this something we should backport to 66 to avoid downstream bustage after it goes to release?

Flags: needinfo?(mh+mozilla)
Assignee

Comment 20

4 months ago

Are there downstreams building fennec with NDK r15c?

Flags: needinfo?(mh+mozilla)
Assignee

Updated

4 months ago
Flags: needinfo?(ryanvm)

I have no clue, that's why I asked you :). If you don't think it's likely to be an issue, I'm perfectly fine with leaving things as-is.

Flags: needinfo?(ryanvm)

(In reply to Mike Hommey [:glandium] from comment #20)

Are there downstreams building fennec with NDK r15c?

The only downstream I'm aware of building Fennec is f-droid, but I can't find their build process definition/logs right now.

Assignee

Comment 23

4 months ago

I know only two downstreams of fennec: fennec_fdroid and icecat. Both are built on f-droid. The latter is based on ESR, so is not affected. The former builds 65 with NDK 19 according to https://gitlab.com/fdroid/fdroiddata/blob/master/metadata/org.mozilla.fennec_fdroid.txt so, is not affected either.

You need to log in before you can comment on or make changes to this bug.