RPI won’t load shared libraries
error while loading shared libraries: libntcore.so : cannot open shared object file: No such file or directory
When compiled, everything works fine, but when I try to execute, the error pops.
What I have tried :
run ldconfig
check if my file is in the right place (/usr/lib)
set LD_LIBRARY_PATH to :/usr/lib by running LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
By the way, I am using a NOOBS os.
Any help would be really appreciated!
Not sure what your exact problem is, but I find the output from ldd is generally pretty enlightening. Try:
ldd *your_app*
And see if the shared library list is what you expect. Also run ldd on the shared library with the load issue, as it may in turn be failing to load due to missing dependencies.
ldd * libntcore.so*
Tank you very much phurley67, I ran ldd on both my executable and my shared library. On the executable, everything looks normal, but on the shared library ldd says : “not a shared library”.
What does it mean?
Any help would once again be very appreciated!
I don’t have a PI with me at the moment, but most linux distributions also include a program called “file”
file *libraryname*
and see what it says. I would expect something like
ELF 32-bit LSB shared object...
But if it is not a shared library you will get a different response. It may also be a symlink to another file, in that case run file on the link until you find the “real” file.
Hi,
Strangely, “$ file libntcore.so” returned :
“libntcore.so: ELF 32-bit LSB shared object, ARM, EAI% version 1 (GNU/Linux), dynamically linked, not stripped”
Is it supposed to do that?
thank you in advance!
Is it supposed to do that?
That is what it is supposed to show, but not how I would expect it to look if you cannot load it. At this point my best guess is that libntcore.so might be corrupted, might want to try re-downloading and copying the file – at which point you may also want to rebuild your application, just to be safe and see if that helps.
There is a command nm that will display a symbol table from a binary, but at this point I am not sure how much that would really tell us. It will either fail to display information for libntcore.so in which case we can be pretty sure it is corrupt, or it will work and we won’t really know more than we do not, and I would still guess to replace the file…
Hi,
thanks for your answer. I tried using nm on libntcore.so and it gave hundreds of line of incomprehensible stuff, here are a few lines :
0005fb10 T _ZN2nt12WriteUleb128ERN4llvm15SmallVectorImplIcEEm
0004c328 T _ZN2nt13GetEntryFlagsEN4llvm9StringRefE
0004c1bc T _ZN2nt13GetEntryValueEN4llvm9StringRefE
0004cfd8 T _ZN2nt13PackRpcValuesEN4llvm8ArrayRefISt10shared_ptrINS_5ValueEEEE
00078990 W _ZN2nt13RpcDefinitionD1Ev
00078990 W _ZN2nt13RpcDefinitionD2Ev
0004c274 T _ZN2nt13SetEntryFlagsEN4llvm9StringRefEj
0004e3cc T _ZN2nt13SetEntryValueEN4llvm9StringRefESt10shared_ptrINS_5ValueEE
0004d628 T _ZN2nt13SetUpdateRateEd
0004d4e8 T _ZN2nt13StopRpcServerEv
0002e6b8 W _ZN2nt14ConnectionInfoD1Ev
0002e6b8 W _ZN2nt14ConnectionInfoD2Ev
Tanks in advance!
Hi,
I have tested something and it gave me weird results :
I typed ldconfig - p and my library was found, but when I typed **ldd **on my executable, my library wasn’t found. Could it be the core of the problem?
Tanks in advance!
Not sure, can you paste the output of both of those commands? (put it in code tags so it can be scrolled).
Ok, thank you for your fast response, I will copy-paste the output tomorrow, when I will have access to the RPI!
HI here are the weird results of the commands :
**ldd <Name_of_my_Executable> **:
linux-vdso.so.1 (0x7efd2000)
/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f4f000)
libntcore.so => not found
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76df2000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76d73000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76d46000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c07000)
/lib/ld-linux-armhf.so.3 (0x76f64000)
**ldconfig -p **(I only put a part of the output) :
libodfgen-0.1.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libodfgen-0.1.so.1
libobt.so.2 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libobt.so.2
libobrender.so.32 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libobrender.so.32
liboauth.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/liboauth.so.0
libntcore.so (libc6,soft-float) => /usr/lib/libntcore.so
libntcore.so (libc6,AArch64) => /usr/local/lib/libntcore.so
libnss3.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libnss3.so
libnssutil3.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libnssutil3.so
libnss_nisplus.so.2 (libc6,hard-float, OS ABI: Linux 3.2.0) => /lib/arm-linux-gnueabihf/libnss_nisplus.so.2
libnss_nisplus.so (libc6,hard-float, OS ABI: Linux 3.2.0) => /usr/lib/arm-linux-gnueabihf/libnss_nisplus.so
so libntcore is found and not found according to different commands…
Thank in advance!
It looks like neither of the two ntcores on your RPi are for the right architecture. all of the other shared objects say “hard-float” while neither of yours do.
Where are they coming from? Are you building them or getting them from somewhere?
Hi, thanks to all, I have solved my problem!
The symptoms :
When I typed, in the correct directory,
file libntcore.so
, I
remarked that that the output was something like :
...]
(GNU/Linux) ...]
while my other working librries outputted
something like :
...] (SYSV) ...]
How to fix it :
To fix it I simply took the libraries from the last post of [this thread](https://www.chiefdelphi.com/forums/showthread.php?t=142570),
added the path to the libs in LD_LIBRARY_PATH using export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<Path_To_Libraries>
and it
worked fine!