Ubuntu – How to set .so to be available for LD_PRELOAD

bashcommand lineenvironment-variables

I had an issue when I ran Docker commands:

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.

After some research I learned that a library provided in the LD_PRELOAD environment variable could not be found. When I run:

env | grep LD_

I get back:

LD_PRELOAD=libgtk3-nocsd.so.0

After installing this libgtk3 library via apt-get, I have it located here:

/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0

What's the proper way of setting LD_PRELOAD? Should I overwrite it with the full path to the library, or should I somehow copy this library to make it available globally and leave LD_PRELOAD to it's current value.

I tried adding this to my ~/.profile:

unset LD_PRELOAD
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0

But when I reload my profile, I get back:

LD_PRELOAD=libgtk3-nocsd.so.0:/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0

For some reason, the unset doesn't clear the variable and simply append my path to the existing value and that doesn't work.

Best Answer

I have the same issue. I tested running LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 in the terminal and it solved the problem for that terminal session. But, when i restarted the terminal, the issue come back.

Thanks to Sanjay Prajapat, i added the command to .bashrc file in home folder and it solved the issue permanently. However, instead of adding the following line:

export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/

this one worked for me:

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0

(Sorry if there are some grammar mistake).

Edit:

Make sure you have libgtk3-nocsd.so.0 in /usr/lib/x86_64-linux-gnu
Search it in nautilus

If you didn't have it, try sudo apt-get install gtk3-nocsd

Related Question