-
Notifications
You must be signed in to change notification settings - Fork 37.7k
depends: Prune X packages #16408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
depends: Prune X packages #16408
Conversation
Previously, in 683b7d7 and 0e75263, we accidentally broke QT's ability to pick up Xlib thru the config.gui.tests.xlib configuration test, which also means that config.gui.libraries.xcb_xlib wasn't run. This resulted in a QT build that was implicitly -no-xcb-lib and -no-feature-xlib. This is actually a desired behaviour, as it means less required shared objects for our final bitcoin-qt binary. Specifically, it eliminated the libX11-xcb.so.1 and libX11.so.6 requirements. In this commit, we explicitly build without Xlib. We should continue to track upstream ticket https://bugreports.qt.io/browse/QTBUG-61452 which talks about adding a -no-xlib (non-hidden) flag instead of the -no-feature-xlib (hidden) flag.
We're no longer building QT with libX11/XLib, however, libX11/XLib headers are still required for parts of QT. In this commit we add a minimal configure.ac for libX11/XLib that is headers-only. This change allows us to remove all of libX11/XLib's dependencies.
We're no longer building QT with libX11/XLib, so it doesn't make sense to check for the x11-xcb package.
libXext was only needed (as a library) by QT when it was using XLib/libX11 (as a library), now that we're building QT without XLib/libX11, we can safely remove libXext.
They should no longer be needed as we build QT without libX11/XLib libraries now.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK. Assuming this works without breaking anything else it's a good cleanup & simplification to depends and makes the behavior we want explicit. Will review shortly. In aa53cb7 you say:
Is what it's required for documented somewhere? There was some related discussion in the |
As I have always understood it, XCB is a newer, more efficient replacement for the X11 protocol. In that case what you'd lose here is support for pre-XCB servers. XCB is old as the hills by now (initial release 2001 according to wikipedia ), so Concept ACK. |
Some primary source information on XCB vs libX11/XLib: https://www.x.org/wiki/guide/xlib-and-xcb/ XCB isn't a replacement for the X11 protocol, but rather a replacement for the helper library used to talk to the X server (previously libX11/XLib). Quote about libX11/XLib:
Quote about XCB:
Note that we already have XCB as a required library: bitcoin/contrib/devtools/symbol-check.py Line 72 in e5abb59
|
Unfortunately, it's not documented anywhere, but looking at the code for QT, the following files from libX11/Xlib are still being included:
|
Concept ACK. I definitely tried to do this originally, but it simply wasn't possible with older qt versions. I believe they still required a few of the synchronous libX11 calls, but apparently that's no longer the case. Great find, @dongcarl! The need for headers is worrisome. While likely harmless, it could also be the case that some libX11 symbols are linked in and remain unresolved, with the linker managing to figure out that they're dead paths. Completely unlikely, though. @dongcarl: Assuming the likely scenario that this is just an upstream qt bug, how involved would it be to add the proper ifdefs in their code? If it's not TOO nasty, I'd prefer to carry+upstream that patch than to require unnecessary headers. |
There was a previous attempt to achieve this, and it was bad. This works.
We can actually patch QT to remove its dependency on libX11's headers. It turns it this wasn't that hard.
@dongcarl wooo, yes! Need to look in-detail, but that's awesome, and the final patch should definitely be upstreamed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch and depends changes look good. At first glance it looks like there are a few cleanups to make to the patch, but after looking more deeply I agree with what you have here.
Looks good to me after cleaning up the qt detection.
@@ -355,7 +355,6 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ | |||
PKG_CHECK_MODULES([QTFB], [Qt5FbSupport], [QT_LIBS="-lQt5FbSupport $QT_LIBS"]) | |||
fi | |||
if test "x$TARGET_OS" = xlinux; then | |||
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't just remove this, as it should still be necessary for non-depends builds. In other words, whatever we change this to needs to work before AND after removing the dependencies.
I think it should suffice to simply continue if the X11XCB check fails, and assume that qt was built without it as a dependency.
More correctly, we may be able to test a qt feature flag in one of the .pc files, or compile a stub that makes sure that QT_CONFIG(xcb_xlib) isn't set if libX11 is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should suffice to simply continue if the X11XCB check fails, and assume that qt was built without it as a dependency.
Played around with this a little bit...
Adding an empty last argument seems to trigger the default action-if-not-found behaviour of "end the execution with an error for not having found the dependency" (source)
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"], [])
Adding a dummy last argument seems to work
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"], [QT_LIBS="$QT_LIBS"])
I don't know autotools that well so perhaps @theuni can tell me what the idiomatic thing to do is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked into this. The .pc file for QTXCBQPA adds "-lX11-xcb" as necessary, so our pkg-config check is redundant anyway (unless it was done to fix an ordering problem, which doesn't seem to be the case).
So nevermind my complaint above, removal is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double-checked @theuni's result with a Gitian build of 76e2cde, which was before any XLib pickup failure.
Here is depends/i686-pc-linux-gnu/lib/pkgconfig/Qt5XcbQpa.pc
:
ubuntu@a661ab7477ba:~/build/bitcoin/depends/i686-pc-linux-gnu/lib/pkgconfig$ cat Qt5XcbQpa.pc
prefix=/home/ubuntu/build/bitcoin/depends/i686-pc-linux-gnu
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: Qt5 XcbQpa
Description: Qt XcbQpa module
Version: 5.9.7
Libs: -L${libdir} -lQt5XcbQpa
Libs.private: -L/home/ubuntu/build/bitcoin/depends/i686-pc-linux-gnu/lib -lQt5ServiceSupport -lQt5ThemeSupport -lQt5DBus -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L//home/ubuntu/build/bitcoin/depends/i686-pc-linux-gnu/lib -lfontconfig -lfreetype -lQt5Gui -lqtlibpng -lqtharfbuzz -lQt5Core -lm -lz -lqtpcre2 -lpthread -lX11-xcb -lX11 -lxcb-static -lxcb -ldl
Cflags: -I${includedir}/QtXcbQpa
Requires: Qt5Core Qt5Gui Qt5Core Qt5Gui Qt5ServiceSupport Qt5ThemeSupport Qt5EventDispatcherSupport Qt5FontDatabaseSupport
So, we should be good.
For the record, here's the QT upstream tracking for my changes: https://codereview.qt-project.org/c/qt/qtbase/+/268206 |
Concept ACK Very nice find! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 0c55d8b
@@ -355,7 +355,6 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ | |||
PKG_CHECK_MODULES([QTFB], [Qt5FbSupport], [QT_LIBS="-lQt5FbSupport $QT_LIBS"]) | |||
fi | |||
if test "x$TARGET_OS" = xlinux; then | |||
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked into this. The .pc file for QTXCBQPA adds "-lX11-xcb" as necessary, so our pkg-config check is redundant anyway (unless it was done to fix an ordering problem, which doesn't seem to be the case).
So nevermind my complaint above, removal is fine.
Perhaps it's good to preserve the history here. Please let me know if people think this patchset needs squashing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 0c55d8b
Please let me know if people think this patchset needs squashing.
I think these commits are ok as-is. Good explanations for each.
I did some testing on macOS and Debian. Checked that XLib
is being disabled when building Qt
:
X11:
Using system-provided XCB libraries .. no
EGL on X11 ........................... no
Xinput2 .............................. no
XCB XKB .............................. yes
XLib ................................. no
XCB render ........................... yes
XCB GLX .............................. yes
XCB Xlib ............................. no
Using system-provided xkbcommon ...... no
Checked that bitcoin-qt
on Debian actually ran.
Overall a really nice cleanup. Going to merge this now so that the build system work can continue.
0c55d8b depends: qt: Patch to remove dep on libX11 (Carl Dong) 222e6cc gitignore: Actually pay attention to depends patches (Carl Dong) 65f8da0 symbol-check: Disallow libX11-*.so.* shared libraries (Carl Dong) 9245699 depends: libXext isn't needed by anyone (Carl Dong) 689d3b4 build-aux: Remove check for x11-xcb (Carl Dong) aa53cb7 depends: libX11: Make package headers-only (Carl Dong) 9a01ab0 depends: qt: Explicitly stop using Xlib/libX11 (Carl Dong) 1ec30b8 depends: xproto is only directly needed by libXau (Carl Dong) Pull request description: Related to: bitcoin#16150 We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal `configure.ac` has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers. This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable. See commit messages for more details. --- Reviewers: I am least sure about the minimal `configure.ac`, as I'm not too familiar with the autoconf syntax. Any improvements w/re robustness would be welcome. ACKs for top commit: theuni: ACK 0c55d8b fanquake: ACK 0c55d8b Tree-SHA512: 41f653a0f91bc0e0faac49713c0c6dfd8cb605f9c4e34eb75a790dd808ebf3e5c160f1dd40bc8fbc911ee718ea319313b526d63733c98ff62d8dffecb58caa01
Summary: ``` We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal configure.ac has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers. This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable. ``` Backport of core [[bitcoin/bitcoin#16408 | PR16408]]. Depends on D5632. Test Plan: Run the Gitian builds. Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5636
0c55d8b depends: qt: Patch to remove dep on libX11 (Carl Dong) 222e6cc gitignore: Actually pay attention to depends patches (Carl Dong) 65f8da0 symbol-check: Disallow libX11-*.so.* shared libraries (Carl Dong) 9245699 depends: libXext isn't needed by anyone (Carl Dong) 689d3b4 build-aux: Remove check for x11-xcb (Carl Dong) aa53cb7 depends: libX11: Make package headers-only (Carl Dong) 9a01ab0 depends: qt: Explicitly stop using Xlib/libX11 (Carl Dong) 1ec30b8 depends: xproto is only directly needed by libXau (Carl Dong) Pull request description: Related to: bitcoin#16150 We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal `configure.ac` has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers. This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable. See commit messages for more details. --- Reviewers: I am least sure about the minimal `configure.ac`, as I'm not too familiar with the autoconf syntax. Any improvements w/re robustness would be welcome. ACKs for top commit: theuni: ACK 0c55d8b fanquake: ACK 0c55d8b Tree-SHA512: 41f653a0f91bc0e0faac49713c0c6dfd8cb605f9c4e34eb75a790dd808ebf3e5c160f1dd40bc8fbc911ee718ea319313b526d63733c98ff62d8dffecb58caa01
0c55d8b depends: qt: Patch to remove dep on libX11 (Carl Dong) 222e6cc gitignore: Actually pay attention to depends patches (Carl Dong) 65f8da0 symbol-check: Disallow libX11-*.so.* shared libraries (Carl Dong) 9245699 depends: libXext isn't needed by anyone (Carl Dong) 689d3b4 build-aux: Remove check for x11-xcb (Carl Dong) aa53cb7 depends: libX11: Make package headers-only (Carl Dong) 9a01ab0 depends: qt: Explicitly stop using Xlib/libX11 (Carl Dong) 1ec30b8 depends: xproto is only directly needed by libXau (Carl Dong) Pull request description: Related to: bitcoin#16150 We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal `configure.ac` has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers. This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable. See commit messages for more details. --- Reviewers: I am least sure about the minimal `configure.ac`, as I'm not too familiar with the autoconf syntax. Any improvements w/re robustness would be welcome. ACKs for top commit: theuni: ACK 0c55d8b fanquake: ACK 0c55d8b Tree-SHA512: 41f653a0f91bc0e0faac49713c0c6dfd8cb605f9c4e34eb75a790dd808ebf3e5c160f1dd40bc8fbc911ee718ea319313b526d63733c98ff62d8dffecb58caa01
67c6c5a depends: qt: Patch to remove dep on libX11 (Carl Dong) 4cfd7ff gitignore: Actually pay attention to depends patches (Carl Dong) 3bd798a symbol-check: Disallow libX11-*.so.* shared libraries (Carl Dong) a214141 depends: libXext isn't needed by anyone (Carl Dong) adf5772 build-aux: Remove check for x11-xcb (Carl Dong) bc7bc6a depends: libX11: Make package headers-only (Carl Dong) 4029218 depends: qt: Explicitly stop using Xlib/libX11 (Carl Dong) 6007eb6 depends: xproto is only directly needed by libXau (Carl Dong) Pull request description: Coming straight from bitcoin#16408 These X packages are not necessary to build our Qt dependency (Qt required them in earlier versions), so remove them. ACKs for top commit: random-zebra: utACK 67c6c5a furszy: utACK 67c6c5a Tree-SHA512: 30c078cf3c27e8dd26153e96456143dff434b0f3c814ab0a04eb97d49e2ceb5ed396c33b3592c82f2ed6bbe43d5891e3025748413267f511de87bb195d620d4f
0c55d8b depends: qt: Patch to remove dep on libX11 (Carl Dong) 222e6cc gitignore: Actually pay attention to depends patches (Carl Dong) 65f8da0 symbol-check: Disallow libX11-*.so.* shared libraries (Carl Dong) 9245699 depends: libXext isn't needed by anyone (Carl Dong) 689d3b4 build-aux: Remove check for x11-xcb (Carl Dong) aa53cb7 depends: libX11: Make package headers-only (Carl Dong) 9a01ab0 depends: qt: Explicitly stop using Xlib/libX11 (Carl Dong) 1ec30b8 depends: xproto is only directly needed by libXau (Carl Dong) Pull request description: Related to: bitcoin#16150 We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal `configure.ac` has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers. This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable. See commit messages for more details. --- Reviewers: I am least sure about the minimal `configure.ac`, as I'm not too familiar with the autoconf syntax. Any improvements w/re robustness would be welcome. ACKs for top commit: theuni: ACK 0c55d8b fanquake: ACK 0c55d8b Tree-SHA512: 41f653a0f91bc0e0faac49713c0c6dfd8cb605f9c4e34eb75a790dd808ebf3e5c160f1dd40bc8fbc911ee718ea319313b526d63733c98ff62d8dffecb58caa01
Summary: ``` We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal configure.ac has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers. This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable. ``` Backport of core [[bitcoin/bitcoin#16408 | PR16408]]. Depends on D5632. Test Plan: Run the Gitian builds. Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5636
Related to: #16150
We noticed that we could build QT without using XLib/libX11 as a library. XLib/libX11's headers are still used, and a minimal
configure.ac
has been added to eliminate overly-enthusiastic configure-time dependencies that aren't actually required to obtain the headers.This also means that we eliminate XLib/libX11 as required shared libraries at runtime, which is desirable.
See commit messages for more details.
Reviewers: I am least sure about the minimal
configure.ac
, as I'm not too familiar with the autoconf syntax. Any improvements w/re robustness would be welcome.