Thread

  1. 8.0 libpq: missing get_home_path()

    Karel Zak <zakkr@zf.jcu.cz> — 2004-08-18T13:42:05Z

     Hi,
    
     I tried compile some program with latest CVS libpq:
    
     gcc -O2 -O2 -g -pipe -march=i386 -mcpu=i686 -I/usr/include/httpd
     -Wall -I/usr/lib/postgresql/include -DLIBAPMOM_FUNCALL=1 -Wall
     -Wmissing-prototypes -Wmissing-declarations `xml2-config --cflags`
     `Wand-config --cppflags` -o jsn-importer main.o file.o db.o md5.o
     -L/usr/lib/postgresql/lib -lpq `xml2-config --libs` -lMagick -lWand
     
     /usr/lib/postgresql/lib/libpq.so: undefined reference to `get_home_path'
     
     collect2: ld returned 1 exit status
     make: *** [jsn-importer] Error 1
     
    
     It looks like port/path.c (libpgport) isn't compiled in PostgreSQL client libs,
     but the get_home_path() is used there. 
    
        Karel
    
    -- 
     Karel Zak  <zakkr@zf.jcu.cz>
     http://home.zf.jcu.cz/~zakkr/
    
    
  2. Re: 8.0 libpq: missing get_home_path()

    Tom Lane <tgl@sss.pgh.pa.us> — 2004-08-18T17:02:55Z

    Karel Zak <zakkr@zf.jcu.cz> writes:
    >  I tried compile some program with latest CVS libpq:
    
    >  gcc -O2 -O2 -g -pipe -march=i386 -mcpu=i686 -I/usr/include/httpd
    >  -Wall -I/usr/lib/postgresql/include -DLIBAPMOM_FUNCALL=1 -Wall
    >  -Wmissing-prototypes -Wmissing-declarations `xml2-config --cflags`
    >  `Wand-config --cppflags` -o jsn-importer main.o file.o db.o md5.o
    >  -L/usr/lib/postgresql/lib -lpq `xml2-config --libs` -lMagick -lWand
     
    >  /usr/lib/postgresql/lib/libpq.so: undefined reference to `get_home_path'
    
    There's another problem here, which is that pulling port/path.c into
    libpq to fix this will pollute application namespace with a whole bunch
    of global symbols that don't use a PQ or pq prefix.
    
    			regards, tom lane
    
    
  3. Re: 8.0 libpq: missing get_home_path()

    Bruce Momjian <pgman@candle.pha.pa.us> — 2004-08-18T17:08:35Z

    Tom Lane wrote:
    > Karel Zak <zakkr@zf.jcu.cz> writes:
    > >  I tried compile some program with latest CVS libpq:
    > 
    > >  gcc -O2 -O2 -g -pipe -march=i386 -mcpu=i686 -I/usr/include/httpd
    > >  -Wall -I/usr/lib/postgresql/include -DLIBAPMOM_FUNCALL=1 -Wall
    > >  -Wmissing-prototypes -Wmissing-declarations `xml2-config --cflags`
    > >  `Wand-config --cppflags` -o jsn-importer main.o file.o db.o md5.o
    > >  -L/usr/lib/postgresql/lib -lpq `xml2-config --libs` -lMagick -lWand
    >  
    > >  /usr/lib/postgresql/lib/libpq.so: undefined reference to `get_home_path'
    > 
    > There's another problem here, which is that pulling port/path.c into
    > libpq to fix this will pollute application namespace with a whole bunch
    > of global symbols that don't use a PQ or pq prefix.
    
    Yea, I am seeing that now too.  My guess is that I am going to have to
    go with a macro for get_home_path like I did for is_absolute_path.
    
    -- 
      Bruce Momjian                        |  http://candle.pha.pa.us
      pgman@candle.pha.pa.us               |  (610) 359-1001
      +  If your life is a hard drive,     |  13 Roberts Road
      +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
    
    
  4. Re: 8.0 libpq: missing get_home_path()

    Bruce Momjian <pgman@candle.pha.pa.us> — 2004-08-18T17:17:44Z

    Bruce Momjian wrote:
    > Tom Lane wrote:
    > > Karel Zak <zakkr@zf.jcu.cz> writes:
    > > >  I tried compile some program with latest CVS libpq:
    > > 
    > > >  gcc -O2 -O2 -g -pipe -march=i386 -mcpu=i686 -I/usr/include/httpd
    > > >  -Wall -I/usr/lib/postgresql/include -DLIBAPMOM_FUNCALL=1 -Wall
    > > >  -Wmissing-prototypes -Wmissing-declarations `xml2-config --cflags`
    > > >  `Wand-config --cppflags` -o jsn-importer main.o file.o db.o md5.o
    > > >  -L/usr/lib/postgresql/lib -lpq `xml2-config --libs` -lMagick -lWand
    > >  
    > > >  /usr/lib/postgresql/lib/libpq.so: undefined reference to `get_home_path'
    > > 
    > > There's another problem here, which is that pulling port/path.c into
    > > libpq to fix this will pollute application namespace with a whole bunch
    > > of global symbols that don't use a PQ or pq prefix.
    > 
    > Yea, I am seeing that now too.  My guess is that I am going to have to
    > go with a macro for get_home_path like I did for is_absolute_path.
    
    I need to call canonicalize_path() in the macro.  That kills the macro
    idea.
    
    -- 
      Bruce Momjian                        |  http://candle.pha.pa.us
      pgman@candle.pha.pa.us               |  (610) 359-1001
      +  If your life is a hard drive,     |  13 Roberts Road
      +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
    
    
  5. Re: 8.0 libpq: missing get_home_path()

    Tom Lane <tgl@sss.pgh.pa.us> — 2004-08-18T17:27:10Z

    Bruce Momjian <pgman@candle.pha.pa.us> writes:
    > I need to call canonicalize_path() in the macro.
    
    There is only one use of get_home_path in libpq.  Lose it and do
    a direct getenv(HOMEDIR).  You do not really need to do a
    canonicalize_path there; it'd be sufficient to insert the appropriate
    directory separator ('/' or '\') when forming pgpassfile just below.
    
    			regards, tom lane
    
    
  6. Re: 8.0 libpq: missing get_home_path()

    Bruce Momjian <pgman@candle.pha.pa.us> — 2004-08-18T18:35:20Z

    Tom Lane wrote:
    > Bruce Momjian <pgman@candle.pha.pa.us> writes:
    > > I need to call canonicalize_path() in the macro.
    > 
    > There is only one use of get_home_path in libpq.  Lose it and do
    > a direct getenv(HOMEDIR).  You do not really need to do a
    > canonicalize_path there; it'd be sufficient to insert the appropriate
    > directory separator ('/' or '\') when forming pgpassfile just below.
    
    OK, sounds like a plan. I will add a comment about its purpose.
    
    -- 
      Bruce Momjian                        |  http://candle.pha.pa.us
      pgman@candle.pha.pa.us               |  (610) 359-1001
      +  If your life is a hard drive,     |  13 Roberts Road
      +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
    
    
  7. Re: [HACKERS] 8.0 libpq: missing get_home_path()

    Bruce Momjian <pgman@candle.pha.pa.us> — 2004-08-19T00:01:19Z

    OK, patch attached and applied.  I also updated the docs.
    
    ---------------------------------------------------------------------------
    
    Tom Lane wrote:
    > Bruce Momjian <pgman@candle.pha.pa.us> writes:
    > > I need to call canonicalize_path() in the macro.
    > 
    > There is only one use of get_home_path in libpq.  Lose it and do
    > a direct getenv(HOMEDIR).  You do not really need to do a
    > canonicalize_path there; it'd be sufficient to insert the appropriate
    > directory separator ('/' or '\') when forming pgpassfile just below.
    > 
    > 			regards, tom lane
    > 
    > ---------------------------(end of broadcast)---------------------------
    > TIP 8: explain analyze is your friend
    > 
    
    -- 
      Bruce Momjian                        |  http://candle.pha.pa.us
      pgman@candle.pha.pa.us               |  (610) 359-1001
      +  If your life is a hard drive,     |  13 Roberts Road
      +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
    
  8. Re: [HACKERS] 8.0 libpq: missing get_home_path()

    Gaetano Mendola <mendola@bigfoot.com> — 2004-08-19T10:10:24Z

    Bruce Momjian wrote:
    
    > OK, patch attached and applied.  I also updated the docs.
    
    Just a note for the docs:
    
    "%USERPROFILE%/.pgpass" shall be not "%USERPROFILE%\.pgpass" ?
    
    
    Regards
    Gaetano Mendola