I cleaned up the code and now it seems to work, but things are still strange.
The absolute path now works, but the second one (and maybe the first)
should have as well.
for _, path in ipairs{"crypt", "crypt-2.17", "/lib/libcrypt.so.1"} do
local ok, obj = pcall (ffi.load, path)
if ok then
lib.lib = obj
print (string.format("Loaded %q", path)) -- DEBUG
return true
else
print (string.format("Loading %q failed: %s", path, obj))
end
end
Here is the environment:
/ramdisk/var/opt/dotd/lua # echo $LD_LIBRARY_PATH
/var/opt/lib:/lib
/ramdisk/var/opt/dotd/lua # ls /lib/libcrypt*
/lib/libcrypt-2.17.so /lib/libcrypt.so.1
/ramdisk/var/opt/dotd/lua # ls /var/opt/lib/libcrypt*
ls: /var/opt/lib/libcrypt*: No such file or directory
Thanks,
Dan
On Wed, May 11, 2016 at 2:26 PM, Dan Christian <danchristian65@xxxxxxxxx> wrote:
The library is there.
If I symlink it to libcrypt.so (in a directory that's in
LD_LIBRARY_PATH), then I can load it.
I'd like to be able to load it without the symlink.
Dan
On Wed, May 11, 2016 at 1:22 PM, Sean Conner <sean@xxxxxxxxxx> wrote:
It was thus said that the Great Dan Christian once stated:
I'm trying to load a shared library in an embedded ARM Linux
environment. It won't work if the library path has a version number
after it.
ffi.load("/lib/libcrypt.so.1")
Fails with libcrypt.so: cannot open shared object file: No such file
or directory.
Is there a way to get it to load a versioned so?
Let's start simple: what does "ls -l /lib/libcrypt.so.1" show?
-spc