Skip to content

Parallel compile failed #612

Open
Open
@japinli

Description

@japinli

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions