From 58e77c03a3a0201ad6f0e2d35ce5beae12dc08f6 Mon Sep 17 00:00:00 2001 From: Manuel Frischknecht Date: Sun, 25 May 2025 17:45:28 +0200 Subject: [PATCH] bfr: fix broken build because of stricter GCC default checks GCC now complains if `main` has no explicitly declared return type. Because `bfr`s `configure` script uses a very minimal C application to check whether GCC works _at all_ (literally: `main(){return(0);}`), this caused configure failures. Another issue with the `configure` script is that it logs the compiler errors for its checks to `configure.log` (and not to stdout or stderr), which means that the root cause wasn't logged during the failed nix build. I added a patch that rewires the compiler error file descriptor so that it will simply log to stderr and another patch that fixes the missing return type in the C example. Unfortunately, it looks like the server isn't serving the source files anymore (and finding an official upstream repo which I could send a PR to seems... non-trivial). --- .../configure-log-compiler-errors-to-stderr.patch | 13 +++++++++++++ ...ining-about-invalid-configure-example-code.patch | 13 +++++++++++++ pkgs/by-name/bf/bfr/package.nix | 3 +++ 3 files changed, 29 insertions(+) create mode 100644 pkgs/by-name/bf/bfr/configure-log-compiler-errors-to-stderr.patch create mode 100644 pkgs/by-name/bf/bfr/fix-gcc-complaining-about-invalid-configure-example-code.patch diff --git a/pkgs/by-name/bf/bfr/configure-log-compiler-errors-to-stderr.patch b/pkgs/by-name/bf/bfr/configure-log-compiler-errors-to-stderr.patch new file mode 100644 index 000000000000..e0e410f7a674 --- /dev/null +++ b/pkgs/by-name/bf/bfr/configure-log-compiler-errors-to-stderr.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 53e90a7..4afeb58 100755 +--- a/configure ++++ b/configure +@@ -411,7 +411,7 @@ if test "$silent" = yes; then + else + exec 6>&1 + fi +-exec 5>./config.log ++exec 5>&2 + + echo "\ + This file contains any messages produced by compilers while diff --git a/pkgs/by-name/bf/bfr/fix-gcc-complaining-about-invalid-configure-example-code.patch b/pkgs/by-name/bf/bfr/fix-gcc-complaining-about-invalid-configure-example-code.patch new file mode 100644 index 000000000000..a8896e52326a --- /dev/null +++ b/pkgs/by-name/bf/bfr/fix-gcc-complaining-about-invalid-configure-example-code.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 53e90a7..cc80615 100755 +--- a/configure ++++ b/configure +@@ -908,7 +908,7 @@ cat > conftest.$ac_ext << EOF + #line 909 "configure" + #include "confdefs.h" + +-main(){return(0);} ++int main(){return(0);} + EOF + if { (eval echo configure:914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes diff --git a/pkgs/by-name/bf/bfr/package.nix b/pkgs/by-name/bf/bfr/package.nix index d0fe5ded789d..19b500f0fb1c 100644 --- a/pkgs/by-name/bf/bfr/package.nix +++ b/pkgs/by-name/bf/bfr/package.nix @@ -15,6 +15,9 @@ stdenv.mkDerivation rec { }; patches = [ + ./configure-log-compiler-errors-to-stderr.patch + ./fix-gcc-complaining-about-invalid-configure-example-code.patch + (fetchurl { url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-misc/bfr/files/bfr-1.6-perl.patch?id=dec60bb6900d6ebdaaa6aa1dcb845b30b739f9b5"; sha256 = "1pk9jm3c1qzs727lh0bw61w3qbykaqg4jblywf9pvq5bypk88qfj";