adamrehn / ue4-docker

Windows and Linux containers for Unreal Engine 4
https://docs.adamrehn.com/ue4-docker/
MIT License
784 stars 171 forks source link

glibc DSO patch causes "Relink `/usr/lib/x86_64-linux-gnu/libpixman-1.so.0' with `/lib/x86_64-linux-gnu/libm.so.6' for IFUNC symbol `sin'" error #209

Closed slonopotamus closed 2 years ago

slonopotamus commented 2 years ago

Way to reproduce:

docker run --rm -ti -u root adamrehn/ue4-build-prerequisites:opengl /bin/sh -c 'apt-get update && apt-get install -y libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libc6 libcairo2 libcap2 libcups2 libdrm2 libevdev2 libexpat1 libfontconfig1 libfreetype6 libgbm1 libglib2.0-0 libgtk-3-0 libnss3 libpam0g libpango-1.0-0 libpci3 libpcre3 libpixman-1-0 libspeechd2 libsqlite3-0 libstdc++6 libuuid1 libwayland-egl1-mesa libx11-6 libx11-xcb1 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxkbcommon-dev libxrandr2 libxrender1 libxtst6 zlib1g'

If this command is ran against ue4-build-prerequisites built WITHOUT --opt enable_dso_patch, it finishes successfully.

If this command is ran against ue4-build-prerequisites built WITH --opt enable_dso_patch, it fails with:

Setting up libgdk-pixbuf2.0-0:amd64 (2.36.11-2) ...
/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: Relink `/usr/lib/x86_64-linux-gnu/libpixman-1.so.0' with `/lib/x86_64-linux-gnu/libm.so.6' for IFUNC symbol `sin'
Segmentation fault
slonopotamus commented 2 years ago

I am not able to do anything with this. Note that this was reproed on Ubuntu 18.04 that required the most intensive changes to glibc-dso patches so they could be applied. Possibly this issue is not present in 20.04. And the best approach is just to wait until Ubuntu 22.04 is released and use it without any patches, since it contains glibc 2.35 that already has fix included.

slonopotamus commented 2 years ago

Some more issues with patched glibc:

https://github.com/Winetricks/winetricks/issues/1919 https://github.com/frostworx/steamtinkerlaunch/issues/517

wl2776 commented 2 years ago

I'm on Ubuntu 20.04, and have met this issue after recent updates.

jamoflaw commented 2 years ago

I'm on Ubuntu 20.04, and have met this issue after recent updates.

