Skip to content

0.4.4 fails to build with glibc 2.43 #159

Closed

Description

@tgurr
[...]
x86_64-pc-linux-gnu-cc -DHAVE_CONFIG_H -I. -I..   -march=native -O2 -pipe -D_GNU_SOURCE -D_FORTIFY_SOURCE=2  -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unused-const-variable -Wno-unsuffixed-float-constants -Wno-error -march=native -O2 -pipe -Wall -c -o libgnu_a-stdlib.o `test -f 'stdlib.c' || echo './'`stdlib.c
In file included from /usr/x86_64-pc-linux-gnu/include/features.h:540,
                 from /usr/x86_64-pc-linux-gnu/include/bits/libc-header-start.h:33,
                 from /usr/x86_64-pc-linux-gnu/include/stdlib.h:26,
                 from ./stdlib.h:51,
                 from fd-hook.c:23:
./stdlib.h:807:20: error: expected identifier or '(' before '_Generic'
  807 | _GL_EXTERN_C void *bsearch (const void *__key,
      |                    ^~~~~~~
In file included from /usr/x86_64-pc-linux-gnu/include/features.h:540,
                 from /usr/x86_64-pc-linux-gnu/include/bits/libc-header-start.h:33,
                 from /usr/x86_64-pc-linux-gnu/include/stdlib.h:26,
                 from ./stdlib.h:51,
                 from stdlib.c:21:
./stdlib.h:807:20: error: expected identifier or '(' before '_Generic'
  807 | _GL_EXTERN_C void *bsearch (const void *__key,
      |                    ^~~~~~~
make[3]: *** [Makefile:1588: libgnu_a-fd-hook.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:1826: libgnu_a-stdlib.o] Error 1
In file included from /usr/x86_64-pc-linux-gnu/include/features.h:540,
                 from /usr/x86_64-pc-linux-gnu/include/bits/libc-header-start.h:33,
                 from /usr/x86_64-pc-linux-gnu/include/stdlib.h:26,
                 from ./stdlib.h:51,
                 from getprogname.c:20:
./stdlib.h:807:20: error: expected identifier or '(' before '_Generic'
  807 | _GL_EXTERN_C void *bsearch (const void *__key,
      |                    ^~~~~~~
In file included from /usr/x86_64-pc-linux-gnu/include/features.h:540,
                 from /usr/x86_64-pc-linux-gnu/include/sys/types.h:25,
                 from ./sys/types.h:46,
                 from ./fcntl.h:63,
                 from fcntl.c:23:
./stdlib.h:807:20: error: expected identifier or '(' before '_Generic'
  807 | _GL_EXTERN_C void *bsearch (const void *__key,
      |                    ^~~~~~~
In file included from /usr/x86_64-pc-linux-gnu/include/features.h:540,
                 from /usr/x86_64-pc-linux-gnu/include/bits/libc-header-start.h:33,
                 from /usr/x86_64-pc-linux-gnu/include/stdlib.h:26,
                 from ./stdlib.h:51,
                 from malloca.h:29,
                 from malloca.c:22:
./stdlib.h:807:20: error: expected identifier or '(' before '_Generic'
  807 | _GL_EXTERN_C void *bsearch (const void *__key,
      |                    ^~~~~~~
make[3]: *** [Makefile:1672: libgnu_a-getprogname.o] Error 1
make[3]: *** [Makefile:1700: libgnu_a-malloca.o] Error 1

Full build log: patchutils-0.4.4_build.log

glibc 2.43 release notes: https://sourceware.org/glibc/wiki/Release/2.43#C23_Const-Preserving_Standard_Library_Macros_May_Break_Some_Packages

A new release with updated gnulib to fix this would be nice.

Activity

  1. tgurr commented on Feb 10, 2026

    @tgurr
    Author

    For anyone in need of a fix to apply downstream for the time being, Fedora ships with this patch: https://src.fedoraproject.org/rpms/patchutils/blob/rawhide/f/patchutils-0.4.4-ftbfs-gnulib.patch

  2. twaugh commented on Feb 26, 2026

    @twaugh
    Owner

    Fixed in 0.4.5.

  3. hhoffstaette commented on Feb 26, 2026

    @hhoffstaette
    Contributor

    Well actually.. :-)

    clang -DHAVE_CONFIG_H -I.   -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -I./src -I./lib -I./lib -g -O2 -Wall -MT src/util.o -MD -MP -MF $depbase.Tpo -c -o src/util.o src/util.c &&\
    mv -f $depbase.Tpo $depbase.Po
    src/util.c:261:4: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
      261 |         p = strrchr(name, '.');
          |           ^ ~~~~~~~~~~~~~~~~~~
    1 warning generated.
    depbase=`echo src/diff.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    clang -DHAVE_CONFIG_H -I.   -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -I./src -I./lib -I./lib -g -O2 -Wall -MT src/diff.o -MD -MP -MF $depbase.Tpo -c -o src/diff.o src/diff.c &&\
    mv -f $depbase.Tpo $depbase.Po
    src/diff.c:162:15: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers
          [-Wincompatible-pointer-types-discards-qualifiers]
      162 |         char *p = strchr (atatline, which);
          |               ^   ~~~~~~~~~~~~~~~~~~~~~~~~
    src/diff.c:193:5: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
      193 |                 p = strchr (atatline, '-');
          |                   ^ ~~~~~~~~~~~~~~~~~~~~~~
    src/diff.c:207:5: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
      207 |                 p = strchr (atatline, '+');
          |                   ^ ~~~~~~~~~~~~~~~~~~~~~~
    3 warnings generated.
    clang -I./src -I./lib -I./lib -g -O2 -Wall   -o src/interdiff src/interdiff.o src/util.o src/diff.o lib/libgnu.a  -lpcre2-posix
    depbase=`echo src/filterdiff.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    clang -DHAVE_CONFIG_H -I.   -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -I./src -I./lib -I./lib -g -O2 -Wall -MT src/filterdiff.o -MD -MP -MF $depbase.Tpo -c -o src/filterdiff.o src/filterdiff.c &&\
    mv -f $depbase.Tpo $depbase.Po
    clang -I./src -I./lib -I./lib -g -O2 -Wall   -o src/filterdiff src/filterdiff.o src/util.o src/diff.o lib/libgnu.a  -lpcre2-posix
    depbase=`echo src/rediff.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    clang -DHAVE_CONFIG_H -I.   -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -I./src -I./lib -I./lib -g -O2 -Wall -MT src/rediff.o -MD -MP -MF $depbase.Tpo -c -o src/rediff.o src/rediff.c &&\
    mv -f $depbase.Tpo $depbase.Po
    src/rediff.c:274:8: warning: initializing 'char *' with an expression of type 'const char *' discards qualifiers
          [-Wincompatible-pointer-types-discards-qualifiers]
      274 |         char *p = strchr (meta, '-'), *q;
          |               ^   ~~~~~~~~~~~~~~~~~~
    1 warning generated.
    

    diff.c and util.c can be fixed by simply marking p as const char *. rediff.c is a bit more tricky since meta is being passed in as const char * already and casting it to char * should be considered a Bad Idea. Maybe make meta mutable or operate on a copy.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions