how to cross compile shared object using gcc(g++)?











up vote
0
down vote

favorite












Im trying to create a .so named libfunc.so, which compile from func.cpp.



I've been done steps below:
arm-none-linux-gnueabi-g++ -c -fPIC func.cpp
arm-none-linux-gnueabi-g++ -shared func.o -o libfunc.so



I get some errors when I try to compile executable:
arm-none-linux-gnueabi-gcc -L/usr/local/lib/func test.cpp -o test -lfunc



lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/local/lib/func" is unsafe for cross-compilation
/opt/gnutools/arm-2014.05/bin/../lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: /tmp/ccazeIay.o: undefined reference to symbol '_ZNSaIcEC1Ev@@GLIBCXX_3.4'
/opt/gnutools/arm-2014.05/bin/../arm-none-linux-gnueabi/libc/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line


what cause those errors and how can I fix it?










share|improve this question


























    up vote
    0
    down vote

    favorite












    Im trying to create a .so named libfunc.so, which compile from func.cpp.



    I've been done steps below:
    arm-none-linux-gnueabi-g++ -c -fPIC func.cpp
    arm-none-linux-gnueabi-g++ -shared func.o -o libfunc.so



    I get some errors when I try to compile executable:
    arm-none-linux-gnueabi-gcc -L/usr/local/lib/func test.cpp -o test -lfunc



    lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/local/lib/func" is unsafe for cross-compilation
    /opt/gnutools/arm-2014.05/bin/../lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: /tmp/ccazeIay.o: undefined reference to symbol '_ZNSaIcEC1Ev@@GLIBCXX_3.4'
    /opt/gnutools/arm-2014.05/bin/../arm-none-linux-gnueabi/libc/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line


    what cause those errors and how can I fix it?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Im trying to create a .so named libfunc.so, which compile from func.cpp.



      I've been done steps below:
      arm-none-linux-gnueabi-g++ -c -fPIC func.cpp
      arm-none-linux-gnueabi-g++ -shared func.o -o libfunc.so



      I get some errors when I try to compile executable:
      arm-none-linux-gnueabi-gcc -L/usr/local/lib/func test.cpp -o test -lfunc



      lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/local/lib/func" is unsafe for cross-compilation
      /opt/gnutools/arm-2014.05/bin/../lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: /tmp/ccazeIay.o: undefined reference to symbol '_ZNSaIcEC1Ev@@GLIBCXX_3.4'
      /opt/gnutools/arm-2014.05/bin/../arm-none-linux-gnueabi/libc/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line


      what cause those errors and how can I fix it?










      share|improve this question













      Im trying to create a .so named libfunc.so, which compile from func.cpp.



      I've been done steps below:
      arm-none-linux-gnueabi-g++ -c -fPIC func.cpp
      arm-none-linux-gnueabi-g++ -shared func.o -o libfunc.so



      I get some errors when I try to compile executable:
      arm-none-linux-gnueabi-gcc -L/usr/local/lib/func test.cpp -o test -lfunc



      lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/local/lib/func" is unsafe for cross-compilation
      /opt/gnutools/arm-2014.05/bin/../lib/gcc/arm-none-linux-gnueabi/4.8.3/../../../../arm-none-linux-gnueabi/bin/ld: /tmp/ccazeIay.o: undefined reference to symbol '_ZNSaIcEC1Ev@@GLIBCXX_3.4'
      /opt/gnutools/arm-2014.05/bin/../arm-none-linux-gnueabi/libc/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line


      what cause those errors and how can I fix it?







      linux gcc g++






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 4 hours ago









      umbreLLaJYL

      788




      788





























          active

          oldest

          votes











          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',
          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%2f53371476%2fhow-to-cross-compile-shared-object-using-gccg%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371476%2fhow-to-cross-compile-shared-object-using-gccg%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

          'app-layout' is not a known element: how to share Component with different Modules

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          WPF add header to Image with URL pettitions [duplicate]