Re: Bug #584: postgresql will not build on Solaris with cc - Mailing list pgsql-bugs

From Nishad Prakash
Subject Re: Bug #584: postgresql will not build on Solaris with cc
Date
Msg-id Pine.GSO.4.44.0202121401090.12261-100000@e4e.oac.uci.edu
Whole thread Raw
In response to Re: Bug #584: postgresql will not build on Solaris with cc  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Tue, 12 Feb 2002, Tom Lane wrote:

> pgsql-bugs@postgresql.org writes:
> > postgresql will not build on Solaris with cc
>
> I just found out yesterday that /usr/ucb/cc doesn't work very well on
> Solaris; it tries to provide a BSD-ish environment and doesn't really
> succeed.  You want to use the SUNpro compiler directly, or via the
> standard link /usr/ccs/bin/ucbcc.

This is indeed important to keep in mind for Solaris users.  However, it
will not fix the original poster's problem, which was this:

ld: fatal: symbol `_fini' is multiply defined:
        (file /opt/SUNWspro/SC4.0/lib/crti.o and file psqlodbc.o);
ld: fatal: symbol `_init' is multiply defined:
        (file /opt/SUNWspro/SC4.0/lib/crti.o and file psqlodbc.o);


_fini and _init are already defined in the C run time environment (to
make sure this is true on your system, write a simple 'hello world'
program, compile and link, and run 'nm' on it).

They are also defined in src/interfaces/odbc/psqlodbc.c.  I am
speaking of 7.1.3 here, but it seems to be true of whichever version
the OP was trying to build.

Note the rather disingenuous comment in the code, appearing as it does in
the Solaris port.

-------------------------------------------------------------------------
/* These two functions do shared library initialziation on UNIX, well at
 * on Linux. I don't know about other systems.
 */

BOOL
_init(void)
{
        getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
        return TRUE;
}

BOOL
_fini(void)
{
        return TRUE;
}

-------------------------------------------------------------------------

After you comment out these two, things should build just fine.  However,
I have never tested the ODBC interface. so I don't know if things will
*work* just fine as well.

Cheers,

Nishad
--
"Underneath the concrete, the dream is still alive" -- Talking Heads

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #584: postgresql will not build on Solaris with cc
Next
From: Bruce Momjian
Date:
Subject: Re: Bug #583: Wrong example in 7.2 Tutorial