error while loading shared libraries BBB 4.1.12-ti-r29

246 views
Skip to first unread message

Dean

unread,
Jan 18, 2016, 8:00:22 PM1/18/16
to BeagleBoard
My BBB setup is as follows ...
Linux beaglebone 4.1.12-ti-r29 #1 SMP PREEMPT Mon Nov 9 22:46:19 UTC 2015 armv7l GNU/Linux
BeagleBoard.org Debian Image 2015-11-12

For whatever reason I cannot access a library (i.e. libEBBLibrary.so) and I am not sure what I am missing. Might someone offer a suggestion on where I am going wrong or what I can do to rectify it?? Thanks in advance who those that reply.
root@beaglebone:~/exploringBB/chp09/LCDcharacter# sudo sh -c "echo BB-SPIDEV1 > $SLOTS"

root@beaglebone:~/exploringBB/chp09/LCDcharacter# cat $SLOTS|grep SPI

4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-SPIDEV1



root@beaglebone:~/exploringBB/chp09/LCDcharacter# ./build

root@beaglebone:~/exploringBB/chp09/LCDcharacter# ./LCDApp

./LCDApp: error while loading shared libraries: libEBBLibrary.so: cannot open shared object file: No such file or directory


root@beaglebone:~/exploringBB/chp09/LCDcharacter# g++ LCDApp.cpp ../../library/libEBBLibrary.so -o LCDApp -I "../../library"

root@beaglebone:~/exploringBB/chp09/LCDcharacter# ./LCDApp

./LCDApp: error while loading shared libraries: libEBBLibrary.so: cannot open shared object file: No such file or directory


root@beaglebone:~/exploringBB/chp09/LCDcharacter# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

root@beaglebone:~/exploringBB/chp09/LCDcharacter# export LD_LIBRARY_PATH="../../library/libEBBLibrary.so:$LD_LIBRARY_PATH"
root@beaglebone:~/exploringBB/chp09/LCDcharacter# ./LCDApp
./LCDApp: error while loading shared libraries: libEBBLibrary.so: cannot open shared object file: No such file or directory


Robert Nelson

unread,
Jan 18, 2016, 8:17:51 PM1/18/16
to Beagle Board
Well "No such file or directory"..

and it's not available:

https://packages.debian.org/search?searchon=contents&keywords=libEBBLibrary.so&mode=exactfilename&suite=stable&arch=any

So, you better check where you built "LCDApp", and fix your error..

Regards,


--
Robert Nelson
https://rcn-ee.com/

Mike

unread,
Jan 18, 2016, 8:24:34 PM1/18/16
to beagl...@googlegroups.com
I don't believe that LD_LIBRARY_PATH is searched in the manner you're thinking in the last lines.  If memory serves you need to specify the full path from / i.e. absolute not relative.

Mike

William Hermans

unread,
Jan 18, 2016, 9:57:36 PM1/18/16
to beagl...@googlegroups.com
Also, using LD_LIBRARY_PATH in this manner is just flat out wrong. If you have a shared library file, put it in the correct directory to begin with.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike

unread,
Jan 18, 2016, 10:05:10 PM1/18/16
to beagl...@googlegroups.com
On 01/18/2016 09:57 PM, William Hermans wrote:
Also, using LD_LIBRARY_PATH in this manner is just flat out wrong. If you have a shared library file, put it in the correct directory to begin with.

On Mon, Jan 18, 2016 at 6:24 PM, Mike <belly...@gmail.com> wrote:
<snipped>

root@beaglebone:~/exploringBB/chp09/LCDcharacter# export LD_LIBRARY_PATH="../../library/libEBBLibrary.so:$LD_LIBRARY_PATH"
root@beaglebone:~/exploringBB/chp09/LCDcharacter# ./LCDApp
./LCDApp: error while loading shared libraries: libEBBLibrary.so: cannot open shared object file: No such file or directory


I don't believe that LD_LIBRARY_PATH is searched in the manner you're thinking in the last lines.  If memory serves you need to specify the full path from / i.e. absolute not relative.

Mike

Exactly my thoughts William.  As a sys admin I've seen way to much LD_* abuse not just LD_LIBRARY_PATH...  It's really not that hard on Linux, but if following other bad examples, well what can one say?  Somewhere out there is a great reference on GCC, G++ and using libraries.  The title or link eludes me now.  Was from the UK somewhere I believe.

Mike

Przemek Klosowski

