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

Error: libatomic.so.1: cannot open shared object file: No such file or directory #44

Closed
MatthewCroughan opened this issue Jul 25, 2021 · 11 comments

Comments

@MatthewCroughan
Copy link

Are the releases really static, or do they depend on libraries existing on the host? Is there anything we can do about this?

ERROR: open_dynamic_library: Can't open dynamic library: /home/matthew/git/goatchurchprime/godot_webrtc_mqtt/webrtc/lib/libwebrtc_native.linux.release.64.so. Error: libatomic.so.1: cannot open shared object file: No such file or directory
   At: drivers/unix/os_unix.cpp:415.
@Nachocss
Copy link

Hi there. There are two things I can tell you about this problem, they might be correct or they may not, but it is worth a try.

  • It seems you are building a release version. Be sure your project has webrtc enabled on GDNative tab, under project settings. Otherwise, you can try building a debug version after adding webrtc_debug library to the project and enabling it on GDNative tab.
  • On the other hand, double check webrtc.tres aims to the correct directory. By default, webrtc plugin should be in the root directory of the project. To access the picture's tab, click on webrtc.tres
    image

@Faless
Copy link
Collaborator

Faless commented Jul 26, 2021

@MatthewCroughan the plugin is a shared library. On Linux, it depends on libatomic which should be installed on most systems, since you don't provide any information about your OS, I can't help much further.

@akien-mga
Copy link
Member

Note that it likely only depends on libatomic if it was built with Clang, otherwise it's part of GCC. It could be statically linked like done for Godot itself:
https://github.com/godotengine/godot/blob/master/platform/linuxbsd/detect.py#L432-L440

@MatthewCroughan
Copy link
Author

@MatthewCroughan the plugin is a shared library. On Linux, it depends on libatomic which should be installed on most systems, since you don't provide any information about your OS, I can't help much further.

@Faless Is there anything we can do to not rely on host libraries? It is not possible on NixOS to rely on shared libraries, since the practical goal of NixOS is to do away with that practice.

@MatthewCroughan
Copy link
Author

MatthewCroughan commented Jul 26, 2021

To clarify, on NixOS, I'd have to create a derivation (package) for this, in order to specify the libraries it needs, then provide it to Godot at runtime, and integrate the whole thing. Which is trivial enough, and I'm willing to do it. However, it would be better if this simply didn't rely on host libraries so that it could be a real plugin rather than something that must be integrated into the package ecosystem as I just laid out. This will fail in other scenarios than just Nix, you just haven't discovered those scenarios yet, since you are just trusting that libatomic is around.

@goatchurchprime
Copy link

I just got bitten by this one when trying to get up and running on a completely fresh ubuntu install. I eventually worked out I needed to do:

sudo apt-get install libatomic1

@MatthewCroughan
Copy link
Author

You can workaround this issue on NixOS by using patchelf to link the unincluded library to a locally built one. The following assumes that the static object you want to fix the problem in is in the current directory, such as ./libwebrtc_native.linux.release.64.so

user: matthew ~ 
❯ nix build nixpkgs#gcc-unwrapped.lib

user: matthew ~ 
❯ readlink -f ./result-lib/lib/libatomic.so.1
/nix/store/0kiykyrnrpfhmjwxwx89kxr20hmf5304-gcc-10.3.0-lib/lib/libatomic.so.1.2.0

user: matthew ~ 
❯ patchelf --replace-needed libatomic.so.1 /nix/store/vyqnqbp3yczrzjx2byk6p680q3mzanyw-gcc-10.3.0-lib/lib/libatomic.so.1 ./libwebrtc_native.linux.release.64.so

user: matthew ~ 
❯ ldd ./libwebrtc_native.linux.release.64.so
	linux-vdso.so.1 (0x00007ffc3732d000)
	/nix/store/vyqnqbp3yczrzjx2byk6p680q3mzanyw-gcc-10.3.0-lib/lib/libatomic.so.1 (0x00007f5af787c000)
	libm.so.6 => /nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib/libm.so.6 (0x00007f5af7739000)
	libc.so.6 => /nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib/libc.so.6 (0x00007f5af7578000)
	/nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib64/ld-linux-x86-64.so.2 (0x00007f5af84d7000)
	libpthread.so.0 => /nix/store/73k2knwhv4zzizsjr1g1dqjvzkamx8bd-glibc-2.33-49/lib/libpthread.so.0 (0x00007f5af7558000)

@Faless
Copy link
Collaborator

Faless commented Jun 16, 2022

Closing as fixed after #51 , you can test the alpha release.
Feel free to comment if the issue is still present.

@Faless Faless closed this as completed Jun 16, 2022
@goatchurchprime
Copy link

@Faless Can we re-open this issue for Godot 4 as there is an issue on NixOS with the libstdc++.so

This is what it does on startup for me.

Editing project: /home/julian/repositories/godot-demo-projects/networking/webrtc_minimal
ERROR: Can't open dynamic library: /home/julian/repositories/godot-demo-projects/networking/webrtc_minimal/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so. Error: libstdc++.so.6: cannot open shared object file: No such file or directory
   at: open_dynamic_library (drivers/unix/os_unix.cpp:447)
ERROR: GDExtension dynamic library not found: /home/julian/repositories/godot-demo-projects/networking/webrtc_minimal/webrtc/lib/libwebrtc_native.linux.template_debug.x86_64.so
   at: open_library (core/extension/gdextension.cpp:400)
ERROR: Failed loading resource: res://webrtc/webrtc.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:222)
ERROR: Error loading extension: res://webrtc/webrtc.gdextension

(Why is it taking the debug library and not the release version? Does this mean my version of Godot has been compiled as a debug, so this is the compatible one?)

I hacked it so it worked by following @MatthewCroughan's method above:

$ nix build github:nixos/nixpkgs/nixos-unstable#gcc-unwrapped.lib

$ readlink -f result-lib/lib64/libstdc++.so.6
/nix/store/v286z87irid5vn13y2z6fphfrzmgj0kf-gcc-12.3.0-lib/lib/libstdc++.so.6.0.30

$ patchelf --replace-needed libstdc++.so.6 /nix/store/v286z87irid5vn13y2z6fphfrzmgj0kf-gcc-12.3.0-lib/lib/libstdc++.so.6.0.30 ./libwebrtc_native.linux.template_debug.x86_64.so

$ ldd libwebrtc_native.linux.template_debug.x86_64.so
linux-vdso.so.1 (0x00007ffc346fb000)
	/nix/store/v286z87irid5vn13y2z6fphfrzmgj0kf-gcc-12.3.0-lib/lib/libstdc++.so.6.0.30 (0x00007ffa3caa4000)
	libm.so.6 => /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libm.so.6 (0x00007ffa3c9c4000)
	libgcc_s.so.1 => /nix/store/0fvh2p4irz0lw0cpy2ll1rf2hbhbym3g-xgcc-12.2.0-libgcc/lib/libgcc_s.so.1 (0x00007ffa3c9a3000)
	libc.so.6 => /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libc.so.6 (0x00007ffa3c7bd000)
	/nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007ffa3d54f000)

Now it works, but just for me.

@Faless
Copy link
Collaborator

Faless commented Jun 29, 2023

Can we re-open this issue for Godot 4 as there is an issue on NixOS with the libstdc++.so

It's better to open a new issue, since this is not about libatomic.so/clang (and the original issue was even about the old plugin using google webrtc library).

@Faless
Copy link
Collaborator

Faless commented Jun 29, 2023

I've opened #110 to track it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants