android-nixpkgs icon indicating copy to clipboard operation
android-nixpkgs copied to clipboard

Executables not runnable

Open RatCornu opened this issue 1 year ago • 3 comments

I tried to use some build tools, but I always get the same error: Could not start dynamically linked executable. It happened while I'm trying to build an Android app. The issue is not the same if running by hand or during a build env:

  • By hand:
    $ /nix/store/psrz7yh75aiblnwwjan08mi54mp2apf1-android-sdk-env/share/android-sdk/build-tools/34.0.0/zipalign 
    Could not start dynamically linked executable: /nix/store/psrz7yh75aiblnwwjan08mi54mp2apf1-android-sdk-env/share/android-sdk/build-tools/34.0.0/zipalign
    NixOS cannot run dynamically linked executables intended for generic
    linux environments out of the box. For more information, see:
    https://nix.dev/permalink/stub-ld
    
  • In a build env:
    > /nix/store/xfhkjnpqjwlf6hlk1ysmq3aaq80f3bjj-stdenv-linux/setup: line 123: /nix/store/w5fm31fb3lj7k8c518n7a36dh1kk667d-build-tools-34-0-0-34/zipalign: cannot execute: required file not found
    > /nix/store/xfhkjnpqjwlf6hlk1ysmq3aaq80f3bjj-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context
    

The issue is the same with the following commands: aapt, aapt2, aidl, bcc_compat, d8, dexdump, lld, llvm-rs-cc, splitèselect and zipalign.

Seems related to #99 but I am not sure.

RatCornu avatar Jun 15 '24 12:06 RatCornu

It is most likely related to #99. The solution was to run autoPatchelf $out in the postUnpack phase of the derivation. Similar to this #102 - will try to raise a PR soon if no one else gets round to it

HPRIOR avatar Jun 15 '24 16:06 HPRIOR

Are you calling these directly from the store? I'm using the default flake provided by the repo and they're not in my PATH

HPRIOR avatar Jun 16 '24 08:06 HPRIOR

Yes I'm calling them directly from the store as subfolder is not is /bin thus in the PATH

RatCornu avatar Jun 16 '24 08:06 RatCornu

I'm still getting the same error after updating to 6cc08eaad99b1f7c677f002110b3a0a1116cc5d7:

Could not start dynamically linked executable: /nix/store/d6ha4xhym5ibiy4105qfznsprdpxzbln-android-sdk-env/share/android-sdk/build-tools/30.0.3/aapt
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

This binary was called from a flutter run command.

fdietze avatar Sep 25 '24 22:09 fdietze