`ndk-21-4-7075529` fails to build due to missing libpython2.7
PapaTutuWawa opened this issue · 1 comments
PapaTutuWawa commented
It seems like ndk-21-4-7075529
(at least; I did not test any other NDK package) fails to build due
to a missing dependency of libpython2.7
during fixup. Overriding the package to also include python27
fixes this (for me).
Flake to reproduce
{
description = "My Android project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
android.url = "github:tadfisher/android-nixpkgs";
};
outputs = { self, nixpkgs, devshell, flake-utils, android }:
{
overlay = final: prev: {
inherit (self.packages.${final.system}) android-sdk android-studio;
};
}
//
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
overlays = [
devshell.overlays.default
self.overlay
];
};
in
{
packages = {
android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs; [
# Useful packages for building and testing.
build-tools-30-0-2
cmdline-tools-latest
emulator
platform-tools
platforms-android-30
ndk-21-4-7075529
]);
};
}
);
}
Build using nix build .#android-sdk
.
The build failure
auto-patchelf: 7 dependencies could not be satisfied
error: auto-patchelf could not satisfy dependency libpython2.7.so.1.0 wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/liblldb.so
error: auto-patchelf could not satisfy dependency libpython2.7.so.1.0 wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/liblldb.so.9.0.9svn
error: auto-patchelf could not satisfy dependency libpython2.7.so.1.0 wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/liblldb.so.9svn
warn: auto-patchelf ignoring missing liblog.so wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9/lib/linux/libclang_rt.asan-x86_64-android.so
warn: auto-patchelf ignoring missing liblog.so wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9/lib/linux/libclang_rt.scudo-x86_64-android.so
warn: auto-patchelf ignoring missing liblog.so wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9/lib/linux/libclang_rt.scudo_minimal-x86_64-andro>
warn: auto-patchelf ignoring missing liblog.so wanted by /nix/store/0si65fkwivqnhvqcf6d9zaq3b2brkzdg-ndk-21-4-7075529-21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9/lib/linux/libclang_rt.ubsan_standalone-x86_64-an>
auto-patchelf failed to find all the required dependencies.
Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`.
/nix/store/fzb9wy1yz0hn69vxw12954szvrjnjjgk-stdenv-linux/setup: line 144: pop_var_context: head of shell_variables not a function context
I only included the end as that's the only occurence of the string error
.
The workaround
As already mentioned, I was able to build the NDK package by just overriding it and including python27
in its build inputs.
{
description = "My Android project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
android.url = "github:tadfisher/android-nixpkgs";
};
outputs = { self, nixpkgs, devshell, flake-utils, android }:
{
overlay = final: prev: {
inherit (self.packages.${final.system}) android-sdk android-studio;
};
}
//
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"python-2.7.18.6"
];
};
overlays = [
devshell.overlays.default
self.overlay
];
};
in
{
packages = {
android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs; [
# Useful packages for building and testing.
build-tools-30-0-2
cmdline-tools-latest
emulator
platform-tools
platforms-android-30
(ndk-21-4-7075529.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.python27 ];
}))
]);
};
}
);
}
EDIT: I tested this with all four available channels. On every channel, the build failed with the exact same error.
tadfisher commented
The issue is LLDB grew a Python dependency in NDK 21 only.