Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 570522

Summary: www-client/firefox-43.0 fails to build on musl-amd64 with undefined reference to getcontext
Product: Gentoo Linux Reporter: tt_1 <herrtimson>
Component: [OLD] UnspecifiedAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED FIXED    
Severity: normal CC: blueness, felix.janda, musl
Priority: Normal Keywords: InOverlay
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702    
Attachments: emerge.info
compressed build.log
suggested patch
profiler-gettid.patch from recent firefox
GLIBC conditional patch.

Description tt_1 2016-01-01 19:37:07 UTC
Created attachment 421528 [details]
emerge.info

output of emerge -pqv '=www-client/firefox-43.0::gentoo' 

[ebuild     U] www-client/firefox-43.0 [42.0-r99] USE="dbus gstreamer hwaccel%* jemalloc3 jit minimal system-cairo system-icu system-jpeg system-libvpx system-sqlite -bindist -custom-cflags -custom-optimization -debug -egl -gmp-autoupdate -gstreamer-0 -gtk3 (-hardened) (-neon) (-pgo) -pulseaudio (-selinux) -startup-notification {-test} -wifi" LINGUAS="de -af -ar -as -ast -be -bg -bn_BD -bn_IN -br -bs -ca -cs -cy -da -el -en_GB -en_ZA -eo -es_AR -es_CL -es_ES -es_MX -et -eu -fa -fi -fr -fy_NL -ga_IE -gd -gl -gu_IN -he -hi_IN -hr -hu -hy_AM -id -is -it -ja -kk -km -kn -ko -lt -lv -mai -mk -ml -mr -nb_NO -nl -nn_NO -or -pa_IN -pl -pt_BR -pt_PT -rm -ro -ru -si -sk -sl -son -sq -sr -sv_SE -ta -te -th -tr -uk -vi -xh -zh_CN -zh_TW"


emerge --info is attached
Comment 1 tt_1 2016-01-01 19:40:46 UTC
Created attachment 421530 [details]
compressed build.log

quote from the log 

    INPUT("../../gfx/ots/src/vorg.o")
    INPUT("../../gfx/ots/src/Unified_cpp_gfx_ots_src0.o")
    INPUT("../../gfx/ots/src/Unified_cpp_gfx_ots_src1.o")
    INPUT("../../modules/brotli/Unified_c_modules_brotli0.o")
    INPUT("StaticXULComponentsEnd/StaticXULComponentsEnd.o")

../../tools/profiler/platform-linux.o: In function `TickSample::PopulateContext(void*)':
platform-linux.cc:(.text+0x4c3): undefined reference to `getcontext'
collect2: error: ld returned 1 exit status
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/rules.mk:826: recipe for target 'libxul.so' failed
make[4]: *** [libxul.so] Error 1
make[4]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff/toolkit/library'
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/recurse.mk:71: recipe for target 'toolkit/library/target' failed
make[3]: *** [toolkit/library/target] Error 2
make[3]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff'
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/recurse.mk:32: recipe for target 'compile' failed
make[2]: *** [compile] Error 2
make[2]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff'
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/rules.mk:549: recipe for target 'default' failed
make[1]: *** [default] Error 2
make[1]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff'
client.mk:396: recipe for target 'realbuild' failed
make: *** [realbuild] Error 2
Comment 2 tt_1 2016-01-01 19:45:51 UTC
Created attachment 421532 [details, diff]
suggested patch

Felix supposed that this is a problem with getcontext and wrote a little patch. 

There is as well an older patch in the musl overlay which has to be rebased if used for an up to date firefox. 

https://cgit.gentoo.org/proj/musl.git/tree/mail-client/thunderbird/files/musl/thunderbird-38.3.0-profiler-gettid.patch
Comment 3 tt_1 2016-01-01 19:50:41 UTC
Created attachment 421534 [details, diff]
profiler-gettid.patch from recent firefox

feel free to discuss which is the best solution, or find an independent one.
Comment 4 Felix Janda 2016-01-01 20:26:12 UTC
Just to give a bit of background:

musl currently does not have getcontext() but it is planned in the future. See

http://wiki.musl-libc.org/wiki/Open_Issues#ucontext.h
http://www.openwall.com/lists/musl/2014/06/23/6

So the patch works around an issue of musl and is not meant for firefox
upstream.

I don't know why alpine does not need this patch or why it does not
seem to be needed on arm.
Comment 5 Jory A. Pratt gentoo-dev 2016-01-01 20:30:17 UTC
(In reply to Felix Janda from comment #4)
> Just to give a bit of background:
> 
> musl currently does not have getcontext() but it is planned in the future.
> See
> 
> http://wiki.musl-libc.org/wiki/Open_Issues#ucontext.h
> http://www.openwall.com/lists/musl/2014/06/23/6
> 
> So the patch works around an issue of musl and is not meant for firefox
> upstream.
> 
> I don't know why alpine does not need this patch or why it does not
> seem to be needed on arm.

Felix so what patch would you prefer us to use for the time being? I am gonna leave this up to you, I will have to test it against my glibc system before I can land it in the overlay tho.
Comment 6 Aric Belsito 2016-01-04 00:05:06 UTC
Created attachment 421830 [details, diff]
GLIBC conditional patch.

The Voidlinux patch for tools:
https://github.com/voidlinux/void-packages/blob/master/srcpkgs/firefox/patches/fix-tools.patch
uses a preprocessor conditional that should work for both GLIBC and MUSL, and probably UCLIBC as well.

Attached is a patch that uses their logic.
Comment 7 Aric Belsito 2016-01-04 00:06:18 UTC
(In reply to lluixhi from comment #6)
> Created attachment 421830 [details, diff] [details, diff]
> GLIBC conditional patch.
> 
> The Voidlinux patch for tools:
> https://github.com/voidlinux/void-packages/blob/master/srcpkgs/firefox/
> patches/fix-tools.patch
> uses a preprocessor conditional that should work for both GLIBC and MUSL,
> and probably UCLIBC as well.
> 
> Attached is a patch that uses their logic.

Whoops, just realized a similar patch was already included, my bad.
Comment 8 Jory A. Pratt gentoo-dev 2016-01-04 03:28:22 UTC
Thanks for the report, I have addressed it in the mozilla overlay. I will not backport to 43, you are welcome to do so or you can use the 44.0_beta4 ebuild from overlay.