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

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #448: 7.1.3 interfaces build fail on solaris w. gcc
Date: 2001-09-11 12:11:36
Message-ID: 200109111211.f8BCBaJ09384@hub.org
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
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 I find 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.o columninfo.o connection.o convert.o drvconn.o environ.o execute.o lobj.o misc.o options.o pgtypes.o psqlodbc.o qresult.o results.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, but not 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2001-09-11 13:17:11 Re: Bug #447: lost connection to back end
Previous Message pgsql-bugs 2001-09-11 11:23:45 Bug #447: lost connection to back end