Skip to content

Failure building pkgsCross.aarch64-android-prebuilt.bash #147084

Open

Description

@io12

Describe the bug

When cross compiling bash for aarch64-android-prebuilt, the build fails.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-build '<nixpkgs>' -A pkgsCross.aarch64-android-prebuilt.bash
  2. Observe error

Expected behavior

The build should succeed.

Additional context

Output log: https://paste.rs/mnq

Notify maintainers

@dtzWill

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.0-9-amd64, Debian GNU/Linux, 11 (bullseye)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4`
 - channels(user): `"nixpkgs-21.11pre333180.98747f27ecf"`
 - channels(root): `"nixpkgs-21.11pre332724.73f81a044cf"`
 - nixpkgs: `/home/user/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: [pkgsCross.aarch64-android-prebuilt.bash]
# a list of nixos modules affected by the problem
module:

Activity

  1. added
    0.kind: bug
    on Nov 23, 2021
  2. added
    6.topic: cross-compilation
    on Nov 23, 2021
  3. io12 commented on Dec 8, 2021

    @io12
    MemberAuthor

    I think I figured out the cause of the error. With hardening enabled, bionic uses different header files that use inline functions instead of prototypes, and this causes the getcwd() redefinition error. Also, the pkg-config package's autoconf script doesn't enable -Werror=implicit-function-declaration during ./configure, but does enable it when compiling, and this causes a build failure because pthread.h doesn't contain pthread_cond_timedwait_monotonic.

    This patch fixes it:

    diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix
    index b0b3115700f..970a39c7ce7 100644
    --- a/pkgs/development/tools/misc/pkg-config/default.nix
    +++ b/pkgs/development/tools/misc/pkg-config/default.nix
    @@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
     
       outputs = [ "out" "man" "doc" ];
     
    +  hardeningDisable = [ "all" ];
    +
       # Process Requires.private properly, see
       # http://bugs.freedesktop.org/show_bug.cgi?id=4738, migrated to
       # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/28
    @@ -34,6 +36,7 @@ stdenv.mkDerivation rec {
              "glib_cv_uscore=no"
              "ac_cv_func_posix_getpwuid_r=yes"
              "ac_cv_func_posix_getgrgid_r=yes"
    +         "CFLAGS=-Werror=implicit-function-declaration"
            ];
     
       enableParallelBuilding = true;
    diff --git a/pkgs/shells/bash/5.1.nix b/pkgs/shells/bash/5.1.nix
    index efa90b0499e..c2c8f53b9cf 100644
    --- a/pkgs/shells/bash/5.1.nix
    +++ b/pkgs/shells/bash/5.1.nix
    @@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
         sha256 = "1alv68wplnfdm6mh39hm57060xgssb9vqca4yr1cyva0c342n0fc";
       };
     
    -  hardeningDisable = [ "format" ];
    +  hardeningDisable = [ "all" ];
     
       outputs = [ "out" "dev" "man" "doc" "info" ];

    I know this can't be merged as-is because it disables hardening on all platforms instead of just Android, but I don't know enough about Nix yet to figure out the right way to fix this.

    Thanks!

  4. added
    2.status: stale
    on Jun 19, 2022
  5. exarkun commented on Nov 16, 2022

    @exarkun
    Contributor

    At first I thought this was fixed by #192630. The issue being fixed there is the same incompatible getcwd declaration as is described here. The fix there is a bit different. However, then I noticed this is about aarch64-android-prebuilt.bash and that package still fails to build - but with a different error:

    error: infinite recursion encountered
    
           at /home/exarkun/Work/PrivateStorage/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:295:14:
    
              294|       args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
              295|       inherit stdenv;
                 |              ^
              296|
    

    So I don't know if #192630 really fixed the specific build error described here or not.

  6. removed
    2.status: stale
    on Nov 16, 2022
  7. added
    2.status: stale
    on Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug2.status: stale6.topic: cross-compilation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions