Error while loading linux shared libraries

  • Thread starter Thread starter Deleted member 62382
  • Start date Start date
  • Tags Tags
    solved
D

Deleted member 62382

Guest
Hello,

I'm trying to use a linux binary on FreeBSD.
I've followed the instructions from the handbook.

When I tried to run the binary, I got this error message:

Code:
/lib64/libc.so.6: version `GLIBC_2.18' not found (required by ./deno)

I then launched a CentOS instance and copied /lib64/libc-2.28.so to my FreeBSD system.
I then created a new symlink and have these two files in /compat/linux/lib64

Code:
...
-rwxr-xr-x  1 root  wheel  4176104 Sep  1 10:04 libc-2.28.so
lrwxr-xr-x  1 root  wheel       12 Sep  1 10:06 libc.so.6 -> libc-2.28.so
...


When I try to execute the binary, I now have this error message:
Code:
./deno: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

It seems the symlink is not working for whatever reason. Does someone has any idea why?
 
Code:
strings /lib64/libstdc++.so.6 | grep GLIBC

Probably there is no GLIBC_2.18 in the output so that`s why you are getting "cannot open shared object file"
 
You're right, there's no GLIBC_2.18 when I run your command.
Why using this commande on libstdc++.so.6 though?

When i run:
Code:
strings /compat/linux/lib64/libc.so.6 | grep GLIBC

there's GLIBC_2.18 in the output
 
You're right, there's no GLIBC_2.18 when I run your command.
Why using this commande on libstdc++.so.6 though?

When i run:
Code:
strings /compat/linux/lib64/libc.so.6 | grep GLIBC

there's GLIBC_2.18 in the output

If there is GLIBC_2.18 there, there could be a symlink issue. Not sure, please discard my previous message, i wrote it wrong.

Can you move the symlink to a backup file then hard copy libc-2.28.so to libc.so.6 and try running ./deno
 
I get the same error when I copy (with either cp or ln) libc-2.28.so to libc.so.6
 
If i remeber correctly (at least under linux) "cannot open shared object file" might as well mean that some dependencies could not be satisfied but then libc.so shouldn't really have any? Might still be worth checking what ldd thinks of libc.so.6.
 
I can't use ldd because it only works on FreeBSD binaries.
The linux one ( /compat/linux/usr/bin/ldd) doesn't work: same error message than when trying to run ./deno
 
This is what I've done recently to run an recent linux binary (don't do this on a production server, do some tests before):

Code:
# as a normal user:
mkdir update_centos8
cd update_centos8
fetch http://mirror.centos.org/centos-8/8.2.2004/BaseOS/x86_64/os/Packages/glibc-2.28-101.el8.x86_64.rpm

tar xf glibc-2.28-101.el8.x86_64.rpm ./lib64/ld-2.28.so
tar xf glibc-2.28-101.el8.x86_64.rpm ./lib64/libc-2.28.so
tar xf glibc-2.28-101.el8.x86_64.rpm ./lib64/libpthread-2.28.so

# as root (replace "/home/user" with the correct path):
cd /compat/linux/lib64
cp -f /home/user/update_centos8/lib64/* .

rm libc.so.6 ld-linux-x86-64.so.2 libpthread.so.0
ln -s ld-2.28.so ld-linux-x86-64.so.2
ln -s libc-2.28.so libc.so.6
ln -s libpthread-2.28.so libpthread.so.0

# then this command should work
/compat/linux/bin/ls

EDIT: fix various mistakes
 
Are you trying to run this program https://github.com/denoland/deno/ ?
Yes, it's deno.

This is what I've done recently to run an recent linux binary (don't do this on a production server, do some tests before):

Code:
# as a normal user:
mkdir update_centos8
cd update_centos8
fetch http://mirror.centos.org/centos-8/8.2.2004/BaseOS/x86_64/os/Packages/glibc-2.28-101.el8.x86_64.rpm

tar xf glibc-2.28-101.el8.x86_64.rpm ./lib64/ld-2.28.so
tar xf glibc-2.28-101.el8.x86_64.rpm ./lib64/libc-2.28.so
tar xf glibc-2.28-101.el8.x86_64.rpm ./lib64/libpthread-2.28.so

# as root (replace "/home/user" with the correct path):
cd /compat/linux/lib64
cp -f /home/user/update_centos8/lib64/* .

rm libc.so.6 ld-linux-x86-64.so.2 libpthread.so.0
ln -s ld-2.28.so ld-linux-x86-64.so.2
ln -s libc-2.28.so libc.so.6
ln -s libpthread-2.28.so libpthread.so.0

# then this command should work
/compat/linux/bin/ls

EDIT: fix various mistakes


Thanks for you answer. I've tried to run what you wrote but I get FATAL: kernel too old whenever I try to run any binary from /compat/linux.
Is there any step you forgot to mention?
 
I've tried to run the same command on 13-current. /compat/linux/bin/ls and the other linux binaries are working fine. However, I get Segmentation fault (core dumped) when running ./deno. Do you have any idea why?
Thanks for the link. I'll try your port later, but I'd also like to make the linux ./deno binary work on FreeBSD.
 
I've tried to run the same command on 13-current. /compat/linux/bin/ls and the other linux binaries are working fine. However, I get Segmentation fault (core dumped) when running ./deno. Do you have any idea why?
Probably some incompatible old libs, it seems to work if you update the whole glibc, ie something like that tar xpf /root/update_centos8/glibc-2.28-101.el8.x86_64.rpm -C /compat/linux/ (or use rsync if you have some symlink errors)
 
Screenshot 2020-09-10 at 10.02.28.png

It's finally working. Thanks a lot for your help and explanations, I really appreciate it :)
 
The compilation just finished and it's working. Thanks for you work!
Please note I had to delete the if line 22 and 349 of the Makefile, because I had this error message: line 23: Malformed conditional.
I also had to run portsnap fetch extract because of this error message: make: "/usr/share/mk/bsd.port.mk" line 32: Cannot open /usr/ports/Mk/bsd.port.mk
 
The compilation just finished and it's working. Thanks for you work!
Please note I had to delete the if line 22 and 349 of the Makefile, because I had this error message: line 23: Malformed conditional.
I also had to run portsnap fetch extract because of this error message: make: "/usr/share/mk/bsd.port.mk" line 32: Cannot open /usr/ports/Mk/bsd.port.mk
Weird, I don't have this error. Do you build with poudriere? Do you have a build log available?
Thanks for testing!
 
You're welcome! I built it with sudo make. I haven't had time to use poudriere yet. And no sorry I don't have the build log availables
 
Back
Top