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

haskell-updates: ld.gold error with unreadable /lib on aarch64-linux aka nix-on-droid #155722

Closed
573 opened this issue Jan 19, 2022 · 5 comments
Closed

Comments

@573
Copy link
Contributor

573 commented Jan 19, 2022

Describe the bug

Linking of sample project fails:

Preprocessing executable 'main' for test-0.0.0..
Building executable 'main' for test-0.0.0..
Linking /data/data/com.termux.nix/files/home/easy-hls-nix/test/dist-newstyle/build/aarch64-linux/ghc-8.10.7/test-0.0.0/x/main/build/main/main ...
/nix/store/l59232a9b5dlip8yi3swyx7km3s35hzj-binutils-2.35.2/bin/ld.gold: error: /lib: can not read directory: Permission denied
collect2: error: ld returned 1 exit status
cc' failed in phase Linker'. (Exit code: 1)

Steps To Reproduce

Steps to reproduce the behavior:

  1. Build https://github.com/573/aarch64-linux-ld-issue155722-reproduce on master using nix-build or cabal build, in fact github-actions do that

Expected behavior

Sample project builds.
The linker should be called with a fallback instead of /lib when /lib exists but is not readable.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Similar issue nmattia/niv#332.
https://github.com/t184256/nix-on-droid/, the system on which this error occurs has no read permissions on /lib.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"aarch64-linux"`
- host os: `Linux 4.4.111-21427293`
- multi-user?: `no`
- sandbox: `no`
- version: `nix-env (Nix) 2.3.15`
- channels(nix-on-droid): `"nix-on-droid-21.05, nixpkgs-21.05.2796.110a2c9ebbf"`
- nixpkgs: `/nix/store/h7lizyjgzjmpj4pc18jxib40s0p8lns5-e49c2d09f8dbf84c6692baef7951518ed398e0e6.tar.gz`
@573
Copy link
Contributor Author

573 commented Jan 22, 2022

Applying the workaround described in linked nmattia/niv#332 didn't help either in this case:

cd ~/src/test && cabal2nix . > myproject.nix
# default.nix
{ pkgs ? import <nixpkgs> {} }:
let
   workaround140774 = hpkg: with pkgs.haskell.lib;
    overrideCabal hpkg (drv: {
        enableSeparateBinOutput = false;
    });
in workaround140774 (pkgs.haskell.packages.ghc8107.callPackage ./myproject.nix { })

@573
Copy link
Contributor Author

573 commented Feb 2, 2022

Asked for help here: https://discourse.nixos.org/t/linker-error-on-aarch64-linux/17296

And here:
nix-community/nix-on-droid#170_

For a reproduction of this see https://github.com/573/aarch64-linux-ld-issue155722-reproduce as well (Actions, nix-build section).

Workaround: I still can start cabal new-repl bypassing the linker and in the repl i. e. run main.

@573 573 changed the title haskell-updates: ld.gold error /lib on aarch64 haskell-updates: ld.gold error /lib on aarch64-linux Feb 3, 2022
@573 573 changed the title haskell-updates: ld.gold error /lib on aarch64-linux haskell-updates: ld.gold error with unreadable /lib on aarch64-linux aka nix-on-droid Feb 5, 2022
@hmih
Copy link

hmih commented Jan 24, 2023

Is there an update on this? I'm hitting this issue for multiple packages.

@573
Copy link
Contributor Author

573 commented Jan 24, 2023

@hmih some person suggested using a more recent ghc (902+ afar).

@573
Copy link
Contributor Author

573 commented Jan 24, 2023

The unreadable "/lib" issue is ingrained to how nix-on-droid (linked nix-community/nix-on-droid#170 above) works, hence I emulated the behaviour https://github.com/573/aarch64-linux-ld-issue155722-reproduce/blob/8a54fd8/.github/workflows/test.yml#L24.

There doesn't seem to be means to handle such circumstance using the linker so I close this for now.

A follow up issue (this time using a remote builder as suggested in nix-community/nix-on-droid#170) is here at haskell/cabal#7950.

Feel free to follow the other ticket or re-open here in case of new findings.

@573 573 closed this as completed Jan 24, 2023
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

3 participants