ldconfig cannot link to specific files

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












2















I installed ATLAS (with Netlib LAPACK) in a Docker image, and now every time I run ldconfig, I get the following errors:



ldconfig: Can't link /usr/local/lib//usr/local/lib/libtatlas.so to libtatlas.so
ldconfig: Can't link /usr/local/lib//usr/local/lib/libsatlas.so to libsatlas.so


Of course, /usr/local/lib//usr/local/lib/libtatlas.so doesn't exist, but I'm confused why it would try to look for this file, since libtatlas.so isn't a symbolic link:



root@cd00953552ab:/usr/local/lib# ls -la | grep atlas
-rw-r--r-- 1 root staff 15242054 Apr 27 08:18 libatlas.a
-rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libatlas.so
-rwxr-xr-x 1 root staff 17492184 Apr 27 08:18 libsatlas.so
-rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libtatlas.so


Why would this be happening, and is there a way to fix it/turn off this error message?



Edit: Here's the Readelf output:



root@cd00953552ab:/usr/local/lib# eu-readelf -a /usr/local/lib/libatlas.so | grep SONAME
SONAME Library soname: [/usr/local/lib/libtatlas.so]









share|improve this question




























    2















    I installed ATLAS (with Netlib LAPACK) in a Docker image, and now every time I run ldconfig, I get the following errors:



    ldconfig: Can't link /usr/local/lib//usr/local/lib/libtatlas.so to libtatlas.so
    ldconfig: Can't link /usr/local/lib//usr/local/lib/libsatlas.so to libsatlas.so


    Of course, /usr/local/lib//usr/local/lib/libtatlas.so doesn't exist, but I'm confused why it would try to look for this file, since libtatlas.so isn't a symbolic link:



    root@cd00953552ab:/usr/local/lib# ls -la | grep atlas
    -rw-r--r-- 1 root staff 15242054 Apr 27 08:18 libatlas.a
    -rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libatlas.so
    -rwxr-xr-x 1 root staff 17492184 Apr 27 08:18 libsatlas.so
    -rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libtatlas.so


    Why would this be happening, and is there a way to fix it/turn off this error message?



    Edit: Here's the Readelf output:



    root@cd00953552ab:/usr/local/lib# eu-readelf -a /usr/local/lib/libatlas.so | grep SONAME
    SONAME Library soname: [/usr/local/lib/libtatlas.so]









    share|improve this question


























      2












      2








      2








      I installed ATLAS (with Netlib LAPACK) in a Docker image, and now every time I run ldconfig, I get the following errors:



      ldconfig: Can't link /usr/local/lib//usr/local/lib/libtatlas.so to libtatlas.so
      ldconfig: Can't link /usr/local/lib//usr/local/lib/libsatlas.so to libsatlas.so


      Of course, /usr/local/lib//usr/local/lib/libtatlas.so doesn't exist, but I'm confused why it would try to look for this file, since libtatlas.so isn't a symbolic link:



      root@cd00953552ab:/usr/local/lib# ls -la | grep atlas
      -rw-r--r-- 1 root staff 15242054 Apr 27 08:18 libatlas.a
      -rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libatlas.so
      -rwxr-xr-x 1 root staff 17492184 Apr 27 08:18 libsatlas.so
      -rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libtatlas.so


      Why would this be happening, and is there a way to fix it/turn off this error message?



      Edit: Here's the Readelf output:



      root@cd00953552ab:/usr/local/lib# eu-readelf -a /usr/local/lib/libatlas.so | grep SONAME
      SONAME Library soname: [/usr/local/lib/libtatlas.so]









      share|improve this question
















      I installed ATLAS (with Netlib LAPACK) in a Docker image, and now every time I run ldconfig, I get the following errors:



      ldconfig: Can't link /usr/local/lib//usr/local/lib/libtatlas.so to libtatlas.so
      ldconfig: Can't link /usr/local/lib//usr/local/lib/libsatlas.so to libsatlas.so


      Of course, /usr/local/lib//usr/local/lib/libtatlas.so doesn't exist, but I'm confused why it would try to look for this file, since libtatlas.so isn't a symbolic link:



      root@cd00953552ab:/usr/local/lib# ls -la | grep atlas
      -rw-r--r-- 1 root staff 15242054 Apr 27 08:18 libatlas.a
      -rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libatlas.so
      -rwxr-xr-x 1 root staff 17492184 Apr 27 08:18 libsatlas.so
      -rwxr-xr-x 1 root staff 17590040 Apr 27 08:18 libtatlas.so


      Why would this be happening, and is there a way to fix it/turn off this error message?



      Edit: Here's the Readelf output:



      root@cd00953552ab:/usr/local/lib# eu-readelf -a /usr/local/lib/libatlas.so | grep SONAME
      SONAME Library soname: [/usr/local/lib/libtatlas.so]






      ld






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 27 '17 at 9:16







      josh

















      asked Apr 27 '17 at 9:05









      joshjosh

      196412




      196412




















          2 Answers
          2






          active

          oldest

          votes


















          3














          For some reason, probably related to the way the libraries were built (and more specifically, linked), they’ve stored their installation directory in their soname: thus libtatlas.so’s soname is /usr/local/lib/libtatlas.so. ldconfig tries to link libraries to their soname, if it doesn’t exist, in the same directory: it finds /usr/local/lib/libtatlas.so, checks its soname, determines that a link needs to be made from /usr/local/lib//usr/local/lib/libtatlas.so (the directory and soname concatenated) to /usr/local/lib/libtatlas.so, and fails because /usr/local/lib/usr/local/lib doesn’t exist.



          The appropriate way to fix this is to ensure that the libraries’ sonames are defined correctly. Typically I’d expect libtatlas.so.3 etc. with no directory name (the version would depend on the ABI level of the library being built). You probably need to rebuild the libraries, or find a correctly-built package...



          Alternatively, you can edit a library’s soname using PatchELF:



          patchelf --set-soname libtatlas.so /usr/local/lib/libtatlas.so


          Ideally you should relink the programs you built using this library, since they’ll have the soname embedded too (you can also patch that using PatchELF).



          In an evolving system, you’d really want to specify a version in the soname, but in a container it probably doesn’t matter — you should be rebuilding the container for upgrades anyway.






          share|improve this answer

























          • Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

            – josh
            Apr 27 '17 at 9:41












          • It turns out you can fix this with PatchELF, see my update.

            – Stephen Kitt
            Apr 27 '17 at 10:59


















          0














          In this particular case of BLAS library ATLAS. The fix to the real cause is to correct the makefile used to build the package.



          See answer of @Stephen Kitt for the reasoning.



          However, due to a bug of --set-soname in patchelf, the patchelf solution cannot work.



          Your library path contains '/usr/local', so I assume it is building from source code.



          Check the file $(SRC)/makes/Make.lib, where $(SRC) is your source code root directory.



          Particularly these lines:



          LDTRY:
          $(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso)
          -rpath-link $(LIBINSTdir)
          --whole-archive $(libas) --no-whole-archive $(LIBS)


          The soname is improper here: -soname $(LIBINSTdir)/$(outso). Change it to -soname $(outso), then rebuild the library will fix this problem.



          In case you already have a success build, change corresponding line in $(BUILD)/lib/Makefile, where $(BUILD) is the directory for building the library. Then make shared to build the libraries.



          Use command such as readelf -d libtatlas.so | grep soname to check the soname in the resulting .so file. It should not contain any directory part.



          If you cannot find the correct makefile (e.g. using a different version of ATLAS), try grep -IR soname to locate the spot that need to modify.






          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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f361627%2fldconfig-cannot-link-to-specific-files%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            For some reason, probably related to the way the libraries were built (and more specifically, linked), they’ve stored their installation directory in their soname: thus libtatlas.so’s soname is /usr/local/lib/libtatlas.so. ldconfig tries to link libraries to their soname, if it doesn’t exist, in the same directory: it finds /usr/local/lib/libtatlas.so, checks its soname, determines that a link needs to be made from /usr/local/lib//usr/local/lib/libtatlas.so (the directory and soname concatenated) to /usr/local/lib/libtatlas.so, and fails because /usr/local/lib/usr/local/lib doesn’t exist.



            The appropriate way to fix this is to ensure that the libraries’ sonames are defined correctly. Typically I’d expect libtatlas.so.3 etc. with no directory name (the version would depend on the ABI level of the library being built). You probably need to rebuild the libraries, or find a correctly-built package...



            Alternatively, you can edit a library’s soname using PatchELF:



            patchelf --set-soname libtatlas.so /usr/local/lib/libtatlas.so


            Ideally you should relink the programs you built using this library, since they’ll have the soname embedded too (you can also patch that using PatchELF).



            In an evolving system, you’d really want to specify a version in the soname, but in a container it probably doesn’t matter — you should be rebuilding the container for upgrades anyway.






            share|improve this answer

























            • Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

              – josh
              Apr 27 '17 at 9:41












            • It turns out you can fix this with PatchELF, see my update.

              – Stephen Kitt
              Apr 27 '17 at 10:59















            3














            For some reason, probably related to the way the libraries were built (and more specifically, linked), they’ve stored their installation directory in their soname: thus libtatlas.so’s soname is /usr/local/lib/libtatlas.so. ldconfig tries to link libraries to their soname, if it doesn’t exist, in the same directory: it finds /usr/local/lib/libtatlas.so, checks its soname, determines that a link needs to be made from /usr/local/lib//usr/local/lib/libtatlas.so (the directory and soname concatenated) to /usr/local/lib/libtatlas.so, and fails because /usr/local/lib/usr/local/lib doesn’t exist.



            The appropriate way to fix this is to ensure that the libraries’ sonames are defined correctly. Typically I’d expect libtatlas.so.3 etc. with no directory name (the version would depend on the ABI level of the library being built). You probably need to rebuild the libraries, or find a correctly-built package...



            Alternatively, you can edit a library’s soname using PatchELF:



            patchelf --set-soname libtatlas.so /usr/local/lib/libtatlas.so


            Ideally you should relink the programs you built using this library, since they’ll have the soname embedded too (you can also patch that using PatchELF).



            In an evolving system, you’d really want to specify a version in the soname, but in a container it probably doesn’t matter — you should be rebuilding the container for upgrades anyway.






            share|improve this answer

























            • Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

              – josh
              Apr 27 '17 at 9:41












            • It turns out you can fix this with PatchELF, see my update.

              – Stephen Kitt
              Apr 27 '17 at 10:59













            3












            3








            3







            For some reason, probably related to the way the libraries were built (and more specifically, linked), they’ve stored their installation directory in their soname: thus libtatlas.so’s soname is /usr/local/lib/libtatlas.so. ldconfig tries to link libraries to their soname, if it doesn’t exist, in the same directory: it finds /usr/local/lib/libtatlas.so, checks its soname, determines that a link needs to be made from /usr/local/lib//usr/local/lib/libtatlas.so (the directory and soname concatenated) to /usr/local/lib/libtatlas.so, and fails because /usr/local/lib/usr/local/lib doesn’t exist.



            The appropriate way to fix this is to ensure that the libraries’ sonames are defined correctly. Typically I’d expect libtatlas.so.3 etc. with no directory name (the version would depend on the ABI level of the library being built). You probably need to rebuild the libraries, or find a correctly-built package...



            Alternatively, you can edit a library’s soname using PatchELF:



            patchelf --set-soname libtatlas.so /usr/local/lib/libtatlas.so


            Ideally you should relink the programs you built using this library, since they’ll have the soname embedded too (you can also patch that using PatchELF).



            In an evolving system, you’d really want to specify a version in the soname, but in a container it probably doesn’t matter — you should be rebuilding the container for upgrades anyway.






            share|improve this answer















            For some reason, probably related to the way the libraries were built (and more specifically, linked), they’ve stored their installation directory in their soname: thus libtatlas.so’s soname is /usr/local/lib/libtatlas.so. ldconfig tries to link libraries to their soname, if it doesn’t exist, in the same directory: it finds /usr/local/lib/libtatlas.so, checks its soname, determines that a link needs to be made from /usr/local/lib//usr/local/lib/libtatlas.so (the directory and soname concatenated) to /usr/local/lib/libtatlas.so, and fails because /usr/local/lib/usr/local/lib doesn’t exist.



            The appropriate way to fix this is to ensure that the libraries’ sonames are defined correctly. Typically I’d expect libtatlas.so.3 etc. with no directory name (the version would depend on the ABI level of the library being built). You probably need to rebuild the libraries, or find a correctly-built package...



            Alternatively, you can edit a library’s soname using PatchELF:



            patchelf --set-soname libtatlas.so /usr/local/lib/libtatlas.so


            Ideally you should relink the programs you built using this library, since they’ll have the soname embedded too (you can also patch that using PatchELF).



            In an evolving system, you’d really want to specify a version in the soname, but in a container it probably doesn’t matter — you should be rebuilding the container for upgrades anyway.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 27 '17 at 10:59

























            answered Apr 27 '17 at 9:26









            Stephen KittStephen Kitt

            177k24402480




            177k24402480












            • Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

              – josh
              Apr 27 '17 at 9:41












            • It turns out you can fix this with PatchELF, see my update.

              – Stephen Kitt
              Apr 27 '17 at 10:59

















            • Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

              – josh
              Apr 27 '17 at 9:41












            • It turns out you can fix this with PatchELF, see my update.

              – Stephen Kitt
              Apr 27 '17 at 10:59
















            Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

            – josh
            Apr 27 '17 at 9:41






            Ah, I see. It doesn't seem to make a difference (I'm able to compile a program that depends on it without issue, although when I run ldd it gives me some kind of weird output) but it is a bit annoying. Is it possible to fix it without rebuilding the libraries? I might need to use the Debian package/source rather than the original, since the original seems to have these issues and the Debian package doesn't.

            – josh
            Apr 27 '17 at 9:41














            It turns out you can fix this with PatchELF, see my update.

            – Stephen Kitt
            Apr 27 '17 at 10:59





            It turns out you can fix this with PatchELF, see my update.

            – Stephen Kitt
            Apr 27 '17 at 10:59













            0














            In this particular case of BLAS library ATLAS. The fix to the real cause is to correct the makefile used to build the package.



            See answer of @Stephen Kitt for the reasoning.



            However, due to a bug of --set-soname in patchelf, the patchelf solution cannot work.



            Your library path contains '/usr/local', so I assume it is building from source code.



            Check the file $(SRC)/makes/Make.lib, where $(SRC) is your source code root directory.



            Particularly these lines:



            LDTRY:
            $(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso)
            -rpath-link $(LIBINSTdir)
            --whole-archive $(libas) --no-whole-archive $(LIBS)


            The soname is improper here: -soname $(LIBINSTdir)/$(outso). Change it to -soname $(outso), then rebuild the library will fix this problem.



            In case you already have a success build, change corresponding line in $(BUILD)/lib/Makefile, where $(BUILD) is the directory for building the library. Then make shared to build the libraries.



            Use command such as readelf -d libtatlas.so | grep soname to check the soname in the resulting .so file. It should not contain any directory part.



            If you cannot find the correct makefile (e.g. using a different version of ATLAS), try grep -IR soname to locate the spot that need to modify.






            share|improve this answer





























              0














              In this particular case of BLAS library ATLAS. The fix to the real cause is to correct the makefile used to build the package.



              See answer of @Stephen Kitt for the reasoning.



              However, due to a bug of --set-soname in patchelf, the patchelf solution cannot work.



              Your library path contains '/usr/local', so I assume it is building from source code.



              Check the file $(SRC)/makes/Make.lib, where $(SRC) is your source code root directory.



              Particularly these lines:



              LDTRY:
              $(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso)
              -rpath-link $(LIBINSTdir)
              --whole-archive $(libas) --no-whole-archive $(LIBS)


              The soname is improper here: -soname $(LIBINSTdir)/$(outso). Change it to -soname $(outso), then rebuild the library will fix this problem.



              In case you already have a success build, change corresponding line in $(BUILD)/lib/Makefile, where $(BUILD) is the directory for building the library. Then make shared to build the libraries.



              Use command such as readelf -d libtatlas.so | grep soname to check the soname in the resulting .so file. It should not contain any directory part.



              If you cannot find the correct makefile (e.g. using a different version of ATLAS), try grep -IR soname to locate the spot that need to modify.






              share|improve this answer



























                0












                0








                0







                In this particular case of BLAS library ATLAS. The fix to the real cause is to correct the makefile used to build the package.



                See answer of @Stephen Kitt for the reasoning.



                However, due to a bug of --set-soname in patchelf, the patchelf solution cannot work.



                Your library path contains '/usr/local', so I assume it is building from source code.



                Check the file $(SRC)/makes/Make.lib, where $(SRC) is your source code root directory.



                Particularly these lines:



                LDTRY:
                $(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso)
                -rpath-link $(LIBINSTdir)
                --whole-archive $(libas) --no-whole-archive $(LIBS)


                The soname is improper here: -soname $(LIBINSTdir)/$(outso). Change it to -soname $(outso), then rebuild the library will fix this problem.



                In case you already have a success build, change corresponding line in $(BUILD)/lib/Makefile, where $(BUILD) is the directory for building the library. Then make shared to build the libraries.



                Use command such as readelf -d libtatlas.so | grep soname to check the soname in the resulting .so file. It should not contain any directory part.



                If you cannot find the correct makefile (e.g. using a different version of ATLAS), try grep -IR soname to locate the spot that need to modify.






                share|improve this answer















                In this particular case of BLAS library ATLAS. The fix to the real cause is to correct the makefile used to build the package.



                See answer of @Stephen Kitt for the reasoning.



                However, due to a bug of --set-soname in patchelf, the patchelf solution cannot work.



                Your library path contains '/usr/local', so I assume it is building from source code.



                Check the file $(SRC)/makes/Make.lib, where $(SRC) is your source code root directory.



                Particularly these lines:



                LDTRY:
                $(LD) $(LDFLAGS) -shared -soname $(LIBINSTdir)/$(outso) -o $(outso)
                -rpath-link $(LIBINSTdir)
                --whole-archive $(libas) --no-whole-archive $(LIBS)


                The soname is improper here: -soname $(LIBINSTdir)/$(outso). Change it to -soname $(outso), then rebuild the library will fix this problem.



                In case you already have a success build, change corresponding line in $(BUILD)/lib/Makefile, where $(BUILD) is the directory for building the library. Then make shared to build the libraries.



                Use command such as readelf -d libtatlas.so | grep soname to check the soname in the resulting .so file. It should not contain any directory part.



                If you cannot find the correct makefile (e.g. using a different version of ATLAS), try grep -IR soname to locate the spot that need to modify.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Feb 25 at 19:20

























                answered Feb 25 at 19:11









                Eddy XiaoEddy Xiao

                414




                414



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • 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%2funix.stackexchange.com%2fquestions%2f361627%2fldconfig-cannot-link-to-specific-files%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






                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?