Bug #677: Eliminating need for LD_LIBRARY_PATH during compile

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #677: Eliminating need for LD_LIBRARY_PATH during compile
Date: 2002-05-26 18:47:45
Message-ID: 20020526184745.67B8D47589B@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Randall Perry (rgp(at)systame(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Eliminating need for LD_LIBRARY_PATH during compile

Long Description
Below is a description of how the problem was solved. Peter Kurpis seems to think there's a problem with the PgSQL build.

**************

Been getting help for this problem on the gcc list, and finally got a
solution that works for me. Hope it helps you too.

The last configure command I tried before I got the solution was:
setenv LDFLAGS="-L/usr/local/lib -Wl,-R/usr/local/lib"; ./configure
--with-libraries=/usr/local/lib:/usr/local/ssl/lib:/usr/local/lib/sasl
--enable-syslog

Below is a private email from Peter Kurpis of gcc list, which solved the
problem. It involves editing the makefile directly after configure.

-------------------------------------------------------------------------

Yikes. I downloaded the postgres distribution, and tried configuring it
on a couple of systems with different environments. I wasn't able to
set things up properly with flags, and I'm not convinced the build system
is healthy, after the unusual problems I had. :-( (For one thing,
--without-gnu-ld and --with-gnu-ld=no didn't have the right effect:
the build was still using -rpath instead of -R .)

But here's what I suggest:

Run configure --enable-syslog

Afterward, in src/Makefile.port, which is the solaris-specific stuff,
replace:

ifeq ($(with_gnu_ld), yes)
export_dynamic = -Wl,-E
rpath = -Wl,-rpath,$(libdir)
else
rpath = -R$(libdir)
endif
shlib_symbolic = -Wl,-Bsymbolic

with:

rpath = -L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/local/ssl/lib
-L/usr/local/lib/sasl -Wl-R/usr/local/pgsql/lib -Wl,-R/usr/local/lib
-Wl,-R/usr/local/ssl/lib -Wl-R/usr/local/lib/sasl
shlib_symbolic = -Wl,-Bsymbolic

In other words, hardwire what you want to accomplish, as a kludge. It's
ugly, but I think it ought to work. Note that /usr/local/pgsql/lib seems to
be a default install directory -- see libdir in src/Makefile.global .
Since you are not using --libdir (or other similar ones) I think this
ought to stay like this; this is the default situation.

You can check things by running

gmake -np | grep ^LINK

The -n disables making any changes to the file system, -p causes printing
of the internal definitions tables. This will tell you what the build
looks like -- probably a standard build. Then do

gmake -np | grep ^LDFLAGS

and this ought to show you what you want to see.

Let me know how it goes... If you still have problems, cut and past
a line from the actual build, or perhaps you can send a log:

gmake >& make.log

so I can take a look at how (i.e. with which options) builds went.

Sample Code

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-05-26 20:48:08 Bug #678: delete rules false report
Previous Message Bjoern A. Zeeb 2002-05-26 17:28:11 PGSTAT: bind(2): Can't assign requested address