Same, ends up breaking the gdk-pixbuf-query-loader for me which stops gnome from loading images correctly :(

wl2776 commented 2 years ago

I'm on Ubuntu 20.04, and have met this issue after recent updates.

Same, ends up breaking the gdk-pixbuf-query-loader for me which stops gnome from loading images correctly :(

For me this forbids launching any GTK application

jamoflaw commented 2 years ago

Yeah same, compiling up a new version without the patch so I can rerun the pixbuf cache, I'll post up here when it's fixed

slonopotamus commented 2 years ago

Yeah same, compiling up a new version without the patch so I can rerun the pixbuf cache, I'll post up here when it's fixed

  1. You can just rollback to official Ubuntu glibc version
  2. Do you want to say that you observe issues even when GLIBC_TUNABLES env variable is NOT set?
jamoflaw commented 2 years ago

Yeah that's what's interesting, btw I have no idea how to roll back to the normal version with out apt wanting to uninstall all the dependencies of glibc (basically a lot!) - hence upgrading (basically bumping version on the original package)

So without the tuneables flag on it still complains, reverting to the original glibc just let's it work - real odd

slonopotamus commented 2 years ago

Weird. I'll review patch to try to figure out how it manages to affect behavior when GLIBC_TUNABLES is unset. The plan for that without GLIBC_TUNABLES glibc behavior is 100% identical to unpatched version.

wl2776 commented 2 years ago

I have no idea how to roll back to the normal version with out apt wanting to uninstall all the dependencies of glibc

Here is the hint how to do it (not a complete solution, as I don't know details of your system)

  1. Find out all existing versions of libc6

    $ apt-cache policy libc6
    libc6:
     Installed: 2.31-0ubuntu9.9
     Candidate: 2.31-0ubuntu9.9
     Version table:
    *** 2.31-0ubuntu9.9 500
           500 http://ru.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
           100 /var/lib/dpkg/status
        2.31-0ubuntu9.7 500
           500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        2.31-0ubuntu9 500
           500 http://ru.archive.ubuntu.com/ubuntu focal/main amd64 Packages

    Alternatively you can look in GUI package manager (Muon on KDE). I have 3 alternatives: 2.31-0ubuntu9.9, ...9.7 and ...9.

  2. Install most recent: sudo apt install libc=2.31-0ubuntu9.9 ... In place of ... you should put all other packages that have been updated from that PPA.

jamoflaw commented 2 years ago

Ahh I bet it's cus I'm just downgrading libc6 rather than each individual, thanks! That will save 4 hours each time I have to recompile it!

SonnyPoint commented 2 years ago

It seems that preloading the libm.so.6 can do the workaround.

Without preloading:

ue4@e648513f1f3c:~$ /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders 
/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: Relink `/usr/lib/x86_64-linux-gnu/libpixman-1.so.0' with `/lib/x86_64-linux-gnu/libm.so.6' for IFUNC symbol `sin'
Segmentation fault (core dumped)

With preloading:

ue4@e648513f1f3c:~$ LD_PRELOAD=/lib/x86_64-linux-gnu/libm.so.6 /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders 
# GdkPixbuf Image Loader Modules file
# Automatically generated file, do not edit
# Created by gdk-pixbuf-query-loaders from gdk-pixbuf-2.36.11
#
# LoaderDir = /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders
#
"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so"
"ani" 4 "gdk-pixbuf" "Windows animated cursor" "LGPL"
"application/x-navi-animation" ""
"ani" ""
"RIFF    ACON" "    xxxx    " 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so"
"bmp" 5 "gdk-pixbuf" "BMP" "LGPL"
"image/bmp" "image/x-bmp" "image/x-MS-bmp" ""
"bmp" ""
"BM" "" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.so"
"gif" 4 "gdk-pixbuf" "GIF" "LGPL"
"image/gif" ""
"gif" ""
"GIF8" "" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.so"
"icns" 4 "gdk-pixbuf" "MacOS X icon" "GPL"
"image/x-icns" ""
"icns" ""
"icns" "" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ico.so"
"ico" 5 "gdk-pixbuf" "Windows icon" "LGPL"
"image/x-icon" "image/x-ico" "image/x-win-bitmap" "image/vnd.microsoft.icon" "application/ico" "image/ico" "image/icon" "text/ico" ""
"ico" "cur" ""
"  \001   " "zz znz" 100
"  \002   " "zz znz" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so"
"jpeg" 5 "gdk-pixbuf" "JPEG" "LGPL"
"image/jpeg" ""
"jpeg" "jpe" "jpg" ""
"\377\330" "" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so"
"png" 5 "gdk-pixbuf" "PNG" "LGPL"
"image/png" ""
"png" ""
"\211PNG\r\n\032\n" "" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pnm.so"
"pnm" 4 "gdk-pixbuf" "PNM/PBM/PGM/PPM" "LGPL"
"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" ""
"pnm" "pbm" "pgm" "ppm" ""
"P1" "" 100
"P2" "" 100
"P3" "" 100
"P4" "" 100
"P5" "" 100
"P6" "" 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.so"
"qtif" 4 "gdk-pixbuf" "QuickTime" "LGPL"
"image/x-quicktime" "image/qtif" ""
"qtif" "qif" ""
"abcdidsc" "xxxx    " 100
"abcdidat" "xxxx    " 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so"
"svg" 6 "gdk-pixbuf" "Scalable Vector Graphics" "LGPL"
"image/svg+xml" "image/svg" "image/svg-xml" "image/vnd.adobe.svg+xml" "text/xml-svg" "image/svg+xml-compressed" ""
"svg" "svgz" "svg.gz" ""
" <svg" "*    " 100
" <!DOCTYPE svg" "*             " 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.so"
"tga" 4 "gdk-pixbuf" "Targa" "LGPL"
"image/x-tga" ""
"tga" "targa" ""
" \001\001" "x  " 100
" \001\t" "x  " 100
"  \002" "xz " 99
"  \003" "xz " 100
"  \n" "xz " 100
"  \v" "xz " 100

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so"
"tiff" 5 "gdk-pixbuf" "TIFF" "LGPL"
"image/tiff" ""
"tiff" "tif" ""
"MM *" "  z " 100
"II* " "   z" 100
"II* \020   CR\002 " "   z zzz   z" 0

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xbm.so"
"xbm" 4 "gdk-pixbuf" "XBM" "LGPL"
"image/x-xbitmap" ""
"xbm" ""
"#define " "" 100
"/*" "" 50

"/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.so"
"xpm" 4 "gdk-pixbuf" "XPM" "LGPL"
"image/x-xpixmap" ""
"xpm" ""
"/* XPM */" "" 100

Without preloading, backtrace with gdb:

ue4@e648513f1f3c:~$ gdb /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders 
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders 
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders: Relink `/usr/lib/x86_64-linux-gnu/libpixman-1.so.0' with `/lib/x86_64-linux-gnu/libm.so.6' for IFUNC symbol `sin'

Program received signal SIGSEGV, Segmentation fault.
0x00007f9956ae8307 in ?? ()
(gdb) bt
#0  0x00007f9956ae8307 in ?? ()
#1  0x00007f995ae9b35a in elf_machine_rela (skip_ifunc=0, reloc_addr_arg=0x7f9956122fb0, version=<optimized out>, sym=<optimized out>, 
    reloc=0x7f9955e88968, map=0x55a4b02236d0) at ../sysdeps/x86_64/dl-machine.h:332
#2  elf_dynamic_do_Rela (skip_ifunc=0, lazy=<optimized out>, nrelative=<optimized out>, relsize=<optimized out>, reladdr=<optimized out>, 
    map=0x55a4b02236d0) at do-rel.h:137
#3  _dl_relocate_object (scope=<optimized out>, reloc_mode=reloc_mode@entry=0, consider_profiling=<optimized out>, consider_profiling@entry=0)
    at dl-reloc.c:258
#4  0x00007f995aea324d in dl_open_worker (a=a@entry=0x7ffdc1a81890) at dl-open.c:381
#5  0x00007f995a27616f in __GI__dl_catch_exception (exception=0x7ffdc1a81870, operate=0x7f995aea2f60 <dl_open_worker>, args=0x7ffdc1a81890)
    at dl-error-skeleton.c:196
#6  0x00007f995aea296a in _dl_open (file=0x55a4b0213660 "/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so", mode=-2147483390, 
    caller_dlopen=0x7f995ac8b6d9 <g_module_open+265>, nsid=<optimized out>, argc=1, argv=<optimized out>, env=0x7ffdc1a81d48) at dl-open.c:604
