
=======================================================
    (FAQ)  PostgreSQL >= V6.1
  Linux
     FAQ
=======================================================
 :           Fri Jun 19 13:35:00 BST 1998

 :  Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
 :   Andrew C.R. Martin (martin@biochem.ucl.ac.uk)

   ,      off@tsinet.ru.
  18 19:09:53 MSK 1999
- LUG spslug.sposad.ru

   (* = , + = , - = ):

+1.23)         F_BOOLIN,
        F_BOOLOUT  F_BYTEAIN?

    :
1.*)     PostgreSQL
2.*)      
3.*)      


  :
1.1)          src/Makefile.global 
        src/Makefile.custom     ?
1.2)         libreadline?
1.3)    [REDHAT]      libdl  dlfcn.h?
1.4)    [SLACKWARE 3.1]      libdl and dlfcn.h?
1.5)           include  dlfcn.h
1.6)    GCC     -fpic
1.7)       
        warning: cast from pointer to integer of different size
1.8)    [SuSE-Linux 4.2-4.4]  curses  termcap?
1.9)        ld.so?
1.10)       `yy_flush_buffer undefined'?
1.11)      PostgreSQL    a.out?
1.12)    make  :
        yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
        make: /usr/bin/make: cannot execute binary file
1.13)      X11_LIB  libsocket  libnsl  src/Makefile.global?
1.14)   [DEBIAN]  libtermcap?
1.15)   [REDHAT]    PostgreSQL  RPM?
1.16)        Linux, 
	   :
        In file included from /usr/include/sys/sem.h:8,
                 from ipc.c:37:
        /usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
        ....
        make: *** [ipc.o] Error 1
1.17)     postgres, gcc    11  .
1.18)      6.1.1  MkLinux?
1.19)    make   ?
1.20)        486  pentium 
1.21)           (
           'timespan')?
1.22)            libpq 
         6.3.2?
1.23)          F_BOOLIN,
        F_BOOLOUT  F_BYTEAIN?
2.1)        libX11   pgtclsh
3.1)         _fUnKy_POSTPORT_sTuFf_ undefined, 
	   createuser
3.2)      postmaster      
	'Bad system call(Core dumped)'
3.3)       Postmaster,     
        Failed Assertion("!(file != 0):(null)", File:
        "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
        !(file != 0) (0)
        initdb: could not create template database
        initdb: cleaning up.
3.4)     createuser  ?
3.5)        :
        IpcMemoryCreate: memKey=155356396 , size=760632 ,
        permission=384IpcMemoryCreate: shmget(..., create, ...)
        failed: Invalid argument
3.6)     psql  :
        psql: can't load library 'libpq.so.1'
3.7)      
3.8)          PostgreSQL, Linux 
          fsck  .
3.9)     Query 32      ?
3.10)          
	  /, 
           select '4 hours'::timespan;
        returning '3 hours 59 minutes 60 seconds'?

----------------------------------------------------------------------
 1:       PostgreSQL
----------------------------------------------------------------------

1.1)          src/Makefile.global 
        src/Makefile.custom     ?

	  makefile      shell
        customize   src   Makefile.custom  .

               -  
        Flex,     2.5.3,   , 
	     createuser failing (  3.4)

           makefile ,   ** 
	 :
                PORTNAME=       linux

             :
                POSTGRESDIR

            USE_TCL,     :
                TCL_INCDIR=
                TCL_LIBDIR=
                TCL_LIB=
                TK_INCDIR=
                TK_LIBDIR=
                TK_LIB=
                X11_INCDIR=
                X11_LIBDIR=
                X11_LIB=

           Slackware3.0,  :
                TCL_INCDIR=     /usr/include/tcl
                TCL_LIBDIR=     /usr/lib
                TCL_LIB=        -ltcl
                TK_INCDIR=      /usr/include/tcl
                TK_LIBDIR=      /usr/lib
                TK_LIB=         -ltk
                X11_INCDIR=     /usr/include/X11
                X11_LIBDIR=     /usr/X386/lib
                X11_LIB=        -lX11

               ,   
	 INSTALL   Makefile.global


1.2)         libreadline?

         Linux      
	GNU readline.  ,      readline 
        src/Makefile.global  src/Makefile.custom   
	GNU readline.

        ,  Debian Linux ( FreeBSD)   
	readline.

	
1.3)    [REDHAT]      libdl  dlfcn.h?

                
         dlopen(), dlclose(),  ..     .

         libdl     
	    .   
	     Redhat.
	,   Redhat 4.0 (Colgate)  .

        RedHat   ld.so RPM    FTP .
         :

                ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/ld.so-1.7.14-4.i386.rpm

         RPM     !

        !    configure   make clean
             .

                 
               (  ).
	,       
	         . 
	  ,   !

             ,     
	 :

                ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ld.so-1.7.14.tar.gz

        ,       
        distributions/debian/buzz/binary-i386/base/ld.so-1.7.14-4.deb
          ,      1.2  
	  ,     Slackware 3.1.
                !



1.4)    [SLACKWARE 3.1]      libdl and dlfcn.h?

                
         dlopen(), dlclose(),  ..     .

            1.3. Slackware   3.0 
	          
	     3.1,    3.1
        ( 9  September 1996)     
         CD-ROM       3.1.

                 
               (  ).
	,       
	         . 
	  ,   !

            -    ldso.tgz   a4
	   Slackware    
          (/) ,  

                sh install/doinst.sh

          . 

                ldconfig

	!    configure   make clean
             .

            ,  -   
	 dlfcn.h  /usr/include.

        -,   libdl.so.1.7.14 (   )
	 /lib,  :

                cd /lib
                ln -sf libdl.so.1.7.14 libdl.so.1
                ln -sf libdl.so.1 libdl.so

           (    GCC) 
	 :

                cd /usr/lib
                ln -sf /lib/libdl.so .

        

                ldconfig

	!    configure   make clean
             .


1.5)           
	 dlfcn.h

            1.3/1.4.  ,    
	a.out  ,       dld
        (     a.out ) 
	 dlfcn.h.   1.11.


1.6)    GCC     -fpic

          GCC   -fpic  -fPIC.
           ,     (V2.7.2?)  -fPIC.
           ELF  Linux,   
	,   -fPIC   .

           ,  src/Makefile.global  
        CFLAGS_SL


1.7)    1.7)       
        warning: cast from pointer to integer of different size

               Postgres95  
	 . PostgreSQL V6.0  
	,    
        (     ).


1.8)    [SuSE-Linux 4.2-4.4]  curses  termcap?
        SuSE-Linux 4.2  ncurses,   curses.  4.4  .
        SuSE-Linux    termcap  /usr/lib/termcap
         /usr/lib.

        PostgreSQL (  V6.0)
        -----------------------
          CURSES_LIB  src/Makefile.custom  -lncurses
        (      customize).
            src/Makefile.custom:

                LDADD_BE+= -L/usr/lib/termcap

            src/bin/psql/Makefile  :
                ifeq ($(PORTNAME), linux)
                   LD_ADD+=
        :
                ifeq ($(PORTNAME), linux)
                   LD_ADD+= -ltermcap

        PostgreSQL (V6.1)
        -----------------
         configure     /usr/lib/termcap  
	 termcap,        
	,      .

            (   SuSE   ), 
	  configure,    
        src/Makefile.global   -ltermcap  LDFLAGS
        ( -lreadline). (,   
        src/Makefile.custom   configure.)

          SuSE   ncurses,   
	  ncurses  curses 
        -lcurses  -lncurses. (  SuSE 5.1)


1.9)        ld.so?

             ld.so,    
          ELF,      
        ( )  Linux.

            1.3/1.4.    
        ld.so.x.y.z  /lib  ldconfig.

            ld   1.7.14
          ,  1.8.x ld  .

1.10)       `yy_flush_buffer undefined'?

             Linux,      Linux.
	     flex (2.5.2  )
          PostgreSQL. ,  flex 2.5.3  : 
         3.4.

