Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 737256 - www-client/firefox: wayland don't work on musl
Summary: www-client/firefox: wayland don't work on musl
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-15 16:26 UTC by 12101111
Modified: 2021-02-24 12:43 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 12101111 2020-08-15 16:26:30 UTC
Compile firefox 68.11 ESR 72,73,75,76,78,79 by portage from gentoo and Compile firefox nightly from mozilla-central, all have this issue.
But firefox binary downloading from alpine linux works without problem.




Reproducible: Always

Steps to Reproduce:
0.compile www-client/firefox x11-libs/gtk+ and dev-libs/wayland with nostrip installsources
1.In a wayland compositor. In my case is sway. open terminal
2.unset DISPLAY
3.GDK_BACKEND=wayland WAYLAND_DEBUG=1 MOZ_ENABLE_WAYLAND=1 firefox --gdk-debug=all
Actual Results:  
Gdk-Message: 23:56:08.874: Trying wayland backend
Gdk-Message: 23:56:08.875: opening display
Gdk-Message: 23:56:08.875: Trying x11 backend
Gdk-Message: 23:56:09.066: Trying wayland backend
Gdk-Message: 23:56:09.066: opening display
Gdk-Message: 23:56:09.066: Trying x11 backend

(firefox:3780): Gtk-WARNING **: 23:56:09.066: cannot open display:


Expected Results:  
firefox launch
about:support shows Window Protocol: wayland/drm
many wayland and gdk debug log shows in terminal

In short: libmozwayland.so is a stub library, firefox will normally dlopen real libwayland-client.so at runtime, but failed to do so in musl system.

Launch firefox in gdb with those envirenment.
Set breakpoint in firefox's toolkit/xre/nsAppRunner.cpp XREMain::XRE_mainStartup().
Step into  gdk_display_manager_open_display(gdk_display_manager_get(), nullptr);
gdk_display_manager_open_display() is in gtk+'s gdk/gdkdisplaymanager.c
Because GDK_BACKEND=wayland, the gdk_backends[j] is wayland backend of gdk.
Step into display = gdk_backends[j].open_display (name);
This function is _gdk_wayland_display_open in gdk/wayland/gdkdisplay-wayland.c
Step to wl_display_connect, and this function is a stub just return NULL; from firefox's widget/gtk/mozwayland/mozwayland.c
To reach here directly, just set breakpoint at wl_display_connect

Workaround: replace libmozwayland.so with a symlink to /usr/lib/libwayland-client.so

I enable clang, libc++ and llvm binutils globally. But this is not the cause of the problem, because I have a same system with glibc which also enable llvm family globally and firefox works without problem.

Another strange thing is firefox binary from alpine linux don't have this issue.

emerge --info:

Portage 3.0.2 (python 3.8.5-final-0, default/linux/amd64/17.0/musl, gcc-10.0.1, musl-1.2.1, 5.8.0-zen+ x86_64)
=================================================================
System uname: Linux-5.8.0-zen+-x86_64-Intel-R-_Core-TM-_i7-10810U_CPU_@_1.10GHz-with-libc
KiB Mem:    24277520 total,  11443804 free
KiB Swap:   16777212 total,  16777212 free
Timestamp of repository gentoo: Sat, 15 Aug 2020 04:35:55 +0000
Head commit of repository gentoo: 29bc643346ca44eaa4d03b9af558938fc05c2590

Timestamp of repository gentoo-zh: Mon, 10 Aug 2020 09:13:31 +0000
Head commit of repository gentoo-zh: 97d07db7e17145ff889b0092eb330901511a02e1

Timestamp of repository jorgicio: Fri, 14 Aug 2020 03:35:31 +0000
Head commit of repository jorgicio: d3b2cf1292a23018ce20b1153f34abcf7ce0fe53

Timestamp of repository lanodanOverlay: Fri, 14 Aug 2020 17:05:30 +0000
Head commit of repository lanodanOverlay: 35eb78358173dfd334dda24e46ebc9ea5a673a28

Timestamp of repository lto-overlay: Mon, 10 Aug 2020 09:14:15 +0000
Head commit of repository lto-overlay: dea4e9d2a0ad72e82abbcbc9673845d22bb2d436

Timestamp of repository musl: Wed, 12 Aug 2020 12:35:31 +0000
Head commit of repository musl: 456afc330b30abca181b9eb8c8a39b80b4474551

Timestamp of repository mv: Mon, 10 Aug 2020 09:13:39 +0000
Head commit of repository mv: 014788d11c18d78cd8dcd17b3aa1d0659b50e1e7

Timestamp of repository sorrow: Mon, 10 Aug 2020 09:14:27 +0000
Head commit of repository sorrow: b6ee16b330a9128bbcfe53d18f3ef4f8d8dd0259

