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

Parallel compile failed #612

Open
japinli opened this issue Nov 21, 2023 · 2 comments
Open

Parallel compile failed #612

japinli opened this issue Nov 21, 2023 · 2 comments

Comments

@japinli
Copy link
Contributor

japinli commented Nov 21, 2023

When the postgres comipled using --with-llvm, I try to parallelly build pg_probackup, it failed, here is the log:

$ pg_config
BINDIR = /home/japin/Codes/postgres/build/pg/bin
DOCDIR = /home/japin/Codes/postgres/build/pg/share/doc
HTMLDIR = /home/japin/Codes/postgres/build/pg/share/doc
INCLUDEDIR = /home/japin/Codes/postgres/build/pg/include
PKGINCLUDEDIR = /home/japin/Codes/postgres/build/pg/include
INCLUDEDIR-SERVER = /home/japin/Codes/postgres/build/pg/include/server
LIBDIR = /home/japin/Codes/postgres/build/pg/lib
PKGLIBDIR = /home/japin/Codes/postgres/build/pg/lib
LOCALEDIR = /home/japin/Codes/postgres/build/pg/share/locale
MANDIR = /home/japin/Codes/postgres/build/pg/share/man
SHAREDIR = /home/japin/Codes/postgres/build/pg/share
SYSCONFDIR = /home/japin/Codes/postgres/build/pg/etc
PGXS = /home/japin/Codes/postgres/build/pg/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE =  '--prefix=/home/japin/Codes/postgres/build/pg' '--enable-tap-tests' '--enable-debug' '--enable-cassert' '--enable-depend' '--enable-dtrace' '--with-icu' '--with-llvm' '--with-openssl' '--with-python' '--with-libxml' '--with-libxslt' '--with-lz4' '--with-pam' 'CFLAGS=-O0 -Wmissing-prototypes -Wincompatible-pointer-types'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O0 -Wmissing-prototypes -Wincompatible-pointer-types
CFLAGS_SL = -fPIC
LDFLAGS = -L/usr/lib/llvm-12/lib -Wl,--as-needed -Wl,-rpath,'/home/japin/Codes/postgres/build/pg/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -llz4 -lxslt -lxml2 -lpam -lssl -lcrypto -lz -lreadline -lpthread -lrt -ldl -lm
VERSION = PostgreSQL 14.10
$ make -j $(nproc) USE_PGXS=1 top_srcdir=/home/japin/Codes/postgres -s
src/stream.c:11:10: fatal error: receivelog.h: No such file or directory
   11 | #include "receivelog.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [/home/japin/Codes/postgres/build/pg/lib/pgxs/src/makefiles/../../src/Makefile.global:953: src/stream.o] Error 1
make: *** Waiting for unfinished jobs....

It seems receivelog.h is only used by src/stream.c, so i try to modify Makefile with following:

diff --git a/Makefile b/Makefile
index f93cc37a..5f8905bc 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,8 @@ PG_LIBS_INTERNAL = $(libpq_pgport) ${PTHREAD_CFLAGS}

 src/utils/configuration.o: src/datapagemap.h
 src/archive.o: src/instr_time.h
-src/backup.o: src/receivelog.h src/streamutil.h
+src/backup.o: src/streamutil.h
+src/stream.o: src/receivelog.h

 src/instr_time.h: $(srchome)/src/include/portability/instr_time.h
 	rm -f $@ && $(LN_S) $(srchome)/src/include/portability/instr_time.h $@

It failed with clang build stream.bc:

japin@coltd-devel:~/Codes/pg_probackup$ make -j $(nproc) USE_PGXS=1 top_srcdir=/home/japin/Codes/postgres -s
src/stream.c:11:10: fatal error: 'receivelog.h' file not found
#include "receivelog.h"
         ^~~~~~~~~~~~~~
1 error generated.
make: *** [/home/japin/Codes/postgres/build/pg/lib/pgxs/src/makefiles/../../src/Makefile.global:1084: src/stream.bc] Error 1
make: *** Waiting for unfinished jobs....

