What does “unused direct dependencies” mean?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

up vote
1
down vote

favorite

When using the ldd command there is an option, -u, to

print unused direct dependencies

as stated in the on-line help.

For example:

ldd  -u /bin/gcc
Unused direct dependencies:
        /lib64/libm.so.6
        /lib64/ld-linux-x86-64.so.2

What are “unused direct dependencies”? Why are they unused? Why are they dependencies?

share|improve this question

    up vote
    1
    down vote

    favorite

    When using the ldd command there is an option, -u, to

    print unused direct dependencies

    as stated in the on-line help.

    For example:

    ldd  -u /bin/gcc
    Unused direct dependencies:
            /lib64/libm.so.6
            /lib64/ld-linux-x86-64.so.2
    

    What are “unused direct dependencies”? Why are they unused? Why are they dependencies?

    share|improve this question

      up vote
      1
      down vote

      favorite

      up vote
      1
      down vote

      favorite

      When using the ldd command there is an option, -u, to

      print unused direct dependencies

      as stated in the on-line help.

      For example:

      ldd  -u /bin/gcc
      Unused direct dependencies:
              /lib64/libm.so.6
              /lib64/ld-linux-x86-64.so.2
      

      What are “unused direct dependencies”? Why are they unused? Why are they dependencies?

      share|improve this question

      When using the ldd command there is an option, -u, to

      print unused direct dependencies

      as stated in the on-line help.

      For example:

      ldd  -u /bin/gcc
      Unused direct dependencies:
              /lib64/libm.so.6
              /lib64/ld-linux-x86-64.so.2
      

      What are “unused direct dependencies”? Why are they unused? Why are they dependencies?

      shared-library ld

      share|improve this question

      share|improve this question

      share|improve this question

      share|improve this question

      edited Oct 3 at 15:31

      Stephen Kitt

      149k23331397

      149k23331397

      asked Oct 3 at 15:00

      sebelk

      1,72611633

      1,72611633

          1 Answer
          1

          active

          oldest

          votes

          up vote
          3
          down vote

          accepted

          They are dependencies because the binary lists them as dependencies, as “NEEDED” entries in its dynamic section:

          readelf -d /usr/bin/gcc
          

          will show you the libraries gcc requests.

          They are unused because gcc doesn’t actually need any of the symbols exported by the libraries in question. In ld-linux-x86-64.so.2’s case, that’s normal, because that’s the interpreter. In libm’s case, that usually results from an unconditional -lm, without corresponding linker options to drop unused libraries.

          In many cases this results from the limited granularity of build tools; in particular, linking e.g. GNOME libraries tends to result in long lists of libraries, which aren’t always all needed as direct dependencies (but end up in the tree of library dependencies anyway). It’s usually better to try to avoid having unused dependencies, to simplify dependency processing (both by the runtime linker, and by package management tools). It’s safe to ignore libm though since that’s tied to libc anyway.

          share|improve this answer

            Your Answer

            StackExchange.ready(function() {
            var channelOptions = {
            tags: “”.split(” “),
            id: “106”
            };
            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’,
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: “”,
            onDemand: true,
            discardSelector: “.discard-answer”
            ,immediatelyShowMarkdownHelp:true
            });

            }
            });

             
            draft saved
            draft discarded

            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2funix.stackexchange.com%2fquestions%2f473014%2fwhat-does-unused-direct-dependencies-mean%23new-answer’, ‘question_page’);
            }
            );

            Post as a guest

            1 Answer
            1

            active

            oldest

            votes

            1 Answer
            1

            active

            oldest

            votes

            active

            oldest

            votes

            active

            oldest

            votes

            up vote
            3
            down vote

            accepted

            They are dependencies because the binary lists them as dependencies, as “NEEDED” entries in its dynamic section:

            readelf -d /usr/bin/gcc
            

            will show you the libraries gcc requests.

            They are unused because gcc doesn’t actually need any of the symbols exported by the libraries in question. In ld-linux-x86-64.so.2’s case, that’s normal, because that’s the interpreter. In libm’s case, that usually results from an unconditional -lm, without corresponding linker options to drop unused libraries.

            In many cases this results from the limited granularity of build tools; in particular, linking e.g. GNOME libraries tends to result in long lists of libraries, which aren’t always all needed as direct dependencies (but end up in the tree of library dependencies anyway). It’s usually better to try to avoid having unused dependencies, to simplify dependency processing (both by the runtime linker, and by package management tools). It’s safe to ignore libm though since that’s tied to libc anyway.

            share|improve this answer

              up vote
              3
              down vote

              accepted

              They are dependencies because the binary lists them as dependencies, as “NEEDED” entries in its dynamic section:

              readelf -d /usr/bin/gcc
              

              will show you the libraries gcc requests.

              They are unused because gcc doesn’t actually need any of the symbols exported by the libraries in question. In ld-linux-x86-64.so.2’s case, that’s normal, because that’s the interpreter. In libm’s case, that usually results from an unconditional -lm, without corresponding linker options to drop unused libraries.

              In many cases this results from the limited granularity of build tools; in particular, linking e.g. GNOME libraries tends to result in long lists of libraries, which aren’t always all needed as direct dependencies (but end up in the tree of library dependencies anyway). It’s usually better to try to avoid having unused dependencies, to simplify dependency processing (both by the runtime linker, and by package management tools). It’s safe to ignore libm though since that’s tied to libc anyway.

              share|improve this answer

                up vote
                3
                down vote

                accepted

                up vote
                3
                down vote

                accepted

                They are dependencies because the binary lists them as dependencies, as “NEEDED” entries in its dynamic section:

                readelf -d /usr/bin/gcc
                

                will show you the libraries gcc requests.

                They are unused because gcc doesn’t actually need any of the symbols exported by the libraries in question. In ld-linux-x86-64.so.2’s case, that’s normal, because that’s the interpreter. In libm’s case, that usually results from an unconditional -lm, without corresponding linker options to drop unused libraries.

                In many cases this results from the limited granularity of build tools; in particular, linking e.g. GNOME libraries tends to result in long lists of libraries, which aren’t always all needed as direct dependencies (but end up in the tree of library dependencies anyway). It’s usually better to try to avoid having unused dependencies, to simplify dependency processing (both by the runtime linker, and by package management tools). It’s safe to ignore libm though since that’s tied to libc anyway.

                share|improve this answer

                They are dependencies because the binary lists them as dependencies, as “NEEDED” entries in its dynamic section:

                readelf -d /usr/bin/gcc
                

                will show you the libraries gcc requests.

                They are unused because gcc doesn’t actually need any of the symbols exported by the libraries in question. In ld-linux-x86-64.so.2’s case, that’s normal, because that’s the interpreter. In libm’s case, that usually results from an unconditional -lm, without corresponding linker options to drop unused libraries.

                In many cases this results from the limited granularity of build tools; in particular, linking e.g. GNOME libraries tends to result in long lists of libraries, which aren’t always all needed as direct dependencies (but end up in the tree of library dependencies anyway). It’s usually better to try to avoid having unused dependencies, to simplify dependency processing (both by the runtime linker, and by package management tools). It’s safe to ignore libm though since that’s tied to libc anyway.

                share|improve this answer

                share|improve this answer

                share|improve this answer

                answered Oct 3 at 15:13

                Stephen Kitt

                149k23331397

                149k23331397

                     
                    draft saved
                    draft discarded

                     

                    draft saved

                    draft discarded

                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin(‘.new-post-login’, ‘https%3a%2f%2funix.stackexchange.com%2fquestions%2f473014%2fwhat-does-unused-direct-dependencies-mean%23new-answer’, ‘question_page’);
                    }
                    );

                    Post as a guest

                    Related Post

                    Leave a Reply

                    Your email address will not be published. Required fields are marked *