Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Makefile: ERROR: command returned 2: make.exe #5

Open
AndreMikulec opened this issue Nov 25, 2016 · 3 comments
Open

Makefile: ERROR: command returned 2: make.exe #5

AndreMikulec opened this issue Nov 25, 2016 · 3 comments

Comments

@AndreMikulec
Copy link

Ronan Dunklau,

The current pgxn Makefile produces an error: ERROR: command returned 2: make.exe

TargetUser@TARGETMACH /c/Users/TargetUser/Downloads/weighted_mean
$ pgxn install '..\weighted_mean' --verbose

DEBUG: running pg_config --libdir
DEBUG: running command: ['c:\\postgres-REL9_6___installed_final\\bin\\pg_config.exe', '--libdir']
DEBUG: testing if c:/PO53FB~1/lib is writable
DEBUG: checking 'c:\Users\TargetUser\Downloads\weighted_mean\configure'
INFO: building extension
DEBUG: running: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'all']
DEBUG: running command: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'all']
cp sql/weighted_mean.sql sql/weighted_mean--1.0.1.sql
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -D MS_WIN64  -I. -I./ -Ic:/PO53FB~1/includ
e/server -Ic:/PO53FB~1/include/internal -I/c/postgres-REL9_6_1_16e7c02/src/include/port/win32 -DEXEC_BACKEND  -I/c/zlib-1.2.8-win32-x86_64/include -Ic:/PO53FB~1/include/server/port/win32  -c -o src/weighted_mean.o src/weighted_mean.c -MMD -MP -MF .deps/we
ighted_mean.Po
src/weighted_mean.c:26:1: warning: no previous prototype for 'make_zero' [-Wmissing-prototypes]
 make_zero()
 ^~~~~~~~~
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -D MS_WIN64  -shared -static-libgcc -o src
/weighted_mean.dll src/weighted_mean.o -Wl,--export-all-symbols -Lc:/PO53FB~1/lib -Wl,--allow-multiple-definition -Wl,--disable-auto-import  -L/c/zlib-1.2.8-win32-x86_64/lib -Wl,--as-needed  -Lc:/PO53FB~1/lib -lpostgres
INFO: installing extension
DEBUG: testing if c:/PO53FB~1/lib is writable
DEBUG: running: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'install']
DEBUG: running command: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'install']
/bin/mkdir -p 'c:/PO53FB~1/share/extension'
/bin/mkdir -p 'c:/PO53FB~1/share/extension'
/bin/mkdir -p 'c:/PO53FB~1/lib'
/bin/mkdir -p 'c:/PO53FB~1/share/doc/extension'
/bin/install -c -m 644 .//weighted_mean.control 'c:/PO53FB~1/share/extension/'
/bin/install -c -m 644 .//sql/weighted_mean--1.0.1.sql .//sql/weighted_mean--1.0.1.sql  'c:/PO53FB~1/share/extension/'
/bin/install: will not overwrite just-created `c:/PO53FB~1/share/extension/weighted_mean--1.0.1.sql' with `.//sql/weighted_mean--1.0.1.sql'
make.exe: *** [install] Error 1
ERROR: command returned 2: make.exe PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe install

Here is a corrected Makefile. Run results follow.

EXTENSION    = $(shell grep -m 1 '"name":' META.json | \
               sed -e 's/[[:space:]]*"name":[[:space:]]*"\([^"]*\)",/\1/')
EXTVERSION   = $(shell grep -m 1 '[[:space:]]\{8\}"version":' META.json | \
               sed -e 's/[[:space:]]*"version":[[:space:]]*"\([^"]*\)",\{0,1\}/\1/')