Then, I try the following:

diff --git a/Makefile b/Makefile
index f93cc37a..7563b27c 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,7 @@ PG_LIBS_INTERNAL = $(libpq_pgport) ${PTHREAD_CFLAGS}
 src/utils/configuration.o: src/datapagemap.h
 src/archive.o: src/instr_time.h
 src/backup.o: src/receivelog.h src/streamutil.h
+src/stream.o: src/receivelog.h

 src/instr_time.h: $(srchome)/src/include/portability/instr_time.h
 	rm -f $@ && $(LN_S) $(srchome)/src/include/portability/instr_time.h $@

Why the first one doesn't work?

@demonolock
Copy link

Hi, for compiling pg_probackup you can try the command

make -j $(nproc) USE_PGXS=1 PG_CONFIG="$PG_CONFIG"

Where PG_CONFIG is path ../bin/pg_config of required postgresql

@japinli
Copy link
Contributor Author

japinli commented Mar 25, 2024

@demonolock Thanks for your reply! It seems doesn't work.

$ make -j $(nproc) USE_PGXS=1 top_srcdir=/home/japin/Codes/postgres -s PG_CONFIG=/home/japin/Codes/postgres/build/pg/bin/pg_config
src/utils/file.c: In function ‘fio_gzread’:
src/utils/file.c:1676:43: warning: passing argument 2 of ‘fio_read’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1676 |    rc = fio_read(gz->fd, gz->strm.next_in + gz->strm.avail_in,
      |                          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
src/utils/file.c:1096:24: note: expected ‘void *’ but argument is of type ‘const Bytef *’ {aka ‘const unsigned char *’}
 1096 | fio_read(int fd, void* buf, size_t size)
      |                  ~~~~~~^~~
src/utils/file.c: In function ‘fio_send_file_gz’:
src/utils/file.c:2510:14: warning: declaration of ‘hdr’ shadows a previous local [-Wshadow=compatible-local]
 2510 |   fio_header hdr;
      |              ^~~
src/utils/file.c:2491:13: note: shadowed declaration is here
 2491 |  fio_header hdr;
      |             ^~~
src/catalog.c: In function ‘catalog_get_timelines’:
src/catalog.c:1758:17: warning: declaration of ‘tlinfo’ shadows a previous local [-Wshadow=compatible-local]
 1758 |   timelineInfo *tlinfo = parray_get(timelineinfos, i);
      |                 ^~~~~~
src/catalog.c:1537:16: note: shadowed declaration is here
 1537 |  timelineInfo *tlinfo;
      |                ^~~~~~
src/catalog.c:1775:17: warning: declaration of ‘tlinfo’ shadows a previous local [-Wshadow=compatible-local]
 1775 |   timelineInfo *tlinfo = parray_get(timelineinfos, i);
      |                 ^~~~~~
src/catalog.c:1537:16: note: shadowed declaration is here
 1537 |  timelineInfo *tlinfo;
      |                ^~~~~~
src/catalog.c:1848:17: warning: declaration of ‘tlinfo’ shadows a previous local [-Wshadow=compatible-local]
 1848 |   timelineInfo *tlinfo = parray_get(timelineinfos, i);
      |                 ^~~~~~
src/catalog.c:1537:16: note: shadowed declaration is here
 1537 |  timelineInfo *tlinfo;
      |                ^~~~~~
src/catalog.c:2084:17: warning: declaration of ‘tlinfo’ shadows a previous local [-Wshadow=compatible-local]
 2084 |   timelineInfo *tlinfo = parray_get(timelineinfos, i);
      |                 ^~~~~~
src/catalog.c:1537:16: note: shadowed declaration is here
 1537 |  timelineInfo *tlinfo;
      |                ^~~~~~
src/stream.c:11:10: fatal error: receivelog.h: No such file or directory
   11 | #include "receivelog.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [/home/japin/Codes/postgres/build/pg/lib/pgxs/src/makefiles/../../src/Makefile.global:949: src/stream.o] Error 1
make: *** Waiting for unfinished jobs....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants