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

From pgsql-bugs@postgresql.org
Subject Bug #448: 7.1.3 interfaces build fail on solaris w. gcc
Date
Msg-id 200109111211.f8BCBaJ09384@hub.org
Whole thread Raw
Responses Re: Bug #448: 7.1.3 interfaces build fail on solaris w. gcc  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
Bob Deblier (bob@virtualunlimited.com) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
7.1.3 interfaces build fail on solaris w. gcc

Long Description
I've been having problems with doing a dlopen() of libpsqlodbc since version 7.1; now that I wanted to trace the probem
Ifind the following problem during the build: 

make[2]: Entering directory `/opt/gnutools/postgresql-7.1.3/src/interfaces/odbc'
gcc  -Wall -Wmissing-prototypes -Wmissing-declarations -fPIC -G -Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic info.o
bind.ocolumninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o misc.o options.o pgtypes.o psqlodbc.o
qresult.oresults.o socket.o parse.o statement.o gpps.o tuple.o tuplelist.o dlg_specific.o  multibyte.o -lm -lm -lc
-Wl,-rpath,/opt/pgsql/lib-o libpsqlodbc.so.0.26 
/usr/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/crt1.o: In function `nope':
/usr/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/crt1.o(.text+0x5c): undefined reference to `main'
socket.o: In function `SOCK_connect_to':
socket.o(.text+0x280): undefined reference to `inet_addr'
socket.o(.text+0x2a0): undefined reference to `gethostbyname'
socket.o(.text+0x354): undefined reference to `socket'
socket.o(.text+0x3b8): undefined reference to `connect'
socket.o: In function `SOCK_flush_output':
socket.o(.text+0x92c): undefined reference to `send'
socket.o: In function `SOCK_get_next_byte':
socket.o(.text+0x9e0): undefined reference to `recv'
socket.o: In function `SOCK_put_next_byte':
socket.o(.text+0xb80): undefined reference to `send'

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

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

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. Maybe you should switch to building with libtool? 

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

Sample Code


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #447: lost connection to back end
Next
From: Peter Eisentraut
Date:
Subject: Re: Bug #447: lost connection to back end