LD_PRELOAD multiple interdependent libraries










0















I Have Libraries with a tree of dependencies, i.e. some of the dependencies have other dependencies I want to Preload. How can I do this?



LD_PRELOAD 
/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicudata.so.60
/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicuuc.so.60
/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicui18n.so.60
/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5
MyApp


The LD_PRELOAD call contains is sorted, such that the dependencies are listed before the depending library.



The Linker throws the following error:



ERROR: ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


Can the libraries be preloaded to fulfil the dependencies in the correct order?










share|improve this question


























    0















    I Have Libraries with a tree of dependencies, i.e. some of the dependencies have other dependencies I want to Preload. How can I do this?



    LD_PRELOAD 
    /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicudata.so.60
    /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicuuc.so.60
    /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicui18n.so.60
    /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5
    MyApp


    The LD_PRELOAD call contains is sorted, such that the dependencies are listed before the depending library.



    The Linker throws the following error:



    ERROR: ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


    Can the libraries be preloaded to fulfil the dependencies in the correct order?










    share|improve this question
























      0












      0








      0








      I Have Libraries with a tree of dependencies, i.e. some of the dependencies have other dependencies I want to Preload. How can I do this?



      LD_PRELOAD 
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicudata.so.60
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicuuc.so.60
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicui18n.so.60
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5
      MyApp


      The LD_PRELOAD call contains is sorted, such that the dependencies are listed before the depending library.



      The Linker throws the following error:



      ERROR: ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


      Can the libraries be preloaded to fulfil the dependencies in the correct order?










      share|improve this question














      I Have Libraries with a tree of dependencies, i.e. some of the dependencies have other dependencies I want to Preload. How can I do this?



      LD_PRELOAD 
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicudata.so.60
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicuuc.so.60
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libicui18n.so.60
      /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5
      MyApp


      The LD_PRELOAD call contains is sorted, such that the dependencies are listed before the depending library.



      The Linker throws the following error:



      ERROR: ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


      Can the libraries be preloaded to fulfil the dependencies in the correct order?







      shared-libraries ld dynamic-library ld-preload






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 16:15









      danbadanba

      512827




      512827






















          1 Answer
          1






          active

          oldest

          votes


















          1














          This error:



          ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' 
          from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


          means that the dynamic loader tried to open the library and failed.



          There are several possible reasons for this failure:



          1. The file doesn't exist (use ls -L /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5 to confirm that it does

          2. The file is for the wrong architecture (e.g. 32-bit ELF when MyApp is 64-bit, or vice versa). Use file MyApp and file libQt5Core.so.5 to confirm that they match.

          3. Something else. Perhaps MyApp was linked with newlib or uClibc, but libQt5Core.so.5 was built with GLIBC (or vice versa).





          share|improve this answer























          • In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

            – danba
            Nov 16 '18 at 6:12











          • @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

            – Employed Russian
            Nov 16 '18 at 6:45











          • I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

            – danba
            Nov 16 '18 at 6:58











          • @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

            – Employed Russian
            Nov 16 '18 at 15:06











          • Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

            – danba
            Nov 19 '18 at 13:13










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323623%2fld-preload-multiple-interdependent-libraries%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          This error:



          ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' 
          from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


          means that the dynamic loader tried to open the library and failed.



          There are several possible reasons for this failure:



          1. The file doesn't exist (use ls -L /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5 to confirm that it does

          2. The file is for the wrong architecture (e.g. 32-bit ELF when MyApp is 64-bit, or vice versa). Use file MyApp and file libQt5Core.so.5 to confirm that they match.

          3. Something else. Perhaps MyApp was linked with newlib or uClibc, but libQt5Core.so.5 was built with GLIBC (or vice versa).





          share|improve this answer























          • In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

            – danba
            Nov 16 '18 at 6:12











          • @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

            – Employed Russian
            Nov 16 '18 at 6:45











          • I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

            – danba
            Nov 16 '18 at 6:58











          • @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

            – Employed Russian
            Nov 16 '18 at 15:06











          • Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

            – danba
            Nov 19 '18 at 13:13















          1














          This error:



          ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' 
          from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


          means that the dynamic loader tried to open the library and failed.



          There are several possible reasons for this failure:



          1. The file doesn't exist (use ls -L /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5 to confirm that it does

          2. The file is for the wrong architecture (e.g. 32-bit ELF when MyApp is 64-bit, or vice versa). Use file MyApp and file libQt5Core.so.5 to confirm that they match.

          3. Something else. Perhaps MyApp was linked with newlib or uClibc, but libQt5Core.so.5 was built with GLIBC (or vice versa).





          share|improve this answer























          • In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

            – danba
            Nov 16 '18 at 6:12











          • @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

            – Employed Russian
            Nov 16 '18 at 6:45











          • I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

            – danba
            Nov 16 '18 at 6:58











          • @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

            – Employed Russian
            Nov 16 '18 at 15:06











          • Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

            – danba
            Nov 19 '18 at 13:13













          1












          1








          1







          This error:



          ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' 
          from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


          means that the dynamic loader tried to open the library and failed.



          There are several possible reasons for this failure:



          1. The file doesn't exist (use ls -L /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5 to confirm that it does

          2. The file is for the wrong architecture (e.g. 32-bit ELF when MyApp is 64-bit, or vice versa). Use file MyApp and file libQt5Core.so.5 to confirm that they match.

          3. Something else. Perhaps MyApp was linked with newlib or uClibc, but libQt5Core.so.5 was built with GLIBC (or vice versa).





          share|improve this answer













          This error:



          ld.so: object '/opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5' 
          from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.


          means that the dynamic loader tried to open the library and failed.



          There are several possible reasons for this failure:



          1. The file doesn't exist (use ls -L /opt/yocto/2.5.1/sysroots/core2-64-poky-linux/usr/lib/libQt5Core.so.5 to confirm that it does

          2. The file is for the wrong architecture (e.g. 32-bit ELF when MyApp is 64-bit, or vice versa). Use file MyApp and file libQt5Core.so.5 to confirm that they match.

          3. Something else. Perhaps MyApp was linked with newlib or uClibc, but libQt5Core.so.5 was built with GLIBC (or vice versa).






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 5:34









          Employed RussianEmployed Russian

          127k20173239




          127k20173239












          • In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

            – danba
            Nov 16 '18 at 6:12











          • @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

            – Employed Russian
            Nov 16 '18 at 6:45











          • I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

            – danba
            Nov 16 '18 at 6:58











          • @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

            – Employed Russian
            Nov 16 '18 at 15:06











          • Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

            – danba
            Nov 19 '18 at 13:13

















          • In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

            – danba
            Nov 16 '18 at 6:12











          • @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

            – Employed Russian
            Nov 16 '18 at 6:45











          • I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

            – danba
            Nov 16 '18 at 6:58











          • @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

            – Employed Russian
            Nov 16 '18 at 15:06











          • Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

            – danba
            Nov 19 '18 at 13:13
















          In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

          – danba
          Nov 16 '18 at 6:12





          In my case the library can't be preloaded because it itself requires a dynamic library which is "not found" in the LD_LIBRARY_PATH. Unfortunate I can't change the LD_LIBRARY_PATH to include the dependencies.

          – danba
          Nov 16 '18 at 6:12













          @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

          – Employed Russian
          Nov 16 '18 at 6:45





          @danba I am confused: if you know the reason libQt5Core is not loading, why didn't you say so, and why don't you add whatever library it requires to the LD_PRELOAD list?

          – Employed Russian
          Nov 16 '18 at 6:45













          I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

          – danba
          Nov 16 '18 at 6:58





          I was trying to explain that the shared Library is missing dependencies in the question. The LD_PRELOAD list in the question does contain all dependencies, they're just not interpreted correctly it seems.

          – danba
          Nov 16 '18 at 6:58













          @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

          – Employed Russian
          Nov 16 '18 at 15:06





          @danba Your theory of why this doesn't work is probably incorrect. How do you know that "the library can't be preloaded because it itself requires a dynamic library which is "not found"" ? Setting LD_DEBUG=files,libs could provide additional info.

          – Employed Russian
          Nov 16 '18 at 15:06













          Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

          – danba
          Nov 19 '18 at 13:13





          Thanks for the LD_DEBUG=files,libs suggestion. It turns out the environment was dirty on that machine. Your answer, by the way, summarizes possible issues nicely.

          – danba
          Nov 19 '18 at 13:13



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323623%2fld-preload-multiple-interdependent-libraries%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Barbados

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3