Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libretdec-libelf.so: cannot open shared object file: No such file or directory #100

Closed
prosteja opened this issue Jan 22, 2018 · 2 comments

Comments

@prosteja
Copy link

I install retdec manually in docker on clean ubuntu 17.10. following steps in Dockerfile(except I am using /app/retdec as installation prefix) Everything works fine unless I (re)move build directory. When I run retdec-decompiler.sh or just retdec-fileinfo after that I get the following error:
/app/retdec/bin/retdec-fileinfo: error while loading shared libraries: libretdec-libelf.so: cannot open shared object file: No such file or directory
This can help:

ldd /app/retdec/bin/retdec-fileinfo | grep retdec
	libretdec-libdwarf.so => /app/retdec/bin/../lib/libretdec-libdwarf.so (0x00007f1e0261d000)
	libretdec-libelf.so => not found

And:

readelf -d /app/retdec/bin/retdec-fileinfo | grep 'R.*PATH'
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]

If I leave build dir in place:

ldd /app/retdec/bin/retdec-fileinfo | grep retdec
	libretdec-libdwarf.so => /app/retdec/bin/../lib/libretdec-libdwarf.so (0x00007f2695f7c000)
	libretdec-libelf.so => /retdec/build/external/src/libdwarf-project-install/lib/libretdec-libelf.so (0x00007f269508a000)

Thank you for your work!

@s3rvac
Copy link
Member

s3rvac commented Jan 23, 2018

Thank you for the report. I was able to reproduce it on Ubuntu 17.10 (Artful Aardvark) inside Docker.

The reason why it does not work is that CMake on Ubuntu 17.10 sets RUNPATH when installing RetDec while on other systems, it sets RPATH. The difference between them is that RPATH has a global effect, i.e. it is used to find both direct and transitive dependencies, while RUNPATH is used only to find direct dependencies. For more information, see e.g. this post.

We will have to either set a proper RUNPATH when installing libretdec-dwarf.so (currently, it points to the build directory), or force the use of RPATH instead of RUNPATH (I would not recommend this; rather, we should try to set a proper RUNPATH when installing libretdec-dwarf.so).

@s3rvac s3rvac self-assigned this Jan 23, 2018
s3rvac added a commit that referenced this issue Jan 23, 2018
The updated version contains commit 85465d5e235cc2d2f90d04016d6aca1a452d0e73,
which fixes the setting of RPATH during installation (#100).
s3rvac added a commit that referenced this issue Jan 23, 2018
@s3rvac
Copy link
Member

s3rvac commented Jan 23, 2018

Fixed in b0a9829.

Details: The above commit updates the used version of our libdwarf repository. This new version contains commit 85465d5, in which I have fixed the setting of runtime paths during installation. For libdwarf, we have to set the runtime path to $ORIGIN so it is able to find libelf, which is installed into the same directory as libdwarf.

I have verified the fix on Ubuntu 17.10 inside Docker. Current runtime paths:

$ readelf -d bin/retdec-fileinfo | grep 'R.*PATH'
0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]
$ readelf -d lib/*.so | grep 'R.*PATH'
0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
$ ldd bin/retdec-fileinfo | grep retdec
libretdec-libdwarf.so => /home/retdec/retdec-install/bin/../lib/libretdec-libdwarf.so (0x00007ffa7c80f000)
libretdec-libelf.so => /home/retdec/retdec-install/bin/../lib/libretdec-libelf.so (0x00007ffa7b91d000)

@s3rvac s3rvac closed this as completed Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants