Compile issue with glibc-2.27 (copy_file_range) - Mailing list pgsql-bugs

From Thomas Trepl
Subject Compile issue with glibc-2.27 (copy_file_range)
Date
Msg-id 1517750498.1357.24.camel@linuxfromscratch.org
Whole thread Raw
Responses Re: Compile issue with glibc-2.27 (copy_file_range)
Re: Compile issue with glibc-2.27 (copy_file_range)
List pgsql-bugs
Hi,

according to changlelog of glibc-2.27 they introduced a new function
named "copy_file_range".

There is a static function in src/bin/pg_rewind/copy_fetch.c with the
same name and therefore compilation fails with 

>>>>>>>>
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-
statement -Wendif-labels -Wmissing-format-attribute -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2
-I../../../src/interfaces/libpq -DFRONTEND -I../../../src/include  -
D_GNU_SOURCE   -c -o copy_fetch.o copy_fetch.c
copy_fetch.c:159:1: Fehler: In Konflikt stehende Typen für
»copy_file_range«
 copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
 ^~~~~~~~~~~~~~~
In file included from copy_fetch.c:15:0:
/usr/include/unistd.h:1110:9: Anmerkung: Vorherige Deklaration von
»copy_file_range« war hier
 ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
         ^~~~~~~~~~~~~~~
make[3]: *** [<eingebaut>: copy_fetch.o] Fehler 1
make[3]: Verzeichnis „/tmp/postgresql/build/postgresql-
10.1/src/bin/pg_rewind“ wird verlassen
make[2]: *** [Makefile:40: all-pg_rewind-recurse] Fehler 2
make[2]: Verzeichnis „/tmp/postgresql/build/postgresql-10.1/src/bin“
wird verlassen
make[1]: *** [Makefile:37: all-bin-recurse] Fehler 2
make[1]: Verzeichnis „/tmp/postgresql/build/postgresql-10.1/src“ wird
verlassen
make: *** [GNUmakefile:11: all-src-recurse] Fehler 2
<<<<<<<<

Since postgresql's copy_file_range is static/local to only one file,
its easy to fix:

sed -e "s/copy_file_range/pg_&/" \
    -i  src/bin/pg_rewind/copy_fetch.c

which renames "copy_file_range" to "pg_copy_file_range". Find attached
a patch doing the same.

System: Linux (LFS 20180202)
glibc:  2.27
gcc:    7.3
Kernel: 4.15.1
PgSql:  10.1

--
Thomas
Attachment

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15047: shell.dll missing
Next
From: Dmitry Dolgov
Date:
Subject: Re: Compile issue with glibc-2.27 (copy_file_range)