unread,
Jan 18, 2016, 10:15:00 PM1/18/16
to beagl...@googlegroups.com
On Mon, Jan 18, 2016 at 9:57 PM, William Hermans <yyr...@gmail.com> wrote:
> Also, using LD_LIBRARY_PATH in this manner is just flat out wrong. If you
> have a shared library file, put it in the correct directory to begin with.
>
> On Mon, Jan 18, 2016 at 6:24 PM, Mike <belly...@gmail.com> wrote:
>>
>> export LD_LIBRARY_PATH="../../library/libEBBLibrary.so:$LD_LIBRARY_PATH"

Why do you think it's wrong? The point of LD_LIBRARY_PATH is to
collect all the places you might have shared libs, whether system or
application or private.
There's even another trick, using LD_PRELOAD to force certain library
into the image to override symbols from e.g. system libraries; this
works great for debugging.

BTW, if you need to add a library file or directory to a single
application, I'd recommend just setting the environment for this
single command rather than exporting it for general use:

LD_PRELOAD=/home/user/proj/lib/libdebug.so LCDApp

Mike

unread,
Jan 18, 2016, 10:39:04 PM1/18/16
to beagl...@googlegroups.com
I'm not going debate the use of LD_LIBRARY_PATH, as an admin all I'll
say is it's terribly abused and a security nightmare if not used properly.

Your example may well solve his issue and is a workable solution. Noting
the the path is absolute and not relative...

Mike

Dean

unread,
Jan 18, 2016, 11:00:01 PM1/18/16
to BeagleBoard, belly...@gmail.com
All said something else is going on here. libEBBLibrary.so is definitely there yet it does not take. I should mention that namespace std is being used to make updates on code easier. See code listed below.


root@beaglebone:~/exploringBB/chp09/LCDcharacter# export LD_LIBRARY_PATH="~/exploringBB/library/libEBBLibrary.so:$LD_LIBRARY_PATH"

root@beaglebone:~/exploringBB/chp09/LCDcharacter# ./LCDApp

./LCDApp: error while loading shared libraries: libEBBLibrary.so: cannot open shared object file: No such file or directory

root@beaglebone:~/exploringBB/chp09/LCDcharacter# cd ../../library

root@beaglebone:~/exploringBB/library# ls

CMakeLists.txt README build bus display docs example gpio libEBBLibrary.a libEBBLibrary.so motor network sensor

root@beaglebone:~/exploringBB/library#


Here is the code ...


#include <unistd.h>
#include <iostream>
#include <sstream>
#include "display/LCDCharacterDisplay.h"
using namespace std;
using namespace exploringBB;

int main(){
   cout << "Starting EBB LCD Character Display Example" << endl;
   SPIDevice *busDevice = new SPIDevice(2,0); //Using second SPI bus (both loaded)
   busDevice->setSpeed(1000000);      // Have access to SPI Device object
   ostringstream s;                   // Using this to combine text and int data
   LCDCharacterDisplay display(busDevice, 16, 2); // Construct 16x2 LCD Display
   display.clear();                   // Clear the character LCD module
   display.home();                    // Move the cursor to the (0,0) position
   display.print("EBB by D. Molloy"); // String to display on the first row
   for(int x=0; x<=10000; x++){       // Do this 10,000 times
      s.str("");                      // clear the ostringstream object s
      display.setCursorPosition(1,3); // move the cursor to second row
      s << "X=" << x;                 // construct a string that has an int value
      display.print(s.str());         // print the string X=*** on the LCD module
   }
   cout << "End of EBB LCD Character Display Example" << endl;
}


Mike

unread,
Jan 19, 2016, 8:33:18 AM1/19/16
to BeagleBoard
ldd and strace are probably the tools I would use to help debug this.

Mike

William Hermans

unread,
Jan 19, 2016, 8:34:18 AM1/19/16
to beagl...@googlegroups.com
Why do you think it's wrong? The point of LD_LIBRARY_PATH is to
collect all the places you might have shared libs, whether system or
application or private.

Because it's wrong. LD_LIBRARY_PATH is executation time, not link time. Link time is -L /path/to/lib( gcc / g++ )

http://unix.stackexchange.com/questions/168340/where-is-ld-library-path-how-do-i-set-the-ld-library-path-env-variable

William Hermans

unread,
Jan 19, 2016, 8:39:50 AM1/19/16
to beagl...@googlegroups.com
Because it's wrong. LD_LIBRARY_PATH is executation time, not link time. Link time is -L /path/to/lib( gcc / g++ )

What's more, *every* user should have /usr/lib in their path . . .

Anyway, read this, and learn: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

Message has been deleted
Message has been deleted
Message has been deleted

Dean

unread,
Jan 24, 2016, 6:09:41 PM1/24/16
to BeagleBoard
I decided to close this post and repost as an strace question as it is more to the point. Thanks William for directing my attention to strace.


Reply all
Reply to author
Forward
0 new messages