DATA         = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
DOCS         = $(wildcard doc/*.md) README.md
TESTS        = $(wildcard test/sql/*.sql)
REGRESS      = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test
MODULES      = $(patsubst %.c,%,$(wildcard src/*.c))
PG_CONFIG   ?= pg_config
PG91         = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo no || echo yes)

ifeq ($(PG91),yes)
DATA = $(wildcard sql/*--*.sql)
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
endif

PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql

sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql
	cp $< $@
endif

.PHONY: results
results:
	rsync -avP --delete results/ test/expected

dist:
	git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ -o $(EXTENSION)-$(EXTVERSION).zip HEAD

Here is a run after corrections.

TargetUser@TARGETMACH /c/Users/TargetUser/Downloads/weighted_mean
$ pgxn install '..\weighted_mean' --verbose
DEBUG: running pg_config --libdir
DEBUG: running command: ['c:\\postgres-REL9_6___installed_final\\bin\\pg_config.exe', '--libdir']
DEBUG: testing if c:/PO53FB~1/lib is writable
DEBUG: checking 'c:\Users\TargetUser\Downloads\weighted_mean\configure'
INFO: building extension
DEBUG: running: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'all']
DEBUG: running command: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'all']
cp sql/weighted_mean.sql sql/weighted_mean--1.0.0.sql
INFO: installing extension
DEBUG: testing if c:/PO53FB~1/lib is writable
DEBUG: running: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'install']
DEBUG: running command: ['make.exe', 'PG_CONFIG=/c/postgres-REL9_6___installed_final/bin/pg_config.exe', 'install']
/bin/mkdir -p 'c:/PO53FB~1/share/extension'
/bin/mkdir -p 'c:/PO53FB~1/share/extension'
/bin/mkdir -p 'c:/PO53FB~1/lib'
/bin/mkdir -p 'c:/PO53FB~1/share/doc/extension'
/bin/install -c -m 644 .//weighted_mean.control 'c:/PO53FB~1/share/extension/'
/bin/install -c -m 644 .//sql/weighted_mean--1.0.0.sql .//sql/weighted_mean--1.0.1.sql  'c:/PO53FB~1/share/extension/'
/bin/install -c -m 755  src/weighted_mean.dll 'c:/PO53FB~1/lib/'
/bin/install -c -m 644 .//doc/weighted_mean.md .//README.md 'c:/PO53FB~1/share/doc/extension/'
@davidfetter
Copy link

There seems to be a lot of assumptions being made here about what's available on the build system. Could you spell those out?

@AndreMikulec
Copy link
Author

Note, weighed_stats and weighed_mean are GREAT extensions.

I used the MSYS build system, and that works fine.

Here are the corrections.

1

EXTENSION = weighted_mean

does not work I forgot why.
I replaced it with what 'semver' uses

EXTENSION    = $(shell grep -m 1 '"name":' META.json | \
               sed -e 's/[[:space:]]*"name":[[:space:]]*"\([^"]*\)",/\1/')

So now that works fine.

2

Of line

DOCS = README

README is not a variable anywhere
Also, DOCS is ovewritten by DOCS ( see below)
So I removed that line. So now that works fine.

3

Of the line

DOCS         = $(wildcard doc/*.md)

README.md is not in the ./doc directory. It is in the current directory. ./ Therefore ...

DOCS         = $(wildcard doc/*.md) README.md

So now that works fine.

@alfonx
Copy link

alfonx commented Mar 9, 2017

pgxn install weighted_mean
uses weighted_mean 1.0.1 from 2012 and still fails on Ubuntu 16.04 with PostgreSQL 9.6.2

It works when build from git using the above Makefile

Who can PLEASE please please update this in PGXN?

# pgxn install weighted_mean
INFO: best version: weighted_mean 1.0.1
INFO: saving /tmp/tmpZ_0oDx/weighted_mean-1.0.1.zip
INFO: unpacking: /tmp/tmpZ_0oDx/weighted_mean-1.0.1.zip
INFO: building extension
cp sql/weighted_mean.sql sql/weighted_mean--1.0.1.sql
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer -fpic -I. -I./ -I/usr/include/postgresql/9.6/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.6  -c -o src/weighted_mean.o src/weighted_mean.c
src/weighted_mean.c:26:1: warning: no previous prototype for ‘make_zero’ [-Wmissing-prototypes]
 make_zero()
 ^
src/weighted_mean.c: In function ‘_weighted_mean_intermediate’:
src/weighted_mean.c:82:22: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   state->running_sum = make_zero();
                      ^
src/weighted_mean.c:83:25: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   state->running_amount = make_zero();
                         ^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer -fpic -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5 -L/usr/lib/x86_64-linux-gnu/mit-krb5  -Wl,--as-needed  -shared -o src/weighted_mean.so src/weighted_mean.o
INFO: installing extension
/bin/mkdir -p '/usr/share/postgresql/9.6/extension'
/bin/mkdir -p '/usr/share/postgresql/9.6/extension'
/bin/mkdir -p '/usr/lib/postgresql/9.6/lib'
/bin/mkdir -p '/usr/share/doc/postgresql-doc-9.6/extension'
/usr/bin/install -c -m 644 .//weighted_mean.control '/usr/share/postgresql/9.6/extension/'
/usr/bin/install -c -m 644 .//sql/weighted_mean--1.0.1.sql .//sql/weighted_mean--1.0.1.sql  '/usr/share/postgresql/9.6/extension/'
/usr/bin/install: will not overwrite just-created '/usr/share/postgresql/9.6/extension/weighted_mean--1.0.1.sql' with './/sql/weighted_mean--1.0.1.sql'
/usr/lib/postgresql/9.6/lib/pgxs/src/makefiles/pgxs.mk:114: recipe for target 'install' failed
make: *** [install] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config install

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

No branches or pull requests

3 participants