#7  0x00007f9959f0bf96 in dlopen_doit (a=a@entry=0x7ffdc1a81ac0) at dlopen.c:66
#8  0x00007f995a27616f in __GI__dl_catch_exception (exception=exception@entry=0x7ffdc1a81a60, operate=0x7f9959f0bf40 <dlopen_doit>, args=0x7ffdc1a81ac0)
    at dl-error-skeleton.c:196
#9  0x00007f995a2761ff in __GI__dl_catch_error (objname=0x55a4b0217b60, errstring=0x55a4b0217b68, mallocedp=0x55a4b0217b58, operate=<optimized out>, 
    args=<optimized out>) at dl-error-skeleton.c:215
#10 0x00007f9959f0c745 in _dlerror_run (operate=operate@entry=0x7f9959f0bf40 <dlopen_doit>, args=args@entry=0x7ffdc1a81ac0) at dlerror.c:162
#11 0x00007f9959f0c051 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#12 0x00007f995ac8b6d9 in g_module_open () from /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0
#13 0x000055a4aee014dc in ?? ()
#14 0x000055a4aee0129f in ?? ()
#15 0x00007f995a130c87 in __libc_start_main (main=0x55a4aee01010, argc=1, argv=0x7ffdc1a81d38, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffdc1a81d28) at ../csu/libc-start.c:310
#16 0x000055a4aee0136a in ?? ()
(gdb) 
ibbles commented 2 years ago

To fix my broken GTK applications on Ubuntu 20.04 I ran the following, based on SonnyPoint's preload suggestion above.

sudo LD_PRELOAD=/lib/x86_64-linux-gnu/libm.so.6 /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache

After this I could open e.g. eog again.

ggand0 commented 1 year ago

@ibbles I had the exact same problem on Ubuntu 20.04 today; couldn't open any GTK native apps like Files, Terminal and wasted like 7 hours trying to fix it. Then, I remembered that I had applied the glibc DSO patch in the past to speed up the boot time of UE5. You're a true lifesaver! After running the command you provided, everything is back to normal. Thank you so much!