Re: Bug #448: 7.1.3 interfaces build fail on solaris w. gcc

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: <bob(at)virtualunlimited(dot)com>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug #448: 7.1.3 interfaces build fail on solaris w. gcc
Date: 2001-09-11 23:37:31
Message-ID: Pine.LNX.4.30.0109120132190.680-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Bob Deblier (bob(at)virtualunlimited(dot)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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message tomas 2001-09-12 04:27:10 Re: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4
Previous Message Peter Eisentraut 2001-09-11 23:16:17 Re: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4