Thread

  1. compilation of PostgreSQL 7.0.2 fails on Sun Solaris 2.5.1 using gcc 2.95.2 in interfaces/libpq++ if GNU ld is first in the $PATH

    Sergei Laskavy <ls@gambit.msk.su> — 2000-06-28T08:18:02Z

    Your name		: Sergei Laskavy
    Your email address	: <ls@gambit.msk.su>
    
    
    System Configuration
    ---------------------
      Architecture (example: Intel Pentium)  	: Sun SPARC
    
      Operating System (example: Linux 2.0.26 ELF) 	: Sun Solaris 2.5.1
    
      PostgreSQL version (example: PostgreSQL-7.0):   PostgreSQL-7.0.2
    
      Compiler used (example:  gcc 2.8.0)		: gcc 2.95.2 19991024 (release)
    
    
    Please enter a FULL description of your problem:
    ------------------------------------------------
    
    The generated Makefile for `interfaces/libpq++' starts the
    
    	ld -G -o libpq++.so.3.1 pgconnection.o pgdatabase.o pgtransdb.o
    	pgcursordb.o pglobject.o  -L../../interfaces/libpq -lpq -ldl
    	-lsocket -lresolv -lnsl -lm -lc
    
    command which depends on the ld version which depends on the user $PATH.
    
    If the GNU ld is first, ld stops with error:
    
    	pgconnection.o: could not read symbols: Bad value
    
    If the `Software Generation Utilities - Solaris/ELF (3.0)' ld from
    /usr/ccs/bin is first, everything is OK.
    
    Please describe a way to repeat the problem.   Please try to provide a
    concise reproducible example, if at all possible: 
    ----------------------------------------------------------------------
    
    	tar xfz postgresql-7.0.2.tar.gz
    	cd postgresql-7.0.2/src
    	./configure --prefix=/usr/local/postgresql-7.0.2 --enable-locale --with-includes=/usr/local/include --with-libraries=/usr/local/lib --with-perl --enable-recode
    	PATH=/usr/local/bin:/bin:/usr/ucb:/usr/sbin:/sbin:/usr/ccs/bin gmake
    
    The tail of make log is:
    
    g++ -pipe -g -O2 -I../../backend -I../../include -I../../interfaces/libpq -fPIC -c pgconnection.cc -o pgconnection.o
    g++ -pipe -g -O2 -I../../backend -I../../include -I../../interfaces/libpq -fPIC -c pgdatabase.cc -o pgdatabase.o
    g++ -pipe -g -O2 -I../../backend -I../../include -I../../interfaces/libpq -fPIC -c pgtransdb.cc -o pgtransdb.o
    g++ -pipe -g -O2 -I../../backend -I../../include -I../../interfaces/libpq -fPIC -c pgcursordb.cc -o pgcursordb.o
    g++ -pipe -g -O2 -I../../backend -I../../include -I../../interfaces/libpq -fPIC -c pglobject.cc -o pglobject.o
    ar crs libpq++.a pgconnection.o pgdatabase.o pgtransdb.o pgcursordb.o pglobject.o
    ranlib libpq++.a
    ld -G -o libpq++.so.3.1 pgconnection.o pgdatabase.o pgtransdb.o pgcursordb.o pglobject.o -L../../interfaces/libpq -lpq -ldl -lsocket -lresolv -lnsl -lm -lc
    pgconnection.o: could not read symbols: Bad value
    gmake: *** [libpq++.so.3.1] Error 1
    
    If you know how this problem might be fixed, list the solution below:
    ---------------------------------------------------------------------
    
    I was able to link a shared library using this (maybe more portable than
    `ld') command:
    
    	gcc -shared -o libpq++.so.3.1 pgconnection.o pgdatabase.o
    	pgtransdb.o pgcursordb.o pglobject.o