1.11)      PostgreSQL    a.out?

        -,     dld.    
        Sunsite:
        Linux/libs/dld.3.2.7.tar.gz
        (ftp://sunsite.unc.edu/pub/Linux/libs/dld.3.2.7.tar.gz)

        -,    src/Makefile.custom:
                LINUX_ELF=
        (   customize)

1.12)    make  :
        yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
        make: /usr/bin/make: cannot execute binary file

              Postgres95.  
         PostgreSQL  bison -y,   yacc.

        yacc    ,   bison -y
           (  make?  
        bash?) make      .

          ,   src/mk/port/postgres.mk.linux
            :
                # YACC = bison -y
        
                YACC = bison -y

1.13)      X11_LIB  libsocket  libnsl  src/Makefile.global?

            1.08 (   Sun Solaris).
           1.09  6.0

1.14)   [DEBIAN]  libtermcap?

        Debian Linux    termcap   ncurses
        (  terminfo).    
        CURSES_LIB  src/bin/psql/Makefile ..  Debian 
         libncurses  libcurses (   SuSE-Linux --- 
         1.8).

           src/bin/psql/Makefile :
                ifeq ($(PORTNAME), linux)
                   LD_ADD+= -ltermcap
        :
                ifeq ($(PORTNAME), linux)
                   LD_ADD+=


1.15)   [REDHAT]    PostgreSQL  RPM?

        ! Michal Mosiewicz
        (http://www.pdi.lodz.pl/~mimo)   RPM 
        PostgreSQL V6.0   Intel,    
        ftp://ftp.redhat.org/pub/Incoming/Postgres-6.0-1.i386.rpm

          ,  RPM      (3rd Feb 1997).

1.16)        Linux, 
	   :
        In file included from /usr/include/sys/sem.h:8,
                 from ipc.c:37:
        /usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
        ....
        make: *** [ipc.o] Error 1
	
          - ,   Linux    
	.    
        .../src/backend/storage/ipc   Makefile.
         
           CFLAGS+=$(INCLUDE_OPT)
        
           CFLAGS+=$(INCLUDE_OPT) -Wno-error

             ../src/backend/storage/lmgr.


1.17)     postgres, gcc    11  .
         :
           gcc: Internal compiler error: program cc1 got fatal
                signal 11

            /. PortgreSQL -  
	,    gcc (  
        PostgreSQL   )    
	,   ,     
	.       
	   ,       
	   DOS/Windows.

             :
           http://www.bitwizard.nl/sig11

          Sig11 FAQ     
	 Redhat 5.0 gcc    Cyrix.  
         URL !

1.18)      6.1.1  MkLinux?

        Tatsuo Ishii   
        MkLinux DR2.1 update2     :
        ftp://ftp.sra.co.jp/pub/cmd/postgres/6.1.1/mklinux.patch.gz

1.19)    make   ?

            gmake,    
	    .    
	 gmake 3.74 -   3.76.1  .
        , 3.74      .
        ,   gmake     
	,      

1.20)        486  pentium 

                486
         Pentium .    , 
        Makefile.custom  :

           CFLAGS+= -m486

         (  ,      )

           CFLAGS+= -mpentium
        
           CFLAGS+= -mpentiumpro

1.21)           (
           'timespan')?	   
          : '4 hours 59 mins 60.00 secs'
         '5 hours'

            glibc2,   Redhat 5.0.
	 glibc    RedHat  v5.0/hurricane.
	  glibc-2.0.7   .

1.22)            libpq 
         6.3.2?

               Linux 
        v6.3.2.   ftp://postgresql.org/pub/patches/ ,
         linux_elf .

1.23)          F_BOOLIN,
        F_BOOLOUT  F_BYTEAIN?

        ,   :

        -I/usr/include/readline -O2 -Wall -Wmissing-prototypes -I..
        -Wno-error -c bootstrap.c -o bootstrap.o
        bootstrap.c:160: `F_BOOLIN' undeclared here (not in a function)
        bootstrap.c:160: initializer element for `Procid[0].inproc' is not
        constant
        bootstrap.c:160: `F_BOOLOUT' undeclared here (not in a function)
        bootstrap.c:160: initializer element for `Procid[0].outproc' is not
        constant
        bootstrap.c:161: `F_BYTEAIN' undeclared here (not in a function)
        bootstrap.c:161: initializer element for `Procid[1].inproc' is not
        constant

              , ..  
          - .

            cpp      make.

         Redhat 5.1, cpp  /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3



----------------------------------------------------------------------
 2:        
----------------------------------------------------------------------

2.1)        libX11   pgtclsh

          src/Makefile.custom
                X11_LIBDIR = /usr/X11R6/lib


----------------------------------------------------------------------
 3:        
----------------------------------------------------------------------

3.1)         _fUnKy_POSTPORT_sTuFf_ undefined, 
	   createuser

           V1.06-V1.07 Postgres    V1.08  .

