ERROR: ld.so: object LD_PRELOAD cannot be preloaded: ignored

后端 未结 5 1853
南方客
南方客 2021-02-05 01:01

I am using ubuntu 12.04. Every time I start my bash terminal and every time when I finish typing a command(and press enter) , I get this message:

ERROR:

相关标签:
5条回答
  • 2021-02-05 01:16

    If you want to make sure that the library is loaded if and only if the program lunar-calendar-gtk is launched, you can apply this:

    You set the environment variable per command by prefixing the command with it:

    $ LD_PRELOAD="liblunar-calendar-preload.so" printenv "LD_PRELOAD"
    liblunar-calendar-preload.so
    $ printenv "LD_PRELOAD"
    $
    

    You can then choose to put this in a shell script and make lunar-calendar-gtk a symlink to this shell script, replaceing the original referencee. This effectively makes sure that the library is loaded everytime the original application is executed.

    You will have to rename the original lunar-calendar-gtk to something else, which might not be too intriguing as it possibly may cause issues with uninstallation and upgrading. However, I found it useful with a former version of Skype.

    0 讨论(0)
  • 2021-02-05 01:30

    It means the path you input caused an error. In your LD_PRELOAD command, modify the path like the error tips:

    /usr/lib/liblunar-calendar-preload.so
    
    0 讨论(0)
  • 2021-02-05 01:31

    The linker takes some environment variables into account. one is LD_PRELOAD

    from man 8 ld-linux:

    LD_PRELOAD
              A whitespace-separated list of additional,  user-specified,  ELF
              shared  libraries  to  be loaded before all others.  This can be
              used  to  selectively  override  functions   in   other   shared
              libraries.   For  setuid/setgid  ELF binaries, only libraries in
              the standard search directories that are  also  setgid  will  be
              loaded.
    

    Therefore the linker will try to load libraries listed in the LD_PRELOAD variable before others are loaded.

    What could be the case that inside the variable is listed a library that can't be pre-loaded. look inside your .bashrc or .bash_profile environment where the LD_PRELOAD is set and remove that library from the variable.

    0 讨论(0)
  • 2021-02-05 01:36

    You can check /etc/ld.so.preload file content

    I fix it by:

    echo "" > /etc/ld.so.preload

    0 讨论(0)
  • 2021-02-05 01:38

    Thanks for the responses. I think I've solved the problem just now.

    Since LD_PRELOAD is for setting some library proloaded, I check the library that ld preloads with LD_PRELOAD, one of which is "liblunar-calendar-preload.so", that is not existing in the path "/usr/lib/liblunar-calendar-preload.so", but I find a similar library "liblunar-calendar-preload-2.0.so", which is a difference version of the former one.

    Then I guess maybe liblunar-calendar-preload.so was updated to a 2.0 version when the system updated, leaving LD_PRELOAD remain to be "/usr/lib/liblunar-calendar-preload.so". Thus the preload library name was not updated to the newest version.

    To avoid changing environment variable, I create a symbolic link under the path "/usr/lib"

    sudo ln -s liblunar-calendar-preload-2.0.so liblunar-calendar-preload.so
    

    Then I restart bash, the error is gone.

    0 讨论(0)
提交回复
热议问题