Closed Bug 1377445 Opened 7 years ago Closed 3 years ago

Firefox should allow building without gtk2

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Root Cause:Infrastructure/Build Error, firefox90 fixed)

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: Marc-Antoine, Assigned: code)

References

Details

Attachments

(4 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170615111052

Steps to reproduce:

- uninstall gtk2
- try to build firefox


Actual results:

build failure

configure: error: Library requirements (gtk+-2.0 >= 2.18.0 gtk+-unix-print-2.0 glib-2.0 >= 2.22 gobject-2.0 gdk-x11-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.



Expected results:

build success
Component: Untriaged → Build Config
Product: Firefox → Core
glandium did a bunch of work to allow us to link against either of gtk2 or gtk3.
As long as NPAPI plugins are supported, build dependency on gtk2 cannot be dropped.
NPAPI is currently only around to support Flash (bug 1269807). Per https://developer.mozilla.org/en-US/docs/Plugins/Roadmap, Firefox's Flash support (and thus NPAPI support) will be removed sometime in 2020.
Also, to make things clear, Flash *does* require gtk2.
Could NPAPI be made optional as by configuration before that? Unconditionally depending on Gtk+-2 until 2020 doesn't seem very reasonable, esp. not if it's due to supporting 3rd party, and even more so for something as "unpopular" as Flash.
Configuring things so NPAPI is optional is probably about as hard as removing support entirely; you can get a sense of the scope of the problem by looking at bug 1381916, which removed ~5k lines of code for a single platform.
Product: Core → Firefox Build System

Perhaps revisit this after bug #1455897 is over with?

Configuring things so NPAPI is optional is probably about as hard as
removing support entirely; you can get a sense of the scope of the problem
by looking at bug 1381916, which removed ~5k lines of code for a single
platform.

As a preparation for code drop, would make sense to mark NPAPI code with #ifdef and adding build option like --disable-npapi .

Then, at December 2020 can be simply dropped content of #ifdef and build option without additional effort.

Same amount of work will be (earlier) and possible benefit is that people or distribution who doesn't prefer to use flash or/and GTK2 will be able to cut it sooner.

Well, 2020 is here. Any chance of build able to build ff w/o gtk2 libs now that flash can get EoL?

Would be thrilled to see gtk2 made optional.

Depends on: 1663588

Depends on: #1661450

IIUC we can repurpose this bug to simply "Drop remaining GTK2 code", no? AFAIK plugin support was the last remaining user of it.

Sure

DUP bug 1626103 makes it clear that this bug here breaks building on Ubuntu: GTK 2 is no longer available and installable on Ubuntu 20.04.

Status: UNCONFIRMED → NEW
Root Cause: --- → Infrastructure/Build Error
Ever confirmed: true
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Version: unspecified → Trunk

I think this bug can be closed as a duplicate of #1661450

Likely a lot more can be removed but figured starting with the minimum to build without gtk2 makes sense.

Tested with a fresh clobber and it still builds fine.

Attachment #9214003 - Flags: review?(stransky)

Bug 1682030 just removed a whole lot more of NPAPI code - so it's probably a good timing to land this.

Bryan, thanks for the patch! The old review format via patch is not really used any more - can you submit it as phabricator revision using the moz-phab tool? Simply run moz-phab submit -s in your hg or git folder.

If it's too much of a struggle to set everything up, I can also submit it for you.

Flags: needinfo?(b)
See Also: → 1682030

b, please use Phabricator for the patch, Thanks.

Attachment #9214003 - Flags: review?(stransky)
Assignee: nobody → code
Status: NEW → ASSIGNED
Attachment #9214134 - Attachment description: Bug 1377445 Minimum to drop gtk2 depends r?stransky → Bug 1377445 - Drop gtk2 depends r?stransky

Backed out for causing bustage due to missing file. (gtk2/libmozgtk.so)

backout: https://hg.mozilla.org/integration/autoland/rev/ce196f921c311a361711d3b07725adedbde5598a

push: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=3ec9f9951ffe7eb0e1d83ea6e98df3f24b8a8f8b&selectedTaskRun=KjbWpHgSSWaVZb8r7PFpoA.0

failure log: https://treeherder.mozilla.org/logviewer?job_id=335803598&repo=autoland&lineNumber=68445

[task 2021-04-08T07:59:59.498Z] 07:59:59     INFO -  package> /builds/worker/workspace/obj-build/_virtualenvs/init_py3/bin/python /builds/worker/checkouts/gecko/toolkit/mozapps/installer/packager.py -DPKG_LOCALE_MANIFEST=/builds/worker/workspace/obj-build/browser/installer/locale-manifest.in -DMOZ_APP_NAME=firefox -DPREF_DIR=defaults/preferences -DMOZ_GTK=1 -DJAREXT= -DMOZ_ENABLE_SKIA_PDF=1 -DMOZ_CHILD_PROCESS_NAME=plugin-container -DNECKO_WIFI -DMOZ_BACKGROUNDTASKS=1 -DDLL_PREFIX=lib -DDLL_SUFFIX=.so -DBIN_SUFFIX= -DDIR_MACOS= -DDIR_RESOURCES= -DBINPATH='bin' -DRESPATH='bin' -DLPROJ_ROOT=en -DCLANG_CXX -DLLVM_SYMBOLIZER=llvm-symbolizer -DENABLE_MARIONETTE=1 -DACCESSIBILITY=1 -DATK_MAJOR_VERSION=2 -DATK_MINOR_VERSION=14 -DATK_REV_VERSION=0 -DBROWSER_CHROME_URL=chrome://browser/content/browser.xhtml -DBROWSER_CHROME_URL_QUOTED='"chrome://browser/content/browser.xhtml"' -DBUILD_CTYPES=1 -DCROSS_COMPILE='' -DEARLY_BETA_OR_EARLIER=1 -DEDITLINE=1 -DENABLE_MARIONETTE=1 -DENABLE_REMOTE_AGENT=1 -DENABLE_SHARED_MEMORY=1 -DENABLE_SPIDERMONKEY_TELEMETRY=1 -DENABLE_SYSTEM_EXTENSION_DIRS=1 -DENABLE_TESTS=1 -DENABLE_WASM_EXCEPTIONS=1 -DENABLE_WASM_FUNCTION_REFERENCES=1 -DENABLE_WASM_GC=1 -DENABLE_WASM_MULTI_VALUE=1 -DENABLE_WASM_REFTYPES=1 -DENABLE_WASM_SIMD=1 -DENABLE_WASM_SIMD_WORMHOLE=1 -DENABLE_WASM_TYPE_REFLECTIONS=1 -DFORCE_PR_LOG=1 -DFUNCPROTO=15 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_42 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_42 -DGL_PROVIDER_EGL=1 -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=1 -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_VFS_H=1 -DHAVE_THREAD_TLS_KEYWORD=1 -DHAVE_TRUNCATE64=1 -DHAVE_UNISTD_H=1 -DHAVE_VALGRIND_VALGRIND_H=1 -DHAVE_VALLOC=1 -DHAVE_VA_COPY=1 -DHAVE_VA_LIST_AS_ARRAY=1 -DHAVE_VISIBILITY_ATTRIBUTE=1 -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -DHAVE__UNWIND_BACKTRACE=1 -DHAVE___CXA_DEMANGLE=1 -DJS_64BIT=1 -DJS_CODEGEN_X64=1 -DJS_DEFAULT_JITREPORT_GRANULARITY=3 -DJS_HAS_CTYPES=1 -DJS_HAS_INTL_API=1 -DJS_PUNBOX64=1 -DJS_TRACE_LOGGING=1 -DMALLOC_H='<malloc.h>' -DMALLOC_USABLE_SIZE_CONST_PTR='' -DMOZILLA_UAVERSION='"89.0"' -DMOZILLA_VERSION='"89.0a1"' -DMOZILLA_VERSION_U=89.0a1 -DMOZ_AARCH64_JSCVT=0 -DMOZ_ACCESSIBILITY_ATK=1 -DMOZ_APP_UA_NAME='""' -DMOZ_APP_UA_VERSION='"89.0a1"' -DMOZ_ASAN=1 -DMOZ_AV1=1 -DMOZ_BLOCK_PROFILE_DOWNGRADE=1 -DMOZ_BUILD_APP=browser -DMOZ_BUNDLED_FONTS=1 -DMOZ_CLANG_PLUGIN=1 -DMOZ_DATA_REPORTING=1 -DMOZ_DAV1D_ASM=1 -DMOZ_DEDICATED_PROFILES=1 -DMOZ_DISTRIBUTION_ID='"org.mozilla"' -DMOZ_DLL_PREFIX='"lib"' -DMOZ_DLL_SUFFIX='".so"' -DMOZ_ENABLE_DBUS=1 -DMOZ_ENABLE_FORKSERVER=1 -DMOZ_ENABLE_SKIA=1 -DMOZ_ENABLE_SKIA_PDF=1 -DMOZ_ENABLE_SKIA_PDF_SFNTLY=1 -DMOZ_FFMPEG=1 -DMOZ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-DNS_PRINT_PREVIEW=1 -DSTATIC_JS_API=1 -DSTDC_HEADERS=1 -DTARGET_XPCOM_ABI='"x86_64-gcc3"' -DUSE_SKIA=1 -DU_STATIC_IMPLEMENTATION=1 -DU_USING_ICU_NAMESPACE=0 -DVA_COPY=va_copy -DWASM_PRIVATE_REFTYPES=1 -DXP_LINUX=1 -DXP_UNIX=1 -D_REENTRANT=1 -DAB_CD=en-US \
[task 2021-04-08T07:59:59.498Z] 07:59:59     INFO -  package> 	--format omni \
[task 2021-04-08T07:59:59.498Z] 07:59:59     INFO -  package> 	--removals /builds/worker/checkouts/gecko/browser/installer/removed-files.in \
[task 2021-04-08T07:59:59.498Z] 07:59:59     INFO -  package> 	 \
[task 2021-04-08T07:59:59.498Z] 07:59:59     INFO -  package> 	 \
[task 2021-04-08T07:59:59.499Z] 07:59:59     INFO -  package> 	--minify \
[task 2021-04-08T07:59:59.499Z] 07:59:59     INFO -  package> 	 \
[task 2021-04-08T07:59:59.499Z] 07:59:59     INFO -  package> 	 \
[task 2021-04-08T07:59:59.499Z] 07:59:59     INFO -  package> 	--compress none \
[task 2021-04-08T07:59:59.499Z] 07:59:59     INFO -  package> 	/builds/worker/checkouts/gecko/browser/installer/package-manifest.in '../../dist' '../../dist'/firefox \
[task 2021-04-08T07:59:59.499Z] 07:59:59     INFO -  package>
[task 2021-04-08T07:59:59.499Z] 07:59:59    ERROR -  package> Error: $SRCDIR/browser/installer/package-manifest.in:108: Missing file(s): bin/gtk2/libmozgtk.so
[task 2021-04-08T07:59:59.499Z] 07:59:59    ERROR -  package> Traceback (most recent call last):
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>   File "/builds/worker/checkouts/gecko/toolkit/mozapps/installer/packager.py", line 300, in <module>
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>     main()
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>   File "/builds/worker/checkouts/gecko/toolkit/mozapps/installer/packager.py", line 257, in main
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>     copier.add(mozpath.join(respath, "removed-files"), removals)
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>   File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>     next(self.gen)
[task 2021-04-08T07:59:59.500Z] 07:59:59     INFO -  package>   File "/builds/worker/checkouts/gecko/python/mozbuild/mozpack/errors.py", line 132, in accumulate
[task 2021-04-08T07:59:59.501Z] 07:59:59     INFO -  package>     raise AccumulatedErrors()
[task 2021-04-08T07:59:59.501Z] 07:59:59     INFO -  package> mozpack.errors.AccumulatedErrors
[task 2021-04-08T07:59:59.501Z] 07:59:59    ERROR -  package> make[5]: *** [/builds/worker/checkouts/gecko/toolkit/mozapps/installer/packager.mk:25: stage-package] Error 1

So, I'm almost done with a more thorough patch, but I'm hitting a problem with BFD ld not liking the weak symbol for atk_bridge_adaptor_init. That was done back in bug 1138845 because of reasons essentially outlined in bug 1110211 comment 7 and following. Things have evolved since, though: we require Gtk+ 3.14. Gtk+ has been requiring atk-bridge since 3.6 but still had an option to disable it at build time until 3.10, at which point it became always enabled.... when building Gtk+ with the X11 backend. Martin, what's the Atk story with the wayland backend? Does a11y just not work with gtk3 running with the wayland backend? Would it be a problem if we hard-depend on atk-bridge? (I suspect it might be a problem for the people who use a gtk3 with only the wayland backend enabled?)

Flags: needinfo?(code) → needinfo?(stransky)

I don't know about atk-bridge/Wayland but I'm sure gtk3 build with Wayland backend only may be a very rare and seen on Gentoo custom builds only. You may run Gtk/Wayland applications without XWayland which is supported and XWayland is started on demand when a Gtk application asks for it, but that still needs Gtk with X11 backend enabled.

AFAIK we don't even support to build Firefox wihout X11 backend (or when X11 backend is disabled by Gtk) so I think it's safe to depend on atk-bridge as we depend on other X11/Gtk libraries.

Flags: needinfo?(stransky)

I really hope X isn't mandatory for firefox (running a wayland only gentoo build as you pointed out).. It would additionally block https://bugzilla.mozilla.org/show_bug.cgi?id=1661450 which aims to support just that

Currently, we use a weak symbol to call atk_bridge_adaptor_init, but for
some reason, this stops working when removing the mozgtk stub library
(which we can do now that we don't need gtk+2 support at all), in a way
similar to bug 1368363.

We've been using a weak symbol because atk-bridge 2.0 was not guaranteed
to be enabled in gtk+3 back when this was added, but things have changed
since then, and gtk+3 always requires atk-bridge 2.0... ... on X11.
Unfortunately, that's not the case on Wayland, and a gtk+3 built with
Wayland support only will not depend on atk-bridge 2.0. So all in all,
we're back to square one, and because this fails to build, we need
another approach.

It turns out that other approach was in place for gtk+2, in the form of
dlopen/dlsym, the code for which somehow survived the years despite
libatk-bridge.so not having been a thing for years, and despite Firefox
itself not actually using gtk+2 for accessibility.

So we repurpose that code to load atk-bridge 2.0.

Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/44d676a26d1a
Use dlsym for atk_bridge_adaptor_init. r=eeejay
https://hg.mozilla.org/integration/autoland/rev/0ce69d9f596b
Remove build dependencies on gtk+2. r=firefox-build-system-reviewers,mhentges
https://hg.mozilla.org/integration/autoland/rev/f8eb1926bfdb
Remove gtk+2 from docker images. r=firefox-build-system-reviewers,andi,mhentges
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/2cc16940bd4a
port "emove build dependencies on gtk+2" to Thunderbird. rs=bustage-fix

Mike, this unfortunately broke the Wayland backend (we really need to get the CI for it in place).

glxtest: Could not connect to wayland socket

The issue appears to be that wl_display_connect (and all other Wayland API) now uses the stubs in mozwayland.c. Normally the proper symbols where loaded via Gtk3 IIUC. Can you look into it?

Martin, also NIing you here.

Flags: needinfo?(stransky)
Flags: needinfo?(mh+mozilla)
Regressions: 1706452

(In reply to Robert Mader [:rmader] from comment #35)

The issue appears to be that wl_display_connect (and all other Wayland API) now uses the stubs in mozwayland.c. Normally the proper symbols where loaded via Gtk3 IIUC. Can you look into it?

Fix in bug 1706452

Flags: needinfo?(stransky)
Flags: needinfo?(mh+mozilla)
Regressions: 1706408
Regressions: 1707124
Regressions: 1707834
Attachment #9214134 - Attachment is obsolete: true
Depends on: 1682030
See Also: 1682030
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: