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

perl: fix configure phase for Aarch32 #76922

Merged
merged 1 commit into from Jan 13, 2020
Merged

Conversation

@thefloweringash
Copy link
Member

@thefloweringash thefloweringash commented Jan 4, 2020

In "perl: fuse configureFlags" [1] the effects of the preConfigure
phase were merged into configureFlags. After this change values with
spaces do not reach the configure script intact.

The only flag this affects is ldflags for Aarch32 and Mips, and perl
builds without it on armv7l-linux so it's probably no longer required
on any platform.

Fixes:

configuring
configure flags: -de -Dcc=cc <...> -Dldflags=\"-lm -lrt\"
./Configure: eval: line 1677: unexpected EOF while looking for matching `"'
./Configure: eval: line 1678: syntax error: unexpected end of file
Configure: unknown option -lrt"

[1] 3b50d04

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS (armv7l-linux vm, systems: armv5tel-linux, armv7l-linux)
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @lopsided98 @globin

In "perl: fuse configureFlags" [1] the effects of the preConfigure
phase were merged into configureFlags. After this change values with
spaces do not reach the configure script intact.

The only flag this affects is `ldflags` for Aarch32 and Mips, and perl
builds without it on armv7l-linux so it's probably no longer required
on any platform.

Fixes:

    configuring
    configure flags: -de -Dcc=cc <...> -Dldflags=\"-lm -lrt\"
    ./Configure: eval: line 1677: unexpected EOF while looking for matching `"'
    ./Configure: eval: line 1678: syntax error: unexpected end of file
    Configure: unknown option -lrt"

[1] 3b50d04
@volth
Copy link
Contributor

@volth volth commented Jan 4, 2020

let's check cross-compilation

@volth
Copy link
Contributor

@volth volth commented Jan 4, 2020

@GrahamcOfBorg build pkgsCross.armv7l-hf-multiplatform.perl

@thefloweringash
Copy link
Member Author

@thefloweringash thefloweringash commented Jan 4, 2020

Don't know why cross is broken. I turned off the warnings to test the changes in this PR.

Without:

configuring
configure flags: --prefix=/nix/store/zppci259jsdmxcykcjd588xbqbbpr4lh-perl-5.30.1-armv7l-unknown-linux-gnueabihf -Dlibpth=\"\" -Dglibpth=\"\" -Uinstallusrbinperl -Dinstallstyle=lib/perl5 -Duseshrplib -Dlocincpth=/nix/store/ljqcrxsnxsfrjsr4bpjv3slf7fikr331-glibc-2.27-armv7l-unknown-linux-gnueabihf-dev/include -Dloclibpth=/nix/store/997npdhdli1hwf58mp5dfxmq40rzkynx-glibc-2
.27-armv7l-unknown-linux-gnueabihf/lib -Dusethreads -Dldflags=\"-lm -lrt\" --build=x86_64-unknown-linux-gnu --host=armv7l-unknown-linux-gnueabihf --target=armv7l-unknown-linux-gnueabihf
ERROR: Unknown argument l
builder for '/nix/store/y49ycwnj69xbin1xs0bawim24y7z2j04-perl-5.30.1-armv7l-unknown-linux-gnueabihf.drv' failed with exit code 255

And with this PR, the build succeeds.

Hacks to disable warnings
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 98e579cb7a6..c80b85e05a0 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -49,20 +49,25 @@ callPackage ./common.nix { inherit stdenv; } {
       ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "pie";
 
     NIX_CFLAGS_COMPILE =
-      if !stdenv.hostPlatform.isMusl
-        # TODO: This (returning a string or `null`, instead of a list) is to
-        #       not trigger a mass rebuild due to the introduction of the
-        #       musl-specific flags below.
-        #       At next change to non-musl glibc builds, remove this `then`
-        #       and the above condition, instead keeping only the `else` below.
-        then (if withGd then gdCflags else null)
-        else
-          (builtins.concatLists [
-            (stdenv.lib.optionals withGd gdCflags)
-            # Fix -Werror build failure when building glibc with musl with GCC >= 8, see:
-            # https://github.com/NixOS/nixpkgs/pull/68244#issuecomment-544307798
-            (stdenv.lib.optional stdenv.hostPlatform.isMusl "-Wno-error=attribute-alias")
-          ]);
+      let flags =
+        (builtins.concatLists [
+          (stdenv.lib.optionals withGd gdCflags)
+          # Fix -Werror build failure when building glibc with musl with GCC >= 8, see:
+          # https://github.com/NixOS/nixpkgs/pull/68244#issuecomment-544307798
+          (stdenv.lib.optional stdenv.hostPlatform.isMusl "-Wno-error=attribute-alias")
+          (stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isAarch32) [
+            # Ignore https://github.com/cirosantilli/linux-kernel-module-cheat/issues/97 -- new warning as of GCC 9.2.0
+            "-Wno-missing-attributes"
+            # Ignore https://sourceware.org/bugzilla/show_bug.cgi?id=23442 -- new warning as of GCC >= 8, fixed in glibc 2.28
+            "-Wno-array-bounds"
+          ])
+        ]);
+      # TODO: This (returning a string or `null`, instead of a list) is to
+      #       not trigger a mass rebuild due to the introduction of the
+      #       musl-specific flags.
+      #       At next change to non-musl glibc builds, remove this `if`
+      #       and the above let, instead keeping only the `concatLists` above.
+      in if (flags == [] && !stdenv.hostPlatform.isMusl) then null else flags;
 
     # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
     # any program we run, because the gcc will have been placed at a new
@volth
volth approved these changes Jan 4, 2020
@bqv
Copy link
Contributor

@bqv bqv commented Jan 12, 2020

Building for my raspi2 (armv7), I was facing what looks like the same bug. Tested building with this PR, had success. +1

@bqv
Copy link
Contributor

@bqv bqv commented Jan 13, 2020

As a relevant note, there are more packages than I can count that don't properly cross compile with my build machines, unless your policy involves eventually fixing those too, I see no reason to hold off on merging this

@Mic92 Mic92 merged commit 7aa6616 into NixOS:master Jan 13, 2020
16 checks passed
16 checks passed
pkgsCross.armv7l-hf-multiplatform.perl on aarch64-linux Failure
Details
pkgsCross.armv7l-hf-multiplatform.perl on x86_64-linux Failure
Details
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
perl on aarch64-linux Success
Details
perl on x86_64-linux Success
Details
@thefloweringash thefloweringash deleted the thefloweringash:perl-aarch32 branch Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.