tadfisher/android-nixpkgs

Executables not runnable

RatCornu opened this issue · 4 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.

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

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

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

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

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.