How to add libraries path to the ./configure command?












42















I would like ./configure to link to a library and some include files. My library is stored in /home/foo/sw/lib/ and my files are stored in /home/foo/sw/include.



./configure --help throws out the following:



Some influential environment variables:



  CC           C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor


I have tried various combinations:



./configure --prefix=/home/foo/sw -I</home/foo/sw/include> -L</home/foo/sw/lib/>
./configure --prefix=/home/foo/sw -I=/home/foo/sw/include -L=/home/foo/sw/lib/
./configure --prefix=/home/foo/sw -I/home/foo/sw/include -L/home/foo/sw/lib/
etc..


But I can't seem to get the syntax right. If anyone can help me out, that would be greatly appreciated. THANKS!










share|improve this question





























    42















    I would like ./configure to link to a library and some include files. My library is stored in /home/foo/sw/lib/ and my files are stored in /home/foo/sw/include.



    ./configure --help throws out the following:



    Some influential environment variables:



      CC           C compiler command
    CFLAGS C compiler flags
    LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
    nonstandard directory <lib dir>
    LIBS libraries to pass to the linker, e.g. -l<library>
    CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
    you have headers in a nonstandard directory <include dir>
    CPP C preprocessor


    I have tried various combinations:



    ./configure --prefix=/home/foo/sw -I</home/foo/sw/include> -L</home/foo/sw/lib/>
    ./configure --prefix=/home/foo/sw -I=/home/foo/sw/include -L=/home/foo/sw/lib/
    ./configure --prefix=/home/foo/sw -I/home/foo/sw/include -L/home/foo/sw/lib/
    etc..


    But I can't seem to get the syntax right. If anyone can help me out, that would be greatly appreciated. THANKS!










    share|improve this question



























      42












      42








      42


      14






      I would like ./configure to link to a library and some include files. My library is stored in /home/foo/sw/lib/ and my files are stored in /home/foo/sw/include.



      ./configure --help throws out the following:



      Some influential environment variables:



        CC           C compiler command
      CFLAGS C compiler flags
      LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
      nonstandard directory <lib dir>
      LIBS libraries to pass to the linker, e.g. -l<library>
      CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
      you have headers in a nonstandard directory <include dir>
      CPP C preprocessor


      I have tried various combinations:



      ./configure --prefix=/home/foo/sw -I</home/foo/sw/include> -L</home/foo/sw/lib/>
      ./configure --prefix=/home/foo/sw -I=/home/foo/sw/include -L=/home/foo/sw/lib/
      ./configure --prefix=/home/foo/sw -I/home/foo/sw/include -L/home/foo/sw/lib/
      etc..


      But I can't seem to get the syntax right. If anyone can help me out, that would be greatly appreciated. THANKS!










      share|improve this question
















      I would like ./configure to link to a library and some include files. My library is stored in /home/foo/sw/lib/ and my files are stored in /home/foo/sw/include.



      ./configure --help throws out the following:



      Some influential environment variables:



        CC           C compiler command
      CFLAGS C compiler flags
      LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
      nonstandard directory <lib dir>
      LIBS libraries to pass to the linker, e.g. -l<library>
      CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
      you have headers in a nonstandard directory <include dir>
      CPP C preprocessor


      I have tried various combinations:



      ./configure --prefix=/home/foo/sw -I</home/foo/sw/include> -L</home/foo/sw/lib/>
      ./configure --prefix=/home/foo/sw -I=/home/foo/sw/include -L=/home/foo/sw/lib/
      ./configure --prefix=/home/foo/sw -I/home/foo/sw/include -L/home/foo/sw/lib/
      etc..


      But I can't seem to get the syntax right. If anyone can help me out, that would be greatly appreciated. THANKS!







      compiling






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 5 '14 at 12:58









      Braiam

      51.8k20136221




      51.8k20136221










      asked Dec 5 '13 at 5:34









      BlackAdderBlackAdder

      313137




      313137






















          1 Answer
          1






          active

          oldest

          votes


















          47














          You missed the meaning of




          Some influential environment variables:




          So you set them as an environment variable; configure determines LDFLAGS and CPPFLAGS by checking config files and the environment. You can set them like this ...



          export CPPFLAGS='-I/home/foo/sw/include'
          export LDFLAGS='-L/home/foo/sw/lib/'
          ./configure


          or as a one-liner:



          env CPPFLAGS='-I/home/foo/sw/include' LDFLAGS='-L/home/foo/sw/lib/' ./configure


          Please note that it is possible that you cannot use subdirectories under /home/foo/sw/lib/



          f.e. putting your library in /home/foo/sw/lib/bar/ might show you a lib not founderror.



          However you can use multiple entries:



          LDFLAGS="-L/home/foo/sw/lib -L/home/foo/bar/lib"






          share|improve this answer





















          • 4





            Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

            – Braiam
            Jan 5 '14 at 12:59











          • Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

            – user15964
            Mar 1 '17 at 2:21













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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%2faskubuntu.com%2fquestions%2f386315%2fhow-to-add-libraries-path-to-the-configure-command%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









          47














          You missed the meaning of




          Some influential environment variables:




          So you set them as an environment variable; configure determines LDFLAGS and CPPFLAGS by checking config files and the environment. You can set them like this ...



          export CPPFLAGS='-I/home/foo/sw/include'
          export LDFLAGS='-L/home/foo/sw/lib/'
          ./configure


          or as a one-liner:



          env CPPFLAGS='-I/home/foo/sw/include' LDFLAGS='-L/home/foo/sw/lib/' ./configure


          Please note that it is possible that you cannot use subdirectories under /home/foo/sw/lib/



          f.e. putting your library in /home/foo/sw/lib/bar/ might show you a lib not founderror.



          However you can use multiple entries:



          LDFLAGS="-L/home/foo/sw/lib -L/home/foo/bar/lib"






          share|improve this answer





















          • 4





            Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

            – Braiam
            Jan 5 '14 at 12:59











          • Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

            – user15964
            Mar 1 '17 at 2:21


















          47














          You missed the meaning of




          Some influential environment variables:




          So you set them as an environment variable; configure determines LDFLAGS and CPPFLAGS by checking config files and the environment. You can set them like this ...



          export CPPFLAGS='-I/home/foo/sw/include'
          export LDFLAGS='-L/home/foo/sw/lib/'
          ./configure


          or as a one-liner:



          env CPPFLAGS='-I/home/foo/sw/include' LDFLAGS='-L/home/foo/sw/lib/' ./configure


          Please note that it is possible that you cannot use subdirectories under /home/foo/sw/lib/



          f.e. putting your library in /home/foo/sw/lib/bar/ might show you a lib not founderror.



          However you can use multiple entries:



          LDFLAGS="-L/home/foo/sw/lib -L/home/foo/bar/lib"






          share|improve this answer





















          • 4





            Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

            – Braiam
            Jan 5 '14 at 12:59











          • Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

            – user15964
            Mar 1 '17 at 2:21
















          47












          47








          47







          You missed the meaning of




          Some influential environment variables:




          So you set them as an environment variable; configure determines LDFLAGS and CPPFLAGS by checking config files and the environment. You can set them like this ...



          export CPPFLAGS='-I/home/foo/sw/include'
          export LDFLAGS='-L/home/foo/sw/lib/'
          ./configure


          or as a one-liner:



          env CPPFLAGS='-I/home/foo/sw/include' LDFLAGS='-L/home/foo/sw/lib/' ./configure


          Please note that it is possible that you cannot use subdirectories under /home/foo/sw/lib/



          f.e. putting your library in /home/foo/sw/lib/bar/ might show you a lib not founderror.



          However you can use multiple entries:



          LDFLAGS="-L/home/foo/sw/lib -L/home/foo/bar/lib"






          share|improve this answer















          You missed the meaning of




          Some influential environment variables:




          So you set them as an environment variable; configure determines LDFLAGS and CPPFLAGS by checking config files and the environment. You can set them like this ...



          export CPPFLAGS='-I/home/foo/sw/include'
          export LDFLAGS='-L/home/foo/sw/lib/'
          ./configure


          or as a one-liner:



          env CPPFLAGS='-I/home/foo/sw/include' LDFLAGS='-L/home/foo/sw/lib/' ./configure


          Please note that it is possible that you cannot use subdirectories under /home/foo/sw/lib/



          f.e. putting your library in /home/foo/sw/lib/bar/ might show you a lib not founderror.



          However you can use multiple entries:



          LDFLAGS="-L/home/foo/sw/lib -L/home/foo/bar/lib"







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 23 '15 at 14:37









          Dennis Nolte

          555512




          555512










          answered Dec 5 '13 at 7:59









          RinzwindRinzwind

          206k28394526




          206k28394526








          • 4





            Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

            – Braiam
            Jan 5 '14 at 12:59











          • Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

            – user15964
            Mar 1 '17 at 2:21
















          • 4





            Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

            – Braiam
            Jan 5 '14 at 12:59











          • Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

            – user15964
            Mar 1 '17 at 2:21










          4




          4





          Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

          – Braiam
          Jan 5 '14 at 12:59





          Maybe CPPFLAGS='-I/home/foo/sw/include:$CPPFLAGS' just in case something is out there ;)

          – Braiam
          Jan 5 '14 at 12:59













          Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

          – user15964
          Mar 1 '17 at 2:21







          Hi, Rinzwind. I am confused about the difference between LDFLAGS=-L and LIBS=-l. According to the help, they seems to be the same thing. Is there any difference?

          – user15964
          Mar 1 '17 at 2:21




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f386315%2fhow-to-add-libraries-path-to-the-configure-command%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

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

          Eduardo VII do Reino Unido