On Thu, Dec 19, 2013 at 05:14:50AM +0000, Haribabu kommi wrote:
> On 19 December 2013 05:31 Bruce Momjian wrote:
> > On Wed, Dec 11, 2013 at 10:22:32AM +0000, Haribabu kommi wrote:
> > > The make_absolute_path() function moving to port is changed in
> > similar
> > > way as Bruce Momjian approach. The psprintf is used to store the
> > error
> > > string which Occurred in the function. But psprintf is not used for
> > > storing the absolute path As because it is giving problems in freeing
> > the allocated memory in SelectConfigFiles.
> > > Because the same memory is allocated in a different code branch from
> > guc_malloc.
> > >
> > > After adding the make_absolute_path() function with psprintf stuff in
> > > path.c file It is giving linking problem in compilation of ecpg. I am
> > not able to find the problem.
> > > So I added another file abspath.c in port which contains these two
> > functions.
> > 
> > What errors are you seeing?
> 
> If I move the make_absolute_path function from abspath.c to path.c,
> I was getting following linking errors while compiling "ecpg".
> 
> ../../../../src/port/libpgport.a(path.o): In function `make_absolute_path':
> /home/hari/postgres/src/port/path.c:795: undefined reference to `psprintf'
> /home/hari/postgres/src/port/path.c:809: undefined reference to `psprintf'
> /home/hari/postgres/src/port/path.c:818: undefined reference to `psprintf'
> /home/hari/postgres/src/port/path.c:830: undefined reference to `psprintf'
> collect2: ld returned 1 exit status
> make[4]: *** [ecpg] Error 1
> make[3]: *** [all-preproc-recurse] Error 2
> make[2]: *** [all-ecpg-recurse] Error 2
> make[1]: *** [all-interfaces-recurse] Error 2
> make: *** [all-src-recurse] Error 2

You didn't show the actual command that is generating the error, but I
assume it is linking ecpg, not creating libecpg.  I think the issue is
that path.c is specially handled when it is included in libecpg.  Here
is a comment from the libecpg Makefile:

        # We use some port modules verbatim, but since we need to
        # compile with appropriate options to build a shared lib, we can't
        # necessarily use the same object files as the backend uses. Instead,
        # symlink the source files in here and build our own object file.

My guess is that libecpg isn't marked as linking to libpgcommon, and
when you called psprintf in path.c, it added a libpgcommon link
requirement.

My guess is that if you compiled common/psprintf.c like port/path.c in
libecpg's Makefile, it would link fine.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to