Re: Bug #448: 7.1.3 interfaces build fail on solaris w. gcc - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re: Bug #448: 7.1.3 interfaces build fail on solaris w. gcc
Date
Msg-id Pine.LNX.4.30.0109120132190.680-100000@peter.localdomain
Whole thread Raw
In response to Bug #448: 7.1.3 interfaces build fail on solaris w. gcc  (pgsql-bugs@postgresql.org)
List pgsql-bugs
> Bob Deblier (bob@virtualunlimited.com) reports a bug with a severity of 1

> This shouldn't be too hard to fix by adding the -lsocket and -lnsl libraries.

Done.

> Furthermore the dynamic linking of libraries is wrong. You use the -G
> option, which is appropriate for Sun's compilers, but not for gcc.
> With gcc, you have to use the '-shared' option.

GCC documents -G for shared libraries, and people have been using that for
years.  But it's probably not worth figuring this out since -shared is
clearly preferred.

> Hence all shared libraries fail to build because with a missing 'main'
> symbol. When this happens, the make process just continues, instead of
> aborting with an error.

Hmm, that's an interesting effect.

> Maybe you should switch to building with libtool?

Nope. ;-)

> Anyway, I'd appreciate it if I could directions to fix these problems.

1. in src/interfaces/odbc/GNUmakefile, change

    SHLIB_LINK = $(filter -lm, $(LIBS))
to
    SHLIB_LINK = $(filter -lm -lnsl -lsocket, $(LIBS))

2. in src/Makefile.shlib, change

LINK.shared          = $(COMPILER) -G

into

ifndef cplusplus
  ifeq ($(GCC), yes)
    LINK.shared      = $(CC) -shared
  else
    LINK.shared      = $(CC) -G
  endif
else
  ifeq ($(GXX), yes)
    LINK.shared      = $(CXX) -shared
  else
    LINK.shared      = $(CXX) -G
  endif
endif

(Or just change the -G if you don't care about generality.)

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4
Next
From: tomas@fabula.de
Date:
Subject: Re: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4