3.2)      postmaster      
	'Bad system call(Core dumped)'

         ,        
	.     Linux,  
	.

3.3)       Postmaster,     
        Failed Assertion("!(file != 0):(null)", File:
        "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
        !(file != 0) (0)
        initdb: could not create template database
        initdb: cleaning up.
	
           /dev/null .

        ls -l /dev/null   - :

                crw-rw-rw-  1 root  wheel    2,   2 Oct  8 18:41 /dev/null

         , :

                chmod a+rw /dev/null

3.4)     createuser  ?

            2.5.3 GNU flex  createuser.
            flex  V2.5.2,   V2.5.4
            V2.5.3,    doc/README.flex
           V2.5.4 
        ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz

3.5)        :
        IpcMemoryCreate: memKey=155356396 , size=760632 ,
        permission=384IpcMemoryCreate: shmget(..., create, ...)
        failed: Invalid argument

            IPC   Linux.   
	,   .

3.6)     psql  :
        psql: can't load library 'libpq.so.1'

        Psql      libpq.

          ,     root  
                /etc/ld.so.conf
            ,   
         PostgreSQL ( lib 
        PostgreSQL)  
                /sbin/ldconfig -v

        , (and if you don't have root access),  
          LD_LIBRARY_PATH.

         LD_LIBRARY_PATH   
	    .    
	  ,   ldconfig.

          Bash,  -  :
                export LD_LIBRARY_PATH='PathToPGSQL'/lib
        ,   tcsh
                setenv LD_LIBRARY_PATH 'PathToPGSQL'/lib
         'PathToPGSQL'     
	 PostgreSQL

        ,   ldd      
             ,   
	,   .

3.7)      	

          ,          
	   ,        
	,      
	 libpq.       
        (,  /usr/lib),      
	,    . ,     
          Q3.6   .

3.8)          PostgreSQL, Linux 
          fsck  .

                -
         PostgreSQL  /etc/inittab  
          INSTALL.

           postmaster  
        rc.   Slackware-,   
        /etc/rc.d/rc.local   postmaster.   RedHat-
             SysV  /etc/rc.d/rc3.d, 
	   /etc/rc.d/init.d.

            contrib/linux/postgres.init

             John Robinson,
	    :

#!/bin/sh
#
# postgreSQL.init   shell    
#               PostgreSQL postmaster.
#

#   .
. /etc/rc.d/init.d/functions

#   .
. /etc/sysconfig/network

# ,   .
[ ${NETWORKING} = "no" ] && exit 0

#   .
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting postgres Postmaster daemon:"
        if [ -z "`pidofproc postmaster`" ]
        then
                su postgres -c "/usr/local/pgsql/bin/postmaster -D /home/postgreSQL/data -p 5432 &"
                echo -n " postmaster"
        else
                echo -n " (already running)"
        fi
        echo
        touch /var/lock/subsys/postgres
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down postgres Postmaster daemon: "
        killall -TERM postmaster 2>/dev/null
        killall -TERM postgres 2>/dev/null
        echo
        rm -f /var/lock/subsys/postgres
        ;;
  *)
        echo "Usage: postgres {start|stop}"
        exit 1
esac

exit 0



3.9)     Query 32      ?

        -     ,    
         linux .     ,   
        (  Tatsuo Ishii ):

        1.   regress.sh:
                time postgres -texecutor -tplanner -Q bench < bench.sql
        :
                postgres -texecutor -tplanner -Q bench < bench.sql

        2.   ,      bench.out 
	:
                85.86user 114.47system 4:49.20elapsed 69%CPU (0avgtext+0avgdata
 0maxresident)k
         :
                sh ./perquery < bench.out > & bench.out.perquery


3.10)          
	  /, 
           select '4 hours'::timespan;
        returning '3 hours 59 minutes 60 seconds'?
	
	    glibc2     
        2.0.7.      .
	 .
----------------------------------------------------------------------------
Dr. Andrew C.R. Martin                             University College London
EMAIL: (Work) martin@biochem.ucl.ac.uk    (Home) andrew@stagleys.demon.co.uk
URL:   http://www.biochem.ucl.ac.uk/~martin
Tel:   (Work) +44(0)171 419 3890                    (Home) +44(0)1372 275775
