postgrespro/rum

Unable to install Rum

eli-moss-healthy opened this issue · 8 comments

Hi,
I followed instructions, but it seems there is still some problem.
I'm running Postgres 11.5, and gsxnclient 1.3 .
At first I did :
$ git clone https://github.com/postgrespro/rum
$ cd rum
$ make USE_PGXS=1
$ make USE_PGXS=1 install
$ make USE_PGXS=1 installcheck

But the installcheck failed all 32 tests.
So I went ahead and ran : USE_PGXS=1 pgxn install rum , and got this error :

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [src/rumsort.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config all

Needless to say that when I try to run CREATE EXTENSION rum;, I get an error. Which is the following :
ERROR: could not open extension control file "/Applications/Postgres.app/Contents/Versions/11/share/postgresql/extension/rum.control": No such file or directory

I've tried finding a solution, but to no avail. I even tried editing the Makefile inside Rum folder, according to this :
https://blog.pgxn.org/post/20908326485/lose-use-pgxs

But nothing seems to do the trick. Would really appreciate some help
Thank you

Installcheck requires a running server that it can connect to, to run the tests. Does it have one? What errors did it fail with?

So I went ahead and ran : USE_PGXS=1 pgxn install rum

Creating a mix and match of different installations is probably not going to help the situation.

Installcheck requires a running server that it can connect to, to run the tests. Does it have one? What errors did it fail with?

I am running a server on my local machine, a mac. When I ran the installcheck I got :

============== running regression test queries        ==============
test rum                          ... FAILED
test rum_validate                 ... FAILED
test rum_hash                     ... FAILED
test ruminv                       ... FAILED
test timestamp                    ... FAILED
test orderby                      ... FAILED
test orderby_hash                 ... FAILED
test altorder                     ... FAILED
test altorder_hash                ... FAILED
test limits                       ... FAILED
test int2                         ... FAILED
test int4                         ... FAILED
test int8                         ... FAILED
test float4                       ... FAILED
test float8                       ... FAILED
test money                        ... FAILED
test oid                          ... FAILED
test time                         ... FAILED
test timetz                       ... FAILED
test date                         ... FAILED
test interval                     ... FAILED
test macaddr                      ... FAILED
test inet                         ... FAILED
test cidr                         ... FAILED
test text                         ... FAILED
test varchar                      ... FAILED
test char                         ... FAILED
test bytea                        ... FAILED
test bit                          ... FAILED
test varbit                       ... FAILED
test numeric                      ... FAILED
test array                        ... FAILED

========================
 32 of 32 tests failed. 
========================

The differences that caused some tests to fail can be viewed in the
file ".../rum/regression.diffs".  A copy of the test summary that you see
above is saved in the file ".../rum/regression.out"

Creating a mix and match of different installations is probably not going to help the situation.

I've deleted the rum directory, and downloaded it again and then used the "USE_PGXS=1 pgxn install rum".
I'm sorry, I'm rather new to PostgreSQL in general and currently investigating FTS, Autocompletes, etc. I might have misunderstood something regarding the extensions installation process.
What should I do differently here to install the extension?

You will have to look inside the rum/regression.diffs file. The first error reported in it is likely to be the key.

The first part of regression.diffs is :

*** .../rum/expected/rum.out	Mon Oct 28 21:15:47 2019
--- .../rum/results/rum.out	Mon Oct 28 22:09:40 2019
***************
*** 1,9 ****
--- 1,11 ----
  CREATE EXTENSION rum;
+ ERROR:  could not open extension control file "/Applications/Postgres.app/Contents/Versions/11/share/postgresql/extension/rum.control": No such file or directory
  CREATE TABLE test_rum( t text, a tsvector );
  CREATE TRIGGER tsvectorupdate
  BEFORE UPDATE OR INSERT ON test_rum
  FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('a', 'pg_catalog.english', 't');
  CREATE INDEX rumidx ON test_rum USING rum (a rum_tsvector_ops);
+ ERROR:  access method "rum" does not exist
  -- Check empty table using index scan
  SELECT
  	a <=> to_tsquery('pg_catalog.english', 'way & (go | half)'),
***************
*** 12,62 ****
  	*
  	FROM test_rum
  	ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2;
!  ?column? | rum_ts_distance | rum_ts_score | t | a 
! ----------+-----------------+--------------+---+---

It seems that it's the same error of not being able to find "rom.control".

The running server does not have RUM installed. Probably you have multiple installations, and "make install" installed to a different one than the one that is currently running.

The output of "make install" will show what directory it is installing files to. You can run it again and check where. It should install to the location indicated by the output of the pg_config executable--whichever version of that executable is the first one it finds in your PATH. To get this working, you should reconfigure your PATH to find the correct pg_config.

I've reconfigured my whole PATH. I've ran :
PATH="/Applications/Postgres.app/Contents/Versions/11/bin:$PATH".
Then restarted the terminal on the mac, and it changed the 11 part to latest
(i.e - /Applications/Postgres.app/Contents/Versions/latest/bin: )

I also made sure that this folder does contain the pg_config file.

So now my PATH looks as follows :
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:

The output of make USE_PGXS=1 install is :

/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/usr/local/lib/postgresql'
/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/usr/local/share/postgresql/extension'
/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/usr/local/share/postgresql/extension'
/usr/bin/install -c -m 755  rum.so '/usr/local/lib/postgresql/rum.so'
/usr/bin/install -c -d '/usr/local/Cellar/postgresql/11.5_1/include/server/'
/usr/bin/install -c -m 644 .//src/rum.h .//src/rumsort.h '/usr/local/Cellar/postgresql/11.5_1/include/server/'
/usr/bin/install -c -m 644 .//rum.control '/usr/local/share/postgresql/extension/'
/usr/bin/install -c -m 644 .//rum--1.0.sql .//rum--1.3.sql .//rum--1.0--1.1.sql .//rum--1.1--1.2.sql .//rum--1.2--1.3.sql  '/usr/local/share/postgresql/extension/'

it seems it has multiple directories that it installs it to. But none of them seems to be in directory provided by the PATH.
When I run USE_PGXS=1 pgxn install rum, I still get a similar error :
ERROR: command returned 2: make PG_CONFIG=/usr/local/bin/pg_config all

Perhaps the way I configured the PATH was incorrect? Or do you think something else is going on here

Thank you

EDIT:
Don't know if that's relevant, but when I run "pg_config" command, this is my output :

BINDIR = /usr/local/Cellar/postgresql/11.5_1/bin
DOCDIR = /usr/local/Cellar/postgresql/11.5_1/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/11.5_1/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/11.5_1/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/11.5_1/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/11.5_1/include/server
LIBDIR = /usr/local/lib
PKGLIBDIR = /usr/local/lib/postgresql
LOCALEDIR = /usr/local/Cellar/postgresql/11.5_1/share/locale
MANDIR = /usr/local/Cellar/postgresql/11.5_1/share/man
SHAREDIR = /usr/local/share/postgresql
SYSCONFDIR = /usr/local/etc/postgresql
PGXS = /usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--disable-debug' '--prefix=/usr/local/Cellar/postgresql/11.5_1' '--datadir=/usr/local/share/postgresql' '--libdir=/usr/local/lib' '--sysconfdir=/usr/local/etc' '--docdir=/usr/local/Cellar/postgresql/11.5_1/share/doc/postgresql' '--enable-thread-safety' '--with-bonjour' '--with-gssapi' '--with-icu' '--with-ldap' '--with-libxml' '--with-libxslt' '--with-openssl' '--with-pam' '--with-perl' '--with-uuid=e2fs' '--with-tcl' '--with-tclconfig=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tcl.framework' 'CC=clang' 'LDFLAGS=-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib' 'CPPFLAGS=-I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include' 'CXX=clang++' 'PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.15'
CC = clang
CPPFLAGS = -I/usr/local/Cellar/icu4c/64.2/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2
CFLAGS_SL = 
LDFLAGS = -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm 
VERSION = PostgreSQL 11.5

By closing and reopening the terminal, you lost whatever changes you made to your PATH.

Having "/Applications/Postgres.app/Contents/Versions/latest/bin" last in your PATH does not work, because it uses the first pg_config it finds, and searches the PATH in order so it still finding the same one as before. (And that was probably alway at the end of your PATH anyway, since you didn't permanently change your confguration)

You can set your PATH on a per-command line basis:

PATH="/Applications/Postgres.app/Contents/Versions/11/bin:$PATH" make USE_PGXS=1 clean
PATH="/Applications/Postgres.app/Contents/Versions/11/bin:$PATH" make USE_PGXS=1 
PATH="/Applications/Postgres.app/Contents/Versions/11/bin:$PATH" make USE_PGXS=1 install

Although as long as you have multiple sets of the same installed, you will have similar problems in the future. It would be good to get rid of all the unused installations. I don't know enough about Macs to know how to go about that, though.

It seemed to do the trick. I tried cleaning then without the per-commands, changed "latest" to "11" without restarting the terminal, and it seemed to work too. Not sure if it worked because I already ran the per-command variant beforehand(before I ran clean again), or just because it solved the issue.
Either way, thank you very much for the help!