rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.79k stars 314 forks source link

ld-elf.so.1: Cannot open "/usr/local/$LIB/bear/libexec.so" on FreeBSD #409

Closed Jehops closed 2 years ago

Jehops commented 3 years ago

Describe the bug I'm working on upgrading the FreeBSD package to 3.0.15. Run-time testing now gives the error in the subject. It ran fine in version 3.0.14. This happens regardless whether supplying a value for DCMAKE_INSTALL_LIBDIR.

Environment: FreeBSD 13.0

wortiz commented 3 years ago

Same thing happens on Ubuntu 20.04 (with latest cmake)

Seems it was introduced with e796080d as reverting that commit appears to fix the issue

Edit here is my error:

ERROR: ld.so: object '/home/wortiz/.local/opt/bear-3.0.15/$LIB/bear/libexec.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
rizsotto commented 3 years ago

@wortiz The INSTALL.md has instruction how to make that work on Debian derivative Linux distributions. Basically you need to expand the $LIB to lib/x86_64-linux-gnu. (So, when you install it to your home, you still need to check if the libexec.so file is in /home/wortiz/.local/opt/bear-3.0.15/lib/x86_64-linux-gnu/bear/libexec.so.)

rizsotto commented 3 years ago

@Jehops can you help me out, if $LIB is a known literal by the dynamic linker on FreeBSD? In linux it does expand to the right library name where the dynamic linker would search for files (see this man page).

If that is not exists on FreeBSD, then I'll come up with a workaround for it.

Jehops commented 3 years ago

@rizsotto, unfortunately it doesn't seem to have that particular token string.

rizsotto commented 2 years ago

@Jehops , devel branch has a version which does check the OS type and does the $LIB only on linux. Could you try that out? If that works, I'm making a release with this fix.

Jehops commented 2 years ago

@rizsotto, I tested g5fc0c86 and it works. Thank you.

rizsotto commented 2 years ago

Fix released as 3.0.16