Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 630452 - www-client/firefox-52.3.0 fails to build on arm with: SandboxEarlyInit is not a member of mozilla::SandboxEarlyInit
Summary: www-client/firefox-52.3.0 fails to build on arm with: SandboxEarlyInit is not...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-09 09:23 UTC by tt_1
Modified: 2017-09-22 09:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
compressed build.log (firefox-52.3.0esr-fails-on-arm.log.gz,32.64 KB, application/octet-stream)
2017-09-09 09:23 UTC, tt_1
Details
output of emerge --info (emerge.info.arm,2.90 KB, text/plain)
2017-09-09 09:25 UTC, tt_1
Details
Fix for a compiler directives test on file plugin-container.cpp, for firefox 52.3.0 (firefox-52.3.0esr-fix_plugin-container_directives.patch,635 bytes, patch)
2017-09-21 00:55 UTC, Fernando B. Nascimento
Details | Diff
Fix for a compiler directives test on file plugin-container.cpp, for firefox 52.2.0 (firefox-52.2.0esr-fix_plugin-container_directives.patch,635 bytes, patch)
2017-09-21 00:55 UTC, Fernando B. Nascimento
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2017-09-09 09:23:33 UTC
Created attachment 493498 [details]
compressed build.log

I tried to build firefox on an arm chroot with these useflags

[ebuild  N    ~] www-client/firefox-52.3.0::gentoo  USE="dbus gtk2 jemalloc system-harfbuzz system-icu system-jpeg system-libevent system-sqlite -bindist -custom-cflags -custom-optimization -debug -gmp-autoupdate (-hardened) -hwaccel -jack -neon (-pgo) -pulseaudio (-rust) (-selinux) -startup-notification (-system-cairo) -system-libvpx {-test} -wifi" L10N="-ach -af -an -ar -as -ast -az -bg -bn-BD -bn-IN -br -bs -ca -cak -cs -cy -da -de -dsb -el -en-GB -en-ZA -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mai -mk -ml -mr -ms -nb -nl -nn -or -pa -pl -pt-BR -pt-PT -rm -ro -ru -si -sk -sl -son -sq -sr -sv -ta -te -th -tr -uk -uz -vi -xh -zh-CN -zh-TW" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

The build fails, here is a snipet of build log (full build log attached)

[01m[K/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/ipc/contentproc/plugin-container.cpp:[m[K In function '[01m[Kint content_process_main(int, char**)[m[K':
[01m[K/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/ipc/contentproc/plugin-container.cpp:168:5:[m[K [01;31m[Kerror: [m[K'[01m[KSandboxEarlyInit[m[K' is not a member of '[01m[Kmozilla[m[K'
     mozilla::SandboxEarlyInit(XRE_GetProcessType());
[01;32m[K     ^[m[K
make[4]: *** [/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/config/rules.mk:953: plugin-container.o] Error 1
make[4]: Leaving directory '/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/ff/ipc/contentproc'
make[3]: *** [/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/config/recurse.mk:71: ipc/contentproc/target] Error 2
make[3]: Leaving directory '/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/ff'
make[2]: *** [/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/config/recurse.mk:33: compile] Error 2
make[2]: Leaving directory '/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/ff'
make[1]: *** [/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/config/rules.mk:523: default] Error 2
make[1]: Leaving directory '/var/tmp/portage/www-client/firefox-52.3.0/work/firefox-52.3.0esr/ff'
make: *** [client.mk:415: realbuild] Error 2
Comment 1 tt_1 2017-09-09 09:25:32 UTC
Created attachment 493500 [details]
output of emerge --info

I dropped MAKEOPTS to -j1 via /etc/portage/env/
Comment 2 tt_1 2017-09-09 12:38:25 UTC
This is the relevant part of the source code, in case someone would like to check it: 

https://github.com/mozilla/gecko-dev/blob/esr52/ipc/contentproc/plugin-container.cpp#L168
Comment 3 Jory A. Pratt gentoo-dev 2017-09-09 13:38:56 UTC
(In reply to tt_1 from comment #2)
> This is the relevant part of the source code, in case someone would like to
> check it: 
> 
> https://github.com/mozilla/gecko-dev/blob/esr52/ipc/contentproc/plugin-
> container.cpp#L168

No point in checking it, I am gonna go ahead and disable the sandbox again in esr build.
Comment 4 tt_1 2017-09-09 15:45:15 UTC
Can you give me two to three days to elaborate this further? I used the patched eclass and could build successfully, but also I could get past the compilation of the plugin-container by using --enable-sandbox and --disable-content-sandbox (the compile of this build is still running) 

Also there must have been a reason from your point of view to activate them in the first place?
Comment 5 Jory A. Pratt gentoo-dev 2017-09-10 14:39:16 UTC
Sandbox is disabled on esr builds, change made via eclass so no revision bumps
Comment 6 tt_1 2017-09-10 19:18:11 UTC
Thanks for the fix, to append --disable-content-sandbox would have had been enough to fix this. For your information only and in case you plan to reenable it on 52.x.esr series.
Comment 7 Fernando B. Nascimento 2017-09-19 23:57:52 UTC
Shouldn't this bug be sent upstream or resolved with a specific gentoo patch for this version to really resolve the problem instead of a workaround?

I have investigated and was just ready, with all files prepared, to send another bug report of this same thing.

I had this problem with FF 52.2.0 and I found that the file ${PORTAGE_TMPDIR}/portage/www-client/firefox-52.2.0/work/firefox-52.2.0esr/ipc/contentproc/plugin-container.cpp may have a bug with compiler directives:
- There are several tests "#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)";
- Only on the line 164 there is a test "#if defined(XP_LINUX) && defined(MOZ_SANDBOX)";
- that may be mixed with the "#if defined(XP_WIN) && defined(MOZ_SANDBOX)" also present several times.

This file uses a function from an include that is not used as the directives test gives false on the include area and true on the snippet that the function is called.

I searched the online code of Firefox, trunk, and this same file is smaller, there is no test for XP_LINUX, only XP_WIN, so my comment will not apply there, it just apply if them maintain older versions too.
Comment 8 Fernando B. Nascimento 2017-09-20 00:05:19 UTC
Forgot to say that Firefox compiles properly when the line 164 is changed to match the tests on other lines.

Sorry for not telling this on my prior comment. :-[
Comment 9 tt_1 2017-09-20 06:05:22 UTC
Hey, I think you are the most welcome to solve this issue with a patch. Unfortunately I am not really capable of understanding all these includes and c/c++ in general, but it might be worth a try to change them accordingly. 

Please provide a patch, I can test it including runtime testing. 

Also please note that the compile passes for amd64 but fails for arm with --enable-content-sandbox, and that the comment of the source code mentions something about Android. It might be that you could end up with a more elegant solution, such as a defined testing to differentiate between arm_linux and arm_android.
Comment 10 Fernando B. Nascimento 2017-09-20 12:18:58 UTC
Ok, just give me two days to learn how to include a patch on the portage structure (no more I hope) and another day to test compilation of the 52.3.0  on my Raspberry Pi 2.
Comment 11 tt_1 2017-09-20 12:29:04 UTC
The firefox ebuild has eapply_user, all you have to do is to copy your patch into /etc/portage/patches/www-client/firefox or www-client/firefox-52.3.0 if you want to be more specific. 

src_config for firefox can be altered via a simple txtfile /etc/portage/env/www-client/firefox , use EXTRA_ECONF="" and the command you'd like to overwrite. No need to edit the mozilla eclass.
Comment 12 Fernando B. Nascimento 2017-09-21 00:55:37 UTC
Created attachment 495714 [details, diff]
Fix for a compiler directives test on file plugin-container.cpp, for firefox 52.3.0
Comment 13 Fernando B. Nascimento 2017-09-21 00:55:58 UTC
Created attachment 495716 [details, diff]
Fix for a compiler directives test on file plugin-container.cpp, for firefox 52.2.0
Comment 14 Fernando B. Nascimento 2017-09-21 01:18:34 UTC
Thanks to you, no need for the first two days! :-D

It is compiling now and I hope to get a nice compiled FF in about 8 hours. :-)

So, if you want to try before my test completes (I think may be the case based on the way You wrote the comment #9 ;-) ), I have included two patches, one for the 52.2.0 and another for the 52.3.0, I did as you mentioned on comment #11 and put the patches on /etc/portage/patches/www-client/firefox-52.x.x, changing x for the right numbers for each version.

They are version specific because I don't if it is possible to use the same file for both versions, as the top of the patches there is a path for the file and the first directory includes the version of the package.

Just to clarify in case of any doubt: it is not a full blind patch like "everything is like that and only this is different so it must be wrong", it is obscure, but I searched at least some clues. I wanted to sumarize on my first comment #7, and may be I did it too mutch.

I searched where the function of the offender line (168) were defined, because it is from a namespace called "mozilla" so it should be on the sources being compiled. I found it on the file "mozilla/Sandbox.h" or "mozilla/SandboxInfo.h", I don't remember.

On the plugin-container.cpp file these are included on the lines 30 and 31. Well, for these includes take place, the compiler directive "#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)" have to be true, but the function on line 168 is run when the compiler directive on line 164 is true, and that is "#if defined(XP_LINUX) && defined(MOZ_SANDBOX)".

They are not equal, of course there will be a problem, the code uses a function that is on an include that can be excluded by the directives. Only then I realized that all other tests for with the "XP_LINUX" had the "GMP".

I plan to tell the compilation results of the 52.3.0 at 11:00 to 12:00 UTC, about 10 hours from now.
Comment 15 Fernando B. Nascimento 2017-09-21 11:21:52 UTC
I am writing this from the new compilation of www-client/firefox-52.3.0! :-)

Compilation finished in 32997s, that is 9h9m57s. (RPi2, -j2, 1GB RAM and 1G swap)

Now I agree that the issue is solved! :-)

May be the attention from the maintainer is needed now.
Comment 16 tt_1 2017-09-21 18:00:08 UTC
Yes, indeed, the patch fixes the compilation for arm and --enable-sandbox and content sandbox. Runtime testing done, no issues so fare. 

It would be really helpfull if you can open a bug upstream at mozillas bugtracker and explain to them why they should accept this patch. Support for arm is not seen as a prioritiy for them, hence they will not find and fix this bug on their own. But they may know why this breaks arm and not x86_64, and if there are any further issues with the code regarding android (could imagine that while reading the comment in the source code next to the fixed lines) 

I don't think the gentoo mozilla team will reenable the config options in the eclass because of https://bugs.gentoo.org/627426
Comment 17 Fernando B. Nascimento 2017-09-21 22:15:24 UTC
Bug sent upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1402133
Comment 18 tt_1 2017-09-22 09:01:20 UTC
I wrote you an email with some more informations and questions, please check your inbox.