Error while loading shared libraries

Hi Everyone,

I’m trying to go through the Raspbian Info instructions for installing Legato on a raspberry pi. I’m building on a Ubuntu 16.04 VM and installing on a Raspberry Pi 1B. I seem to have no problems compiling both the kernel and Legato on the host machine but when I mount the squashfs to the pi and try to run sudo /./mnt/legato/start I get this error.

./system/bin/startSystem: error while loading shared libraries: liblegato.so: cannot open shared object file: No such file or directory

Any ideas? I did some searching and haven’t been able to find any answers. I’m using the legato toolchain for compiling.

Thanks

Hi, Mike.

I haven’t tried using it on RasPi myself yet, but this sort of thing happens when the dynamic linker can’t find a library that the executable needs. In this case, the startSystem program needs liblegato, and liblegato is not anywhere that the dynamic linker is looking for it.

The first thing to check is that liblegato.so is properly installed on your target. If it’s not installed in one of the standard places that the linker looks for libraries (like /lib or /usr/lib), then you need to tell the linker where to find it. There are lots of ways to do that. One that’s good for troubleshooting is adding the directory path to the LD_LIBRARY_PATH environment variable

export LD_LIBRARY_PATH=/mnt/legato/system/lib

Another (more persistent) way is to add the library to your linker’s cache. To do this,

  1. open up /etc/ld.so.conf (in an editor using sudo) and add a line containing the path to the directory containing the library

  2. run ‘sudo ldconfig’

NOTE: You can check where the linker is looking using strace.

sudo strace -f /mnt/legato/start

You’ll see it trying (and failing) to open liblegato.so in a bunch of different directories.

I hope this helps.

–Jen

Hi Jen,

Thanks for replying. I’ve managed to work around this, and I’m not completely sure but I think that the Legato toolchain does not support the Pi version 1 as well as not supporting version 3. I managed to get a build up and running using the raspi toolchain.

That said I am still having general stability issues. I have a Pi 1 and 3 for testing. On the 3, when I start legato it appears to start up normally for about 15 seconds or so but then something triggers a linux magic reboot everytime so I’m unable to actually interact with it.

On the 1, legato will start up and I can interact with it. I’ve installed and run the wifiApTest but the wireless network never appears and I can’t find any logs with information about what the issue might be. I’ve also compiled the sample httpServer but when I install the package the system seems to hang and I start getting errors from the watchdog.

So anyways, lots of issues to work through :slight_smile: I’ll report back if I manage to work through any of them. Any tips are always welcome.

Hi @mike919,
I have the same problem with the raspberry pi 3. It’s seem working but the raspberry reboot after 30s without any log in journalctl or dmesg or in the tty. Did you solve the problem ?

Jean.

Hello @jeanbpi,

I too encountered the same problem. Were you able to solve it? If not are there any workarounds?

Best regards,
Vamsi

Hello @Vamsi3012
Nop sorry, I didn’t solve it…

Hi @mike919,

Could you please share the work around you used? I too are facing the same issues. Also have you worked with Pi 2? Do you faces issues there too?

Regards,
Vamsi

Hi Guys I am having the same problem. I am working with legato 16.10.3 on raspberry pi 3 and I can experiencing the same reboot problem.

Hi @virajpadte,

I have not been able to solve the problem yet. Looks like everyone’s given up on the raspberry pi 3. In case you are able to solve it, please post your solution here.

Regards,
Vamsi

Sure @Vamsi3012 I will let you know. I am trying to look at the logs to identify the reasons for these abrupt restarts.

It could be related to these issues:

What kernel are you running?

What’s in your logs?

Hi @jchitty,

The Kernel I am using is 4.4.50-v7+.
Also when I tried what you suggested here.

Even after setting the path to the library, I see it trying to find something and failing. I am attaching the logs here if it helps.log_2 (313.3 KB)

Thanks in advance :slight_smile:

Regards,
Vamsi

Hi @jchitty,
I am using kernel 4.9.35-v7+. I followed the instructions to cross compile the kernel using a Ubuntu 16.04. When I tried building legato, I faced some issues with the devmode for the releases > 16.10.2. Just to clarify that my target is Raspi3.

Any help will be highly appreciated!

Could anyone figure out a solution for this problem?

There is some on-going issue with kernel >4.8 because of SMACK.
Is the issue that you’re facing with devMode similar to the one in this thread? Any logs?

@CoRfr,

Versions greater than 4.8? But I was using 4.4 and are still facing the problem.

Regards,
Vamsi

Here is the devMode error I was referring about which occurs while building legato latest repository build. I have only been successful in building legato 16.10.2.

I see, that’s unrelated to the topic and a new topic would have been best.
The issue is that there is an assumption that a cross-built ‘gdbserver’ is provided by the toolchain, and if that’s not the case it doesn’t build.

If you edit apps/tools/devMode.adef and comment out the gdbserver line it should build although it won’t be possible to attach gdbserver to an application through gdbCfg.

@CoRfr Thanks for guiding me and yes comment the gdserver line works and I could successfully build legato 17.05.0. Now coming back to the original discussion that raspberry pi is rebooting a few secs after attempting to /./mnt/legato/start I am bit clueless here on how can I collect the logs which could help you understand the problem. Can you guide me?

Here is a excerpt from the syslog if thats helpful.
syslog (7.4 KB)