You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LD_PRELOAD is ignored when you run setuid binaries, unset by sudo, while /etc/ld.so.preload is honored in all these cases. Also, in some cases other entities (like IDEs) may try to make a clean environment, which will also remove gtk3-nocsd from the preloaded libraries list.
So I think it'd be good to mention this approach in the README.
The text was updated successfully, but these errors were encountered:
Actually, I've found that all this preloading business conflicts with some other libraries that expect to be loaded before all: e.g., libasan. Thus, both LD_PRELOAD and /etc/ld.so.preload are unacceptable to me.
But I've devised a better way, which I've implemented on my Ubuntu 19.04 system, and which works both system-wide (e.g. for root user), as well as without conflicts with libasan. Here's what I did:
origGLIB=$(ldd `which gtk-update-icon-cache`| sed -n 's@^\s*libglib-2.0.so.0 => \([^ ]\+\).*@\1@p')
libdir=${origGLIB%/libglib-2.0.so.0}/gtk3-nocsd
# Optional (if we want to disable CSDs unconditionally; I did)
sed -i 's@g_getenv ("GTK_CSD")@"0"@' gtk3-nocsd.c
# Add libglib-2.0.so.0 to NEEDED list, even though it's not statically used. We'll# change reference to its actual soname to the name of symlink we'll create.
sed -i "s@.*-soname,libgtk3-no.*@\0 -Wl,-rpath,$libdir -Wl,--no-as-needed -lglib-2.0@"\
Makefile
make
# Avoid patchelf --add-needed/--replace-needed: they'll likely corrupt the# binary (at least in patchelf 0.10).# Just rely on the fact that libgtk3-nocsd.so.0 only references the original glib-2.0# library, so we can change _all_ the references to it to the symlink name.
sed -i '[email protected]@libglib2-orig.so@g' libgtk3-nocsd.so.0
sudo sh -c "mkdir -pv '$libdir' && cp -vi libgtk3-nocsd.so.0 '$libdir'/libglib-2.0.so.0 && ln -sv '$origGLIB' '$libdir'/libglib2-orig.so && echo '$libdir' > /etc/ld.so.conf.d/00-gtk3-nocsd.conf && ldconfig"
LD_PRELOAD
is ignored when you run setuid binaries, unset bysudo
, while/etc/ld.so.preload
is honored in all these cases. Also, in some cases other entities (like IDEs) may try to make a clean environment, which will also removegtk3-nocsd
from the preloaded libraries list.So I think it'd be good to mention this approach in the README.
The text was updated successfully, but these errors were encountered: