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

Fix zig_host_app on NixOS #6042

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

jecaro
Copy link
Contributor

@jecaro jecaro commented Nov 21, 2023

That's a problem with the dynamic loader:
https://discourse.nixos.org/t/no-such-file-of-directory-when-trying-to-execute-binary-file/6150

When linking libapp.so with host.zig, zig puts in the binary the standard path for the dynamic loader on linux:
/lib64/ld-linux-x86-64.so.2

However in NixOS, that file is somewhere else in the nix store (see: https://nixos.wiki/wiki/Packaging/Binaries#The_Dynamic_Loader). Removing the -target switch makes zig uses the host target for linking and puts the right path to the dynamic loader in the resulting binary. As we want to execute that binary file in this test, it makes sense to use the default target anyway.

Note that this is relevant for the creation of the binary only. For the creation of the object file, it doesn't really matter. But I removed the -target switch as well there for consistency.

Fix #4180

That's a problem with the dynamic loader:
https://discourse.nixos.org/t/no-such-file-of-directory-when-trying-to-execute-binary-file/6150

When linking `libapp.so` with `host.zig`, zig puts in the binary the
standard path for the dynamic loader on linux:
`/lib64/ld-linux-x86-64.so.2`

However in NixOS, that file is somewhere else in the nix store (see:
https://nixos.wiki/wiki/Packaging/Binaries#The_Dynamic_Loader). Removing
the `-target` switch makes zig uses the host target for linking and puts
the right path to the dynamic loader in the resulting binary. As we want
to execute that binary file in this test, it makes sense to use the
default target anyway.

Note that this is relevant for the creation of the binary only. For the
creation of the object file, it doesn't really matter. But I removed the
`-target` switch as well there for consistency.

Fix roc-lang#4180
@Anton-4
Copy link
Collaborator

Anton-4 commented Nov 21, 2023

Prime investigative work @jecaro! Thank you very much :)

@Anton-4 Anton-4 merged commit 1f0f25f into roc-lang:main Nov 21, 2023
14 checks passed
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

Successfully merging this pull request may close these issues.

elf::tests::zig_host_app failure on NixOS
2 participants