Обсуждение: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

Поиск
Список
Период
Сортировка

[GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Ken Tanzer
Дата:
Hi.  I recently installed 9.6 on my Centos 6.9 server, alongside a still-running 9.2.

I need to install a module for 9.6 (table_log) that is installed on 9.2.
I took the table_log Makefile and changed it to point to /usr/pgsql-9.6/bin/pg_config instead of 9.2.  It is still installing into the 9.2 directory though.

What's the cleanest or most proper way to target 9.6 in this situation?  Transcript below, and TIA.

Ken

[root@hosting table_log-0.4.4]# more Makefile

MODULES = table_log
DATA_built = table_log.sql
DOCS = README.table_log

ifdef USE_PGXS
  PGXS := $(shell /usr/pgsql-9.6/bin/pg_config --pgxs)
  include $(PGXS)
else
  subdir = contrib/table_log
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  include $(top_srcdir)/contrib/contrib-global.mk
endif

[root@hosting table_log-0.4.4]# make USE_PGXS=1 clean
rm -f table_log.so table_log.o
rm -f table_log.sql

[root@hosting table_log-0.4.4]# make USE_PGXS=1

sed 's,MODULE_PATHNAME,$libdir/table_log,g' table_log.sql.in >table_log.sql

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -fpic -I. -I./ -I/usr/pgsql-9.2/include/server -I/usr/pgsql-9.2/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o table_log.o table_log.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0 -fpic -L/usr/pgsql-9.2/lib -Wl,--as-needed  -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-9.2/lib',--enable-new-dtags  -shared -o table_log.so table_log.o

[root@hosting table_log-0.4.4]# make USE_PGXS=1 install

/bin/mkdir -p '/usr/pgsql-9.2/share/contrib'
/bin/mkdir -p '/usr/pgsql-9.2/lib'
/bin/mkdir -p '/usr/pgsql-9.2/doc/contrib'
/usr/bin/install -c -m 644  table_log.sql '/usr/pgsql-9.2/share/contrib/'
/usr/bin/install -c -m 755  table_log.so '/usr/pgsql-9.2/lib/'
/usr/bin/install -c -m 644 .//README.table_log '/usr/pgsql-9.2/doc/contrib/'
-- 



AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Adrian Klaver
Дата:
On 05/22/2017 09:41 PM, Ken Tanzer wrote:
> Hi.  I recently installed 9.6 on my Centos 6.9 server, alongside a
> still-running 9.2.
>
> I need to install a module for 9.6 (table_log) that is installed on 9.2.

Where did you get the table_log extension
> I took the table_log Makefile and changed it to point to
> /usr/pgsql-9.6/bin/pg_config instead of 9.2.  It is still installing
> into the 9.2 directory though.
>
> What's the cleanest or most proper way to target 9.6 in this situation?
> Transcript below, and TIA.
>

Using table_log from here:

http://pgfoundry.org/frs/?group_id=1000074

I usually do something like(using existing Makefile):


PATH=/usr/local/pgsql92/bin/:$PATH make USE_PGXS=1 clean all
rm -f table_log.so table_log.o
rm -f table_log.sql
sed 's,MODULE_PATHNAME,$libdir/table_log,g' table_log.sql.in >table_log.sql
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -fpic -I. -I.
-I/usr/local/pgsql92/include/server
-I/usr/local/pgsql92/include/internal -D_GNU_SOURCE
-I/usr/include/libxml2   -c -o table_log.o table_log.c
table_log.c: In function ‘table_log’:


PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all
rm -f table_log.so table_log.o
rm -f table_log.sql
sed 's,MODULE_PATHNAME,$libdir/table_log,g' table_log.sql.in >table_log.sql
gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -O2 -fpic -I. -I./
-I/usr/local/pgsql96/include/server
-I/usr/local/pgsql96/include/internal -D_GNU_SOURCE
-I/usr/include/libxml2   -c -o table_log.o table_log.c
table_log.c: In function ‘table_log’:
table_log.c:134:3: warning: implicit declaration of function
‘RelationGetNamespace’ [-Wimplicit-function-declaration]

Though in both cases the extension did not actually compile due to errors.

--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Ken Tanzer
Дата:
Thanks Adrian, though still no luck for me.  The compiling was working OK already, the install still goes to 9.2.


Where did you get the table_log extension

I no longer remember (it's been a few years), but my tgz file was the same as what's on pgfoundry

 
I usually do something like(using existing Makefile):

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all
   ...
 
Though in both cases the extension did not actually compile due to errors.

That worked fine for me.  (Somewhere along the way I added these two lines to table_log.c:

+#include <utils/rel.h>                                                                                     |
+#include <utils/timestamp.h> 
)

But the install still goes to 9.2:

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 install                  |
/bin/mkdir -p '/usr/pgsql-9.2/share/contrib'
/bin/mkdir -p '/usr/pgsql-9.2/lib'
/bin/mkdir -p '/usr/pgsql-9.2/doc/contrib'
/usr/bin/install -c -m 644  table_log.sql '/usr/pgsql-9.2/share/contrib/'
/usr/bin/install -c -m 755  table_log.so '/usr/pgsql-9.2/lib/'
/usr/bin/install -c -m 644 .//README.table_log '/usr/pgsql-9.2/doc/contrib/'

Any further help appreciated!  Thanks.

Ken

--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Adrian Klaver
Дата:
On 05/23/2017 04:54 PM, Ken Tanzer wrote:
> Thanks Adrian, though still no luck for me.  The compiling was working
> OK already, the install still goes to 9.2.
>
>
>     Where did you get the table_log extension
>
>
> I no longer remember (it's been a few years), but my tgz file was the
> same as what's on pgfoundry
>
>     I usually do something like(using existing Makefile):
>
>
>     PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all
>
>     ...
>
>
>     Though in both cases the extension did not actually compile due to
>     errors.
>
>
> That worked fine for me.  (Somewhere along the way I added these two
> lines to table_log.c:
>
> +#include <utils/rel.h>
>                                      |
> +#include <utils/timestamp.h>
> )
>
> But the install still goes to 9.2:
>
> PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 install

Did you do:

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all

or at least

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean

before you did the install step?

Or is there some environment variable set that could be interfering?

>     |
> /bin/mkdir -p '/usr/pgsql-9.2/share/contrib'
> /bin/mkdir -p '/usr/pgsql-9.2/lib'
> /bin/mkdir -p '/usr/pgsql-9.2/doc/contrib'
> /usr/bin/install -c -m 644  table_log.sql '/usr/pgsql-9.2/share/contrib/'
> /usr/bin/install -c -m 755  table_log.so '/usr/pgsql-9.2/lib/'
> /usr/bin/install -c -m 644 .//README.table_log '/usr/pgsql-9.2/doc/contrib/'
>
> Any further help appreciated!  Thanks.
>
> Ken
>
> --
> AGENCY Software
> A Free Software data system
> By and for non-profits
> /http://agency-software.org//
> /https://agency-software.org/demo/client/
> ken.tanzer@agency-software.org <mailto:ken.tanzer@agency-software.org>
> (253) 245-3801
>
> Subscribe to the mailing list
> <mailto:agency-general-request@lists.sourceforge.net?body=subscribe> to
> learn more about AGENCY or
> follow the discussion.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Ken Tanzer
Дата:

But the install still goes to 9.2:

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 install   

Did you do:

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all


I did.


Or is there some environment variable set that could be interfering?


I didn't see anything that would apply.  I've attached a dump of environment variables and also a re-run of the compile/install process.

Cheers,
Ken



--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.
Вложения

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Adrian Klaver
Дата:
On 05/23/2017 05:27 PM, Ken Tanzer wrote:
>
>         But the install still goes to 9.2:
>
>         PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 install
>
>
>     Did you do:
>
>     PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all
>
>
> I did.
>
>
>     Or is there some environment variable set that could be interfering?
>
>
> I didn't see anything that would apply.  I've attached a dump of
> environment variables and also a re-run of the compile/install process.

Try without the trailing:

PATH=/usr/local/pgsql96/bin:$PATH make USE_PGXS=1 clean all

>
> Cheers,
> Ken
>
>
>

--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Ken Tanzer
Дата:


On Tue, May 23, 2017 at 5:34 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 05/23/2017 05:27 PM, Ken Tanzer wrote:

        But the install still goes to 9.2:

        PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 install


    Did you do:

    PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 clean all


I did.


    Or is there some environment variable set that could be interfering?


I didn't see anything that would apply.  I've attached a dump of environment variables and also a re-run of the compile/install process.

Try without the trailing:

PATH=/usr/local/pgsql96/bin:$PATH make USE_PGXS=1 clean all



Sorry, not sure I follow what is the trailing part here? 

Does the compile stage specify where a module is to be installed?  Or is it determined at install time? 

Apart from the extra 96/bin directories I'm accumulating, I don't see anything suspicious in my path.  (And my /usrl/ocal/(s)bin directories are empty.)

[root@hosting table_log-0.4.4]# PATH=/usr/local/pgsql96/bin:$PATH ; echo "Path is: $PATH" ;  make USE_PGXS=1 clean all

Path is: /usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
rm -f table_log.so table_log.o 
...

[root@hosting table_log-0.4.4]# PATH=/usr/local/pgsql96/bin:$PATH ; echo "Path is: $PATH" ;  make USE_PGXS=1 install
Path is: /usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

/bin/mkdir -p '/usr/pgsql-9.2/share/contrib'
/bin/mkdir -p '/usr/pgsql-9.2/lib'
/bin/mkdir -p '/usr/pgsql-9.2/doc/contrib'
/usr/bin/install -c -m 644  table_log.sql '/usr/pgsql-9.2/share/contrib/'
/usr/bin/install -c -m 755  table_log.so '/usr/pgsql-9.2/lib/'
/usr/bin/install -c -m 644 .//README.table_log '/usr/pgsql-9.2/doc/contrib/'


Thanks,
Ken




--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Adrian Klaver
Дата:
On 05/23/2017 05:54 PM, Ken Tanzer wrote:
>
>
> On Tue, May 23, 2017 at 5:34 PM, Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:

>
> Sorry, not sure I follow what is the trailing part here?
>
> Does the compile stage specify where a module is to be installed?  Or is
> it determined at install time?
>
> Apart from the extra 96/bin directories I'm accumulating, I don't see
> anything suspicious in my path.  (And my /usrl/ocal/(s)bin directories
> are empty.)

You can close the terminal session and open a new one to clear the PATH.

The biggest problem is that I was out in the Sun too long today and was
not paying attention to what you posted.  This part:

PATH=/usr/local/pgsql96/bin:$PATH

is from how I installed various versions of Postgres from source on my
machine. My guess is it does not match your setup. You need to find
where pg_config is for your 9.6 install and use that path.

>
> [root@hosting table_log-0.4.4]# PATH=/usr/local/pgsql96/bin:$PATH ; echo
> "Path is: $PATH" ;  make USE_PGXS=1 clean all
>
> *Path is:
>
/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin*
> rm -f table_log.so table_log.o
> ...
>
> [root@hosting table_log-0.4.4]# PATH=/usr/local/pgsql96/bin:$PATH ; echo
> "Path is: $PATH" ;  make USE_PGXS=1 install
> *Path is:
>
/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/pgsql96/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin*
>
> /bin/mkdir -p '/usr/pgsql-9.2/share/contrib'
> /bin/mkdir -p '/usr/pgsql-9.2/lib'
> /bin/mkdir -p '/usr/pgsql-9.2/doc/contrib'
> /usr/bin/install -c -m 644  table_log.sql '/usr/pgsql-9.2/share/contrib/'
> /usr/bin/install -c -m 755  table_log.so '/usr/pgsql-9.2/lib/'
> /usr/bin/install -c -m 644 .//README.table_log '/usr/pgsql-9.2/doc/contrib/'
>
>
> Thanks,
> Ken
>
>
>
>
> --
> AGENCY Software
> A Free Software data system
> By and for non-profits
> /http://agency-software.org//
> /https://agency-software.org/demo/client/
> ken.tanzer@agency-software.org <mailto:ken.tanzer@agency-software.org>
> (253) 245-3801
>
> Subscribe to the mailing list
> <mailto:agency-general-request@lists.sourceforge.net?body=subscribe> to
> learn more about AGENCY or
> follow the discussion.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
John R Pierce
Дата:
On 5/23/2017 4:54 PM, Ken Tanzer wrote:
But the install still goes to 9.2:

PATH=/usr/local/pgsql96/bin/:$PATH make USE_PGXS=1 install                  |
/bin/mkdir -p '/usr/pgsql-9.2/share/contrib'


earlier you said something about /usr/pgsql-9.6/bin ...   is it that, or is it /usr/local/pgsql96/bin ?

does

    /usr/pgsql-9.6/bin/pg_config

output a whole pile of directory assignments that make sense ?

or does

    /usr/local/pgsql96/bin/pg_config

do that?



-- 
john r pierce, recycling bits in santa cruz

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Ken Tanzer
Дата:
The biggest problem is that I was out in the Sun too long today and was not paying attention to what you posted.  This part:

PATH=/usr/local/pgsql96/bin:$PATH

is from how I installed various versions of Postgres from source on my machine. My guess is it does not match your setup. You need to find where pg_config is for your 9.6 install and use that path.



Egads, my bad for not catching that path.  Works fine with adding the (actually-existing) /usr/pgsql-9.6/bin to the path.  Thanks so much for your help!

Can I also ask y'all a more general question about this, specifically related to how Postgres is packaged for RHEL/Centos?  I've got both 9.6 and 9.2 installed.  In this case though, it seems that the 9.2 version is privileged/selected by default.  But psql defaults to the 9.6 version.  Are there other similar things that will default to either 9.2 or 9.6?  And if so, what controls that behavior, is it easily-changeable, and/or can you go back and forth?

I've never tried running two versions at once before.  Maybe this is an isolated incident, but I'm just trying to get my mind around the concept, and know what kind of pitfalls if any to expect or beware of.  Thanks!

Ken


--
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
John R Pierce
Дата:
On 5/23/2017 11:39 PM, Ken Tanzer wrote:

Can I also ask y'all a more general question about this, specifically related to how Postgres is packaged for RHEL/Centos?  I've got both 9.6 and 9.2 installed.  In this case though, it seems that the 9.2 version is privileged/selected by default.  But psql defaults to the 9.6 version.  Are there other similar things that will default to either 9.2 or 9.6?  And if so, what controls that behavior, is it easily-changeable, and/or can you go back and forth?

I've never tried running two versions at once before.  Maybe this is an isolated incident, but I'm just trying to get my mind around the concept, and know what kind of pitfalls if any to expect or beware of.  Thanks!


when you run multiple versions, you need to keep the path *and* the port straight.  each server running is on a separate port.    I have one dev box at work that runs pg 9.3, 9.4, 9.5, and 9.6, all on seperate ports.


-- 
john r pierce, recycling bits in santa cruz

Re: [GENERAL] Installing module for 9.6, not 9.2, on Centos?

От
Devrim Gündüz
Дата:
Hi,

On Tue, 2017-05-23 at 23:39 -0700, Ken Tanzer wrote:

> Can I also ask y'all a more general question about this, specifically
> related to how Postgres is packaged for RHEL/Centos?  I've got both 9.6 and
> 9.2 installed.  In this case though, it seems that the 9.2 version is
> privileged/selected by default. 

It may happen only if 9.2 is installed via Red Hat RPMs. Otherwise, 9.6 will be
the selected by default for many binaries. If that is your case, you need to:

* Stop 9.2
* Uninstall 9.2 RPMs
* Install 9.2 from PGDG
* Start 9.2
* Stop 9.6
* Reinstall 9.6 (so that the binaries are fixed)
* Start 9.6

>  But psql defaults to the 9.6 version.  Are there other similar things that
> will default to either 9.2 or 9.6? 

These are the binaries that defaults to the higher version when there are more
than 1 major version are installed:

psql
clusterdb
createdb
createlang
createuser
dropdb
droplang
dropuser
pg_basebackup
pg_dump
pg_dumpall
pg_restore
reindexdb
vacuumdb


> And if so, what controls that behavior,

We control this by using alternatives

>  is it easily-changeable, and/or can you go back and forth?

Yes, you check update-alternatives command.

Regards,

--
Devrim Gündüz
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Вложения