Skip to content

Commit

Permalink
Make Linux updater work with older libc
Browse files Browse the repository at this point in the history
With this change it requires 2.25 instead of 2.28. This was achieved by
overwriting the results of 2 feature tests (for statx and renameat2),
and patching a file which used statx regardless of the test.
  • Loading branch information
slipher committed Feb 6, 2021
1 parent a67d235 commit 8fec9af
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ RUN make -j`nproc` && make install_sw && rm -rf /build-ssl
# Build Qt #
############
WORKDIR /build-qt
# We set the results of the renameat2 and statx feature tests to failure with sed below, but the
# statx test is actually ignored so this extra patch is needed to disable it.
COPY disable-statx.patch .
ENV UPDATER_MODULES=qtbase,qtquickcontrols,qtquickcontrols2,qtsvg,qtgraphicaleffects
RUN curl -LO https://download.qt.io/archive/qt/5.14/5.14.2/single/qt-everywhere-src-5.14.2.tar.xz && \
curl -L https://download.qt.io/archive/qt/5.14/5.14.2/single/md5sums.txt | md5sum --check --ignore-missing && \
tar -xJf qt-everywhere-src-5.14.2.tar.xz && \
cd qt-everywhere-src-5.14.2 && \
sed -i -E 's/tests[.](statx|renameat2)/false/' qtbase/src/corelib/configure.json && \
patch qtbase/src/corelib/io/qfilesystemengine_unix.cpp < ../disable-statx.patch && \
OPENSSL_LIBS='-L/openssl/lib -lssl -lcrypto -lpthread -ldl' ./configure -opensource -confirm-license -release -optimize-size -no-shared -static --c++std=14 -nomake tests -nomake tools -nomake examples -no-gif -no-icu -no-glib -no-qml-debug -opengl desktop -no-eglfs -no-opengles3 -no-angle -no-egl -qt-xcb -xkbcommon -dbus-runtime -qt-freetype -qt-pcre -qt-harfbuzz -qt-libpng -qt-libjpeg -system-zlib -I /openssl/include -openssl-linked -prefix /qt && \
bash -c "make -j`nproc` module-{$UPDATER_MODULES} && make module-{$UPDATER_MODULES}-install_subtargets" && \
rm -rf /build-qt
Expand All @@ -64,6 +69,11 @@ RUN set -e; for D in . quazip fluid; do cd /updater2/$D && git clean -dXff; done
WORKDIR /build
RUN /qt/bin/qmake -config release QMAKE_LFLAGS+="-no-pie" /updater2 && make -j`nproc`
RUN mv updater2 updater2-nonstripped && strip updater2-nonstripped -o updater2
# Version check: do not depend on glibc > 2.26
RUN echo GLIBC_2.26 > target_version && \
grep -aoE 'GLIBC_[0-9.]+' updater2 > symbol_versions && \
cat target_version symbol_versions | sort -V | tail -1 > max_version && \
diff -q target_version max_version
ARG release
RUN if [ -n "$release" ]; then cp updater2 UnvanquishedUpdater && 7z -tzip -mx=9 a UnvUpdaterLinux.zip UnvanquishedUpdater; fi
ENV zipfile=${release:+UnvUpdaterLinux.zip}
Expand Down
15 changes: 15 additions & 0 deletions disable-statx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- qtbase/src/corelib/io/qfilesystemengine_unix.cpp 2020-03-27 04:49:31.000000000 -0500
+++ qtbase/src/corelib/io/qfilesystemengine_unix.cpp 2021-02-05 14:22:53.044477900 -0600
@@ -95,12 +95,10 @@
#endif
#endif

-#if defined(Q_OS_ANDROID)
// statx() is disabled on Android because quite a few systems
// come with sandboxes that kill applications that make system calls outside a
// whitelist and several Android vendors can't be bothered to update the list.
# undef STATX_BASIC_STATS
-#endif

#ifndef STATX_ALL
struct statx { mode_t stx_mode; }; // dummy

0 comments on commit 8fec9af

Please sign in to comment.