go-tflite icon indicating copy to clipboard operation
go-tflite copied to clipboard

Cannot open shared object file: No such file or directory... part 2

Open zmajew opened this issue 3 years ago • 4 comments

I have followed the instructions from issue and still have: /tmp/go-build1465283250/b001/exe/main: error while loading shared libraries: libtensorflowlite_c.so: cannot open shared object file: No such file or directory exit status 127

I put the libtensorflowlite_c.so into the /usr/local/lib and export LD_LIBRARY_PATH=/usr/local/lib and in /etc/environment but does not help. I am trying to run esrgan example.

tflite.go has: /* #ifndef GO_TFLITE_H #include "tflite.go.h" #endif #cgo LDFLAGS: -ltensorflowlite_c #cgo android LDFLAGS: -ldl #cgo linux,!android LDFLAGS: -ldl -lrt */` I am using Go 1.17

zmajew avatar Jan 28 '22 13:01 zmajew

What do you get:

$ ldd /usr/local/lib/libtensorflowlite_c.so

mattn avatar Jan 28 '22 15:01 mattn

I have followed this instruction and solved the problem. Now, on: $ ldd /usr/local/lib/libtensorflowlite_c.so I got: linux-vdso.so.1 (0x00007ffcfc7f8000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f09843cd000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f098427e000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f098425b000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0984255000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f098424a000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f098422f000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f098403b000) /lib64/ld-linux-x86-64.so.2 (0x00007f0984889000) But I still do not know where was the problem. On go get github.com/mattn/go-tflite it saw the usr/local/lib/libtensorflowlite_c.so but when I compiled the example it threw a "Cannot open shared object file..." error

zmajew avatar Jan 29 '22 06:01 zmajew

I was trying to trace from where the path usr/local/lib was taken but I did not manage to find that.

zmajew avatar Jan 29 '22 06:01 zmajew

I've had the same issue, and the problem was about the env var LD_LIBRARY_PATH that was empty. I've copied the .so file to /usr/local/lib and typed the following command -> export $LD_LIBRARY_PATH=/usr/local/lib and this fixed the problem. Don't if this solution can be helpful, anyway i've obtained the following output, launching the main.go (go run main.go) -> 85: peacock: 0.976471

SpAndrea117 avatar Mar 31 '22 09:03 SpAndrea117