Cross compiling for RPi - error while loading shared librariesMissing libcofi_rpi.so on host machineMongodb cross compilation on linux for Raspberry Pihow to install cross-compiled OpenCV's libraries on raspbery piCross Compiling Protobuf for Raspberry PiCross-Compiling kernel can't find gccEmbedded Xinu for RPiCross Compile Error Using arm-linux-gnueabihf-gccWhen I compile with arm-linux-gnueabihf-g++ version 4.7, I get error while loading shared libraries: libstdc++.so.6Is it possible to fix the “cannot find -lgcc” and “cannot find -lgcc_s” error messages when using arm-linux-gnueabihf-g++ as a linker?What's causing these crashes after cross-compiling?

Maximum likelihood parameters deviate from posterior distributions

Codimension of non-flat locus

Why do I get two different answers for this counting problem?

Horror movie about a virus at the prom; beginning and end are stylized as a cartoon

What does the "remote control" for a QF-4 look like?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Replacing matching entries in one column of a file by another column from a different file

Can I make popcorn with any corn?

High voltage LED indicator 40-1000 VDC without additional power supply

LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function

How does one intimidate enemies without having the capacity for violence?

RSA: Danger of using p to create q

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

How much RAM could one put in a typical 80386 setup?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Roll the carpet

How does quantile regression compare to logistic regression with the variable split at the quantile?

infared filters v nd

Why can't I see bouncing of a switch on an oscilloscope?

Unable to deploy metadata from Partner Developer scratch org because of extra fields

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

What is the word for reserving something for yourself before others do?

How can I make my BBEG immortal short of making them a Lich or Vampire?

Why can't we play rap on piano?



Cross compiling for RPi - error while loading shared libraries


Missing libcofi_rpi.so on host machineMongodb cross compilation on linux for Raspberry Pihow to install cross-compiled OpenCV's libraries on raspbery piCross Compiling Protobuf for Raspberry PiCross-Compiling kernel can't find gccEmbedded Xinu for RPiCross Compile Error Using arm-linux-gnueabihf-gccWhen I compile with arm-linux-gnueabihf-g++ version 4.7, I get error while loading shared libraries: libstdc++.so.6Is it possible to fix the “cannot find -lgcc” and “cannot find -lgcc_s” error messages when using arm-linux-gnueabihf-g++ as a linker?What's causing these crashes after cross-compiling?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I'm trying to compile a simple program (blinking.c) on my Ubuntu using the ARM cross compile toolchain (arm-linux-gnueabihf-gcc) and run it on my Raspberry Pi. The program is using the wiringPi shared library (wiringPi.so) located in ~/wiringPi/wiringPi on Ubuntu. The code follows:



#include "wiringPi.h"

int main (void)

wiringPiSetup();
pinMode(0, OUTPUT);

for (;;)

digitalWrite(0, HIGH);
delay(500);
digitalWrite(0, LOW);
delay(500);


return 0;



I used the command:



arm-linux-gnueabihf-gcc blinking.c -o blinking -L ~/wiringPi/wiringPi -lwiringPi -I ~/wiringPi/wiringPi


to compile and successfully get the object file, which I then transfer to Raspberry Pi.

However, when trying to run the program on Pi, I get the following error:
./blinking: error while loading shared libraries: libwiringPi.so: cannot open shared object file: No such file or directory



What am I missing?










share|improve this question







New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It looks like it can't find the library on the Pi. Have you installed wiringPi on the Pi (it should be preinstalled in full Raspbian, but not in Raspbian Lite).

    – joan
    5 hours ago











  • @joan Haven't installed wiringPi on Raspberry (using Raspbian Lite). I thought the compiler links the shared libraries to the program object files. I guess I need to learn more about dynamic libraries. Just saw the answer by Ralf which explains it.

    – A6SE
    5 hours ago






  • 1





    The Answer and comment are true BUT the the library should be installed on standard Raspbian - it is used by gpio. Currently /usr/lib/libwiringPi.so.2.50 (with a link from /usr/lib/libwiringPi.so) I note the OP has not identified what OS is in use.

    – Milliways
    3 hours ago


















3















I'm trying to compile a simple program (blinking.c) on my Ubuntu using the ARM cross compile toolchain (arm-linux-gnueabihf-gcc) and run it on my Raspberry Pi. The program is using the wiringPi shared library (wiringPi.so) located in ~/wiringPi/wiringPi on Ubuntu. The code follows:



#include "wiringPi.h"

int main (void)

wiringPiSetup();
pinMode(0, OUTPUT);

for (;;)

digitalWrite(0, HIGH);
delay(500);
digitalWrite(0, LOW);
delay(500);


return 0;



I used the command:



arm-linux-gnueabihf-gcc blinking.c -o blinking -L ~/wiringPi/wiringPi -lwiringPi -I ~/wiringPi/wiringPi


to compile and successfully get the object file, which I then transfer to Raspberry Pi.

However, when trying to run the program on Pi, I get the following error:
./blinking: error while loading shared libraries: libwiringPi.so: cannot open shared object file: No such file or directory



What am I missing?










share|improve this question







New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It looks like it can't find the library on the Pi. Have you installed wiringPi on the Pi (it should be preinstalled in full Raspbian, but not in Raspbian Lite).

    – joan
    5 hours ago











  • @joan Haven't installed wiringPi on Raspberry (using Raspbian Lite). I thought the compiler links the shared libraries to the program object files. I guess I need to learn more about dynamic libraries. Just saw the answer by Ralf which explains it.

    – A6SE
    5 hours ago






  • 1





    The Answer and comment are true BUT the the library should be installed on standard Raspbian - it is used by gpio. Currently /usr/lib/libwiringPi.so.2.50 (with a link from /usr/lib/libwiringPi.so) I note the OP has not identified what OS is in use.

    – Milliways
    3 hours ago














3












3








3








I'm trying to compile a simple program (blinking.c) on my Ubuntu using the ARM cross compile toolchain (arm-linux-gnueabihf-gcc) and run it on my Raspberry Pi. The program is using the wiringPi shared library (wiringPi.so) located in ~/wiringPi/wiringPi on Ubuntu. The code follows:



#include "wiringPi.h"

int main (void)

wiringPiSetup();
pinMode(0, OUTPUT);

for (;;)

digitalWrite(0, HIGH);
delay(500);
digitalWrite(0, LOW);
delay(500);


return 0;



I used the command:



arm-linux-gnueabihf-gcc blinking.c -o blinking -L ~/wiringPi/wiringPi -lwiringPi -I ~/wiringPi/wiringPi


to compile and successfully get the object file, which I then transfer to Raspberry Pi.

However, when trying to run the program on Pi, I get the following error:
./blinking: error while loading shared libraries: libwiringPi.so: cannot open shared object file: No such file or directory



What am I missing?










share|improve this question







New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm trying to compile a simple program (blinking.c) on my Ubuntu using the ARM cross compile toolchain (arm-linux-gnueabihf-gcc) and run it on my Raspberry Pi. The program is using the wiringPi shared library (wiringPi.so) located in ~/wiringPi/wiringPi on Ubuntu. The code follows:



#include "wiringPi.h"

int main (void)

wiringPiSetup();
pinMode(0, OUTPUT);

for (;;)

digitalWrite(0, HIGH);
delay(500);
digitalWrite(0, LOW);
delay(500);


return 0;



I used the command:



arm-linux-gnueabihf-gcc blinking.c -o blinking -L ~/wiringPi/wiringPi -lwiringPi -I ~/wiringPi/wiringPi


to compile and successfully get the object file, which I then transfer to Raspberry Pi.

However, when trying to run the program on Pi, I get the following error:
./blinking: error while loading shared libraries: libwiringPi.so: cannot open shared object file: No such file or directory



What am I missing?







c wiringpi cross-compilation shared-libraries






share|improve this question







New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 5 hours ago









A6SEA6SE

1183




1183




New contributor




A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






A6SE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • It looks like it can't find the library on the Pi. Have you installed wiringPi on the Pi (it should be preinstalled in full Raspbian, but not in Raspbian Lite).

    – joan
    5 hours ago











  • @joan Haven't installed wiringPi on Raspberry (using Raspbian Lite). I thought the compiler links the shared libraries to the program object files. I guess I need to learn more about dynamic libraries. Just saw the answer by Ralf which explains it.

    – A6SE
    5 hours ago






  • 1





    The Answer and comment are true BUT the the library should be installed on standard Raspbian - it is used by gpio. Currently /usr/lib/libwiringPi.so.2.50 (with a link from /usr/lib/libwiringPi.so) I note the OP has not identified what OS is in use.

    – Milliways
    3 hours ago


















  • It looks like it can't find the library on the Pi. Have you installed wiringPi on the Pi (it should be preinstalled in full Raspbian, but not in Raspbian Lite).

    – joan
    5 hours ago











  • @joan Haven't installed wiringPi on Raspberry (using Raspbian Lite). I thought the compiler links the shared libraries to the program object files. I guess I need to learn more about dynamic libraries. Just saw the answer by Ralf which explains it.

    – A6SE
    5 hours ago






  • 1





    The Answer and comment are true BUT the the library should be installed on standard Raspbian - it is used by gpio. Currently /usr/lib/libwiringPi.so.2.50 (with a link from /usr/lib/libwiringPi.so) I note the OP has not identified what OS is in use.

    – Milliways
    3 hours ago

















It looks like it can't find the library on the Pi. Have you installed wiringPi on the Pi (it should be preinstalled in full Raspbian, but not in Raspbian Lite).

– joan
5 hours ago





It looks like it can't find the library on the Pi. Have you installed wiringPi on the Pi (it should be preinstalled in full Raspbian, but not in Raspbian Lite).

– joan
5 hours ago













@joan Haven't installed wiringPi on Raspberry (using Raspbian Lite). I thought the compiler links the shared libraries to the program object files. I guess I need to learn more about dynamic libraries. Just saw the answer by Ralf which explains it.

– A6SE
5 hours ago





@joan Haven't installed wiringPi on Raspberry (using Raspbian Lite). I thought the compiler links the shared libraries to the program object files. I guess I need to learn more about dynamic libraries. Just saw the answer by Ralf which explains it.

– A6SE
5 hours ago




1




1





The Answer and comment are true BUT the the library should be installed on standard Raspbian - it is used by gpio. Currently /usr/lib/libwiringPi.so.2.50 (with a link from /usr/lib/libwiringPi.so) I note the OP has not identified what OS is in use.

– Milliways
3 hours ago






The Answer and comment are true BUT the the library should be installed on standard Raspbian - it is used by gpio. Currently /usr/lib/libwiringPi.so.2.50 (with a link from /usr/lib/libwiringPi.so) I note the OP has not identified what OS is in use.

– Milliways
3 hours ago











1 Answer
1






active

oldest

votes


















4














Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI.



This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run the program.



So you have to copy the library to the PI into a directory that is searched for shared libraries, such as /usr/lib or /usr/local/lib. You can also set LD_LIBRARY_PATH to point to the library, but then you must make sure it is always set when you want to execute the program.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("schematics", function ()
    StackExchange.schematics.init();
    );
    , "cicuitlab");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "447"
    ;
    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
    );



    );






    A6SE is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f96177%2fcross-compiling-for-rpi-error-while-loading-shared-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









    4














    Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI.



    This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run the program.



    So you have to copy the library to the PI into a directory that is searched for shared libraries, such as /usr/lib or /usr/local/lib. You can also set LD_LIBRARY_PATH to point to the library, but then you must make sure it is always set when you want to execute the program.






    share|improve this answer



























      4














      Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI.



      This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run the program.



      So you have to copy the library to the PI into a directory that is searched for shared libraries, such as /usr/lib or /usr/local/lib. You can also set LD_LIBRARY_PATH to point to the library, but then you must make sure it is always set when you want to execute the program.






      share|improve this answer

























        4












        4








        4







        Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI.



        This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run the program.



        So you have to copy the library to the PI into a directory that is searched for shared libraries, such as /usr/lib or /usr/local/lib. You can also set LD_LIBRARY_PATH to point to the library, but then you must make sure it is always set when you want to execute the program.






        share|improve this answer













        Shared or dynamic libraries are needed at run time. So you need the library not only on the build system but in on the target system, in this case on the PI.



        This is different from static libraries. If you use a static library at build time, all the needed code from the library would be included in the executable, and the library would not be needed to run the program.



        So you have to copy the library to the PI into a directory that is searched for shared libraries, such as /usr/lib or /usr/local/lib. You can also set LD_LIBRARY_PATH to point to the library, but then you must make sure it is always set when you want to execute the program.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 5 hours ago









        RalfFriedlRalfFriedl

        6811210




        6811210




















            A6SE is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            A6SE is a new contributor. Be nice, and check out our Code of Conduct.












            A6SE is a new contributor. Be nice, and check out our Code of Conduct.











            A6SE is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Raspberry Pi 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%2fraspberrypi.stackexchange.com%2fquestions%2f96177%2fcross-compiling-for-rpi-error-while-loading-shared-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







            Popular posts from this blog

            How to create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

            Българска екзархия Съдържание История | Български екзарси | Вижте също | Външни препратки | Литература | Бележки | НавигацияУстав за управлението на българската екзархия. Цариград, 1870Слово на Ловешкия митрополит Иларион при откриването на Българския народен събор в Цариград на 23. II. 1870 г.Българската правда и гръцката кривда. От С. М. (= Софийски Мелетий). Цариград, 1872Предстоятели на Българската екзархияПодмененият ВеликденИнформационна агенция „Фокус“Димитър Ризов. Българите в техните исторически, етнографически и политически граници (Атлас съдържащ 40 карти). Berlin, Königliche Hoflithographie, Hof-Buch- und -Steindruckerei Wilhelm Greve, 1917Report of the International Commission to Inquire into the Causes and Conduct of the Balkan Wars

            Category:Tremithousa Media in category "Tremithousa"Navigation menuUpload media34° 49′ 02.7″ N, 32° 26′ 37.32″ EOpenStreetMapGoogle EarthProximityramaReasonatorScholiaStatisticsWikiShootMe