sh bash 5.0_p18
ld LLD 10.0.1 (compatible with GNU linkers)
ccache version 3.7.11 [enabled]
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3-r1::gentoo
dev-lang/python:          2.7.18-r100::lto-overlay, 3.7.8-r3::lto-overlay, 3.8.5-r1::lto-overlay
dev-util/ccache:          3.7.11::gentoo
dev-util/cmake:           3.18.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2::gentoo
sys-devel/binutils:       2.34::12101111-overlay
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.8::gentoo (virtual/os-headers)
sys-libs/musl:            1.2.1::gentoo
Repositories:

gentoo
    location: /usr/portage/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000

12101111-overlay
    location: /usr/portage/local
    masters: gentoo

gentoo-zh
    location: /usr/portage/gentoo-zh
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo-zh.git
    masters: gentoo

jorgicio
    location: /usr/portage/jorgicio
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/jorgicio.git
    masters: gentoo

lanodanOverlay
    location: /usr/portage/lanodanOverlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/lanodanOverlay.git
    masters: gentoo

lto-overlay
    location: /usr/portage/lto-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/lto-overlay.git
    masters: gentoo mv

musl
    location: /usr/portage/musl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/musl.git
    masters: gentoo

mv
    location: /usr/portage/mv
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/mv.git
    masters: gentoo

sorrow
    location: /usr/portage/sorrow
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/sorrow.git
    masters: gentoo

Installed sets: @fcitx5
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
CBUILD="x86_64-gentoo-linux-musl"
CC="clang"
CFLAGS="-march=skylake -mtune=skylake -O3 -pipe -falign-functions=32 -fomit-frame-pointer -ffunction-sections -fdata-sections -flto=thin"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXX="clang++"
CXXFLAGS="-march=skylake -mtune=skylake -O3 -pipe -falign-functions=32 -fomit-frame-pointer -ffunction-sections -fdata-sections -flto=thin -stdlib=libc++"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg ccache config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
INSTALL_MASK="charset.alias locale.alias"
LANG="zh_CN.UTF-8"
LC_ALL="zh_CN.UTF-8"
LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -flto=thin -Wl,-O3 -Wl,--gc-sections -march=skylake -mtune=skylake"
MAKEOPTS="-j11"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl alsa amd64 bzip2 clang cli compiler-rt crypt dbus default-compiler-rt default-libcxx dri elogind fortran gif iconv ipv6 jpeg libcxx libcxxabi libglvnd libtirpc libunwind ncurses nls nptl opengl openmp pam pcre png readline seccomp split-usr ssl svg tcpd unicode vaapi vulkan wayland xattr zlib zsh-completion" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="zh-CN" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86 ARM AArch64 RISCV WebAssembly AMDGPU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" QEMU_SOFTMMU_TARGETS="arm aarch64 i386 x86_64 riscv32 riscv64" QEMU_USER_TARGETS="arm aarch64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="intel i965 iris amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2020-09-30 13:21:40 UTC
Assigning to musl project -- nobody in mozilla project uses musl and can look into this.

If version from Alpine Linux works for you, locate their sources and compare patches. Maybe you will find the difference. In case you will find the missing patch for example, we would be happy to add it...
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2020-10-10 22:20:09 UTC
I asked another musl user to test this and he confirmed that =www-client/firefox[wayland]-78.3.1 (10 Oct 2020 17:40:15 or newer) works on sway. Could you please re-test and if you are still experiencing any problems to tell us in detail?
Comment 3 12101111 2020-10-14 12:15:12 UTC
Still wayland don't work on www-client/firefox-81.0.2.

81.0.2(0/81){tbz2}(20:08:35 10/14/20)(clang dbus gmp-autoupdate hwaccel lto openh264 screencast system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-webp wayland -debug -eme-free -geckodriver -hardened -jack -pgo -pulseaudio -selinux -wifi

Maybe this bug only appear with lld, libc++ or libunwind
Comment 4 Oleh 2021-01-02 16:36:50 UTC
I tested firefox-84.0.1 purely on Wayland, with sway wm and musl system. This is fresh installation with complete ~amd64 update. Firefox is built with *gcc* not clang. It works, with no observable issues
Comment 5 fee1-dead-beef 2021-02-08 02:53:33 UTC
I have a musl system with dev-lang/rust::smaeul, firefox is working with sway without environment variables.
Comment 6 12101111 2021-02-24 12:43:28 UTC
This issue is fixed in llvm/clang/lld/libc++ 12.
Although I'm not sure which commit fix it, firefox 86.0 compiled with llvm 12 and rust 1.50.0 ( with patches from https://github.com/rust-lang/rust/pull/81451 and modified ebuild ) don't have this issue and don't need workaround anymore.