compiling libpq++ on Solaris with Sun SPRO6U2 (fixed & tested)

Started by Denis A Ustimenkoabout 24 years ago19 messages
#1Denis A Ustimenko
denis@oldham.ru

Sorry, previous patch was wrong.

Denis Ustimenko
--------------------------------------
*** orig/postgresql-7.1.3//src/makefiles/Makefile.solaris       О©╫О©╫ О©╫О©╫О©╫ 17
00:14:25 2000
--- postgresql-7.1.3//src/makefiles/Makefile.solaris    О©╫О©╫ О©╫О©╫О©╫ 17 14:33:11
2001
***************
*** 6,12 ****
  export_dynamic = -Wl,-E
  rpath = -Wl,-rpath,$(libdir)
  else
! rpath = -Wl,-R$(libdir)
  endif
  shlib_symbolic = -Wl,-Bsymbolic
--- 6,12 ----
  export_dynamic = -Wl,-E
  rpath = -Wl,-rpath,$(libdir)
  else
! rpath = -R$(libdir)
  endif
  shlib_symbolic = -Wl,-Bsymbolic
*** orig/postgresql-7.1.3//src/Makefile.shlib   О©╫О©╫ О©╫О©╫О©╫ 15 10:25:07 2001
--- postgresql-7.1.3//src/Makefile.shlib        О©╫О©╫ О©╫О©╫О©╫ 17 13:00:29 2001
***************
*** 179,185 ****
    ifeq ($(with_gnu_ld), yes)
      LINK.shared               += -Wl,-soname,$(soname)
    else
!     LINK.shared               += -Wl,-h,$(soname)
    endif
    SHLIB_LINK          += -lm -lc
  endif
--- 179,185 ----
    ifeq ($(with_gnu_ld), yes)
      LINK.shared               += -Wl,-soname,$(soname)
    else
!     LINK.shared               += -h $(soname)
    endif
    SHLIB_LINK          += -lm -lc
  endif
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Denis A Ustimenko (#1)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

Denis A Ustimenko writes:

[change -Wl,-R to -R and -Wl,-h to -h]

I'm having a difficult time understanding this. Both -R and -h are linker
options, not compiler options. So while the compiler driver might be nice
enough to recognize them as the former and pass them through, this change
just pushes these chances, and it doesn't add any theoretical change of
functionality.

So, if you want this to be fixed, you're going to have to start with
explaining your problem, and then we can start looking for solutions.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Dan
dphoenix@bravenet.com
In reply to: Peter Eisentraut (#2)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

whats wrong with kill -9' the postmaster
works fine for me hahahaa.

Show quoted text

Date: Wed, 17 Oct 2001 22:34:47 +0200 (CEST)
From: Peter Eisentraut <peter_e@gmx.net>
To: Denis A Ustimenko <denis@oldham.ru>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] compiling libpq++ on Solaris with Sun SPRO6U2
(fixed

Denis A Ustimenko writes:

[change -Wl,-R to -R and -Wl,-h to -h]

I'm having a difficult time understanding this. Both -R and -h are linker
options, not compiler options. So while the compiler driver might be nice
enough to recognize them as the former and pass them through, this change
just pushes these chances, and it doesn't add any theoretical change of
functionality.

So, if you want this to be fixed, you're going to have to start with
explaining your problem, and then we can start looking for solutions.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#4Denis A Ustimenko
denis@oldham.ru
In reply to: Peter Eisentraut (#2)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

On Wed, 17 Oct 2001, Peter Eisentraut wrote:

Denis A Ustimenko writes:

[change -Wl,-R to -R and -Wl,-h to -h]

I'm having a difficult time understanding this. Both -R and -h are linker
options, not compiler options. So while the compiler driver might be nice

Oh, no Peter:

denis@tracer$ CC -help|grep "\-h"
-h<name> Assign <name> to generated dynamic shared library
-help Same as -xhelp=flags
denis@tracer$ CC -help|grep "\-R"
-R<p>[:<p>...] Build runtime search path list into executable
denis@tracer$ cc -flags|grep "\-h"
-h <name> Assign <name> to generated dynamic shared library
denis@tracer$ cc -flags|grep "\-R"
-R<dir[:dir]> Build runtime search path list into executable

enough to recognize them as the former and pass them through, this change
just pushes these chances, and it doesn't add any theoretical change of
functionality.

So, if you want this to be fixed, you're going to have to start with
explaining your problem, and then we can start looking for solutions.

The problem is simple. I can't compile libpq++.so with latest Sun's
compiler:
$ make
.........
CC -KPIC -G -Wl,-h,libpq++.so.3 pgconnection.o pgdatabase.o pgtransdb.o
pgcursordb.o pglobject.o -L../../../src/interfaces/libpq -lpq -lm -lc
-Wl,-R/usr/local/pgsql/lib -o libpq++.so.3.1
CC: Warning: Option -Wl,-h,libpq++.so.3 passed to ld, if ld is invoked,
ignored otherwise
CC: Warning: Option -Wl,-R/usr/local/pgsql/lib passed to ld, if ld is
invoked, ignored otherwise
/usr/ccs/bin/ld: illegal option -- W
/usr/ccs/bin/ld: illegal option -- W
usage: ld [-6:abc:d:e:f:h:il:mo:p:rstu:z:B:D:F:GI:L:M:N:P:Q:R:S:VY:?]
file(s)
[-64] enforce a 64-bit link-edit
.........

But "CC -KPIC -G -h libpq++.so.3 ... -R/usr/local/pgsql/lib ..."
works fine for me.

Regards
Denis Ustimenko

#5Lee Kindness
lkindness@csl.co.uk
In reply to: Peter Eisentraut (#2)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

It's really quite simple, the Sun C compiler (acc) does not understand
the -Wl flag, rather it passes the -R and -h options onto the linker
verbatim.

Given the only two (realistic) compiler choices under Solaris are gcc
and acc it makes sense to support then both 'out of the box'.

I keep a similar patch to Denis's (without the wierd hi-ascii
characters in his) lying around for when i build a Solaris version.

Regards, Lee Kindness.

Peter Eisentraut writes:

Show quoted text

Denis A Ustimenko writes:

[change -Wl,-R to -R and -Wl,-h to -h]

I'm having a difficult time understanding this. Both -R and -h are linker
options, not compiler options. So while the compiler driver might be nice
enough to recognize them as the former and pass them through, this change
just pushes these chances, and it doesn't add any theoretical change of
functionality.

So, if you want this to be fixed, you're going to have to start with
explaining your problem, and then we can start looking for solutions.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#6Lee Kindness
lkindness@csl.co.uk
In reply to: Lee Kindness (#5)
1 attachment(s)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

For your information I've attached the man page for the Sun C
compiler, which explicitly lists the -h and -R flags.

Regards, Lee Kindness.

Lee Kindness writes:

Show quoted text

It's really quite simple, the Sun C compiler (acc) does not understand
the -Wl flag, rather it passes the -R and -h options onto the linker
verbatim.
Peter Eisentraut writes:

I'm having a difficult time understanding this. Both -R and -h are linker
options, not compiler options. So while the compiler driver might be nice
enough to recognize them as the former and pass them through, this change
just pushes these chances, and it doesn't add any theoretical change of
functionality.

Attachments:

acc-man.txttext/plainDownload
#7Peter Eisentraut
peter_e@gmx.net
In reply to: Lee Kindness (#6)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

Lee Kindness writes:

For your information I've attached the man page for the Sun C
compiler, which explicitly lists the -h and -R flags.

I didn't read much farther than

acc (SPARC only) is not intended to be used directly on
Solaris 2.x.

;-)

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#8Lee Kindness
lkindness@csl.co.uk
In reply to: Peter Eisentraut (#7)
Compiling on Solaris with Sun compiler

Peter Eisentraut writes:

Lee Kindness writes:

For your information I've attached the man page for the Sun C
compiler, which explicitly lists the -h and -R flags.

I didn't read much farther than
acc (SPARC only) is not intended to be used directly on
Solaris 2.x. ;-)

Touche, but the man page for the front-end (plain old cc) doesn't list
options and only refers to the acc man page ;)

Onto another Solaris compilation issue...

After a simple './configure' on a stock Solaris 2.6 box the
compilation of interfaces/ecpg/lib/execute.c fails due to the macro
definition of 'gettext' to ''. This macro is invoked on the prototype
of gettext() in libintl.h (included via locale.h).

A './configure --enable-nls' is needed.

To properly fix the problem either:

1. Don't include or use locale functions in execute.c unless
--enable-locale has been specified.

2. In execute.c the include for locale.h whould be moved above that
of postgres_fe.h

3. Replace '#define gettext' in c.h with something more unique
(PG_gettext perhaps?)

Regards, Lee Kindness.

#9Peter Eisentraut
peter_e@gmx.net
In reply to: Lee Kindness (#8)
Re: Compiling on Solaris with Sun compiler

Lee Kindness writes:

Touche, but the man page for the front-end (plain old cc) doesn't list
options and only refers to the acc man page ;)

Well, I'm stumped. All the Solaris compilers I've ever seen did support
and document the -Wl option.

After a simple './configure' on a stock Solaris 2.6 box the
compilation of interfaces/ecpg/lib/execute.c fails due to the macro
definition of 'gettext' to ''. This macro is invoked on the prototype
of gettext() in libintl.h (included via locale.h).

Fail how and why?

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#10Lee Kindness
lkindness@csl.co.uk
In reply to: Peter Eisentraut (#9)
Re: Compiling on Solaris with Sun compiler

Peter Eisentraut writes:

Lee Kindness writes:

Touche, but the man page for the front-end (plain old cc) doesn't list
options and only refers to the acc man page ;)

Well, I'm stumped. All the Solaris compilers I've ever seen did support
and document the -Wl option.

Well I never submitted my patch for building using the Sun compilers
since I thought that the newer versions did support the -Wl
option - I'm using an old (version 4) Sun compiler. However it seems
that Denis it using revision 2 of the latest version 6 compiler!

After a simple './configure' on a stock Solaris 2.6 box the
compilation of interfaces/ecpg/lib/execute.c fails due to the macro
definition of 'gettext' to ''. This macro is invoked on the prototype
of gettext() in libintl.h (included via locale.h).

Fail how and why?

Well in c.h there is the following define:

#ifdef ENABLE_NLS
#include <libintl.h>
#else
#define gettext(x) (x)
#endif
#define gettext_noop(x) (x)

so gettext() simply is the supplied parameter if --enable-nls is not
supplied. However ecpg/execute.c has the following includes:

#include "postgres_fe.h"
#include <stdio.h>
#include <locale.h>

Via postgres_fe.h gettext() gets defined as above. However locale.h
also pulls in the systems libintl.h which has the following prototype:

extern char *gettext();

which the preprocessor changes to:

extern char *();

due to the gettext define in c.h. Naturally this makes the build
fail.

Configuring with --enable-nls gets round this but I don't require that
functionality.

Regards, Lee Kindness.

#11Peter Eisentraut
peter_e@gmx.net
In reply to: Lee Kindness (#8)
Re: Compiling on Solaris with Sun compiler

Lee Kindness writes:

After a simple './configure' on a stock Solaris 2.6 box the
compilation of interfaces/ecpg/lib/execute.c fails due to the macro
definition of 'gettext' to ''. This macro is invoked on the prototype
of gettext() in libintl.h (included via locale.h).

This should be fixed now.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#12Lee Kindness
lkindness@csl.co.uk
In reply to: Lee Kindness (#10)
Re: Compiling on Solaris with Sun compiler

Lee Kindness writes:

Peter Eisentraut writes:

Lee Kindness writes:

Touche, but the man page for the front-end (plain old cc) doesn't list
options and only refers to the acc man page ;)

Well, I'm stumped. All the Solaris compilers I've ever seen did support
and document the -Wl option.

Well I never submitted my patch for building using the Sun compilers
since I thought that the newer versions did support the -Wl
option - I'm using an old (version 4) Sun compiler. However it seems
that Denis it using revision 2 of the latest version 6 compiler!

Does the patch break Sun compilers which do accept '-Wl'? If it
doesn't it might be worthwhile to apply it so things compile out of
the box for more Sun compilers...

Otherwise it'd be useful to included/mention the patch in the Solaris
FAQ.

Regards, Lee Kindness.

#13Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Denis A Ustimenko (#1)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed &

Can I get a status on this? I see Peter stated:

I didn't read much farther than

acc (SPARC only) is not intended to be used directly on
Solaris 2.x.

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

Sorry, previous patch was wrong.

Denis Ustimenko
--------------------------------------
*** orig/postgresql-7.1.3//src/makefiles/Makefile.solaris       ?? ??? 17
00:14:25 2000
--- postgresql-7.1.3//src/makefiles/Makefile.solaris    ?? ??? 17 14:33:11
2001
***************
*** 6,12 ****
export_dynamic = -Wl,-E
rpath = -Wl,-rpath,$(libdir)
else
! rpath = -Wl,-R$(libdir)
endif
shlib_symbolic = -Wl,-Bsymbolic
--- 6,12 ----
export_dynamic = -Wl,-E
rpath = -Wl,-rpath,$(libdir)
else
! rpath = -R$(libdir)
endif
shlib_symbolic = -Wl,-Bsymbolic
*** orig/postgresql-7.1.3//src/Makefile.shlib   ?? ??? 15 10:25:07 2001
--- postgresql-7.1.3//src/Makefile.shlib        ?? ??? 17 13:00:29 2001
***************
*** 179,185 ****
ifeq ($(with_gnu_ld), yes)
LINK.shared               += -Wl,-soname,$(soname)
else
!     LINK.shared               += -Wl,-h,$(soname)
endif
SHLIB_LINK          += -lm -lc
endif
--- 179,185 ----
ifeq ($(with_gnu_ld), yes)
LINK.shared               += -Wl,-soname,$(soname)
else
!     LINK.shared               += -h $(soname)
endif
SHLIB_LINK          += -lm -lc
endif

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#14Lee Kindness
lkindness@csl.co.uk
In reply to: Bruce Momjian (#13)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed &

Bruce Momjian writes:

Can I get a status on this? I see Peter stated:
I didn't read much farther than
acc (SPARC only) is not intended to be used directly on
Solaris 2.x.

Bruce, see attached message, I think to sum things up:

1. The patch will not harm Sun compilers which do support -Wl
2. It will help those who do not
3. We need to investigate which versions do/don't support the option,
it seems odd that (my) V4 compiler does not and Denis's V6.2
doesn't but I imagine Peter Eisentraut's does...

Looking thru the archives for 'Compiling on Solaris with Sun compiler'
should give more background.

Lee.

#15Peter Eisentraut
peter_e@gmx.net
In reply to: Lee Kindness (#14)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

Lee Kindness writes:

1. The patch will not harm Sun compilers which do support -Wl
2. It will help those who do not
3. We need to investigate which versions do/don't support the option,
it seems odd that (my) V4 compiler does not and Denis's V6.2
doesn't but I imagine Peter Eisentraut's does...

Okay, I figured it out:

The Solaris C compiler uses -Wl to pass options to the linker (like
everyone else). But the Solaris C++ compiler uses '-Qoption ld' to pass
options to the linker. Words are not sufficient...

So I guess that this patch is okay if you can assert that #1 above is
true. If it isn't we'll find out soon enough.

--
Peter Eisentraut peter_e@gmx.net

#16Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Peter Eisentraut (#15)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

Was this resolved and applied?

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

Lee Kindness writes:

1. The patch will not harm Sun compilers which do support -Wl
2. It will help those who do not
3. We need to investigate which versions do/don't support the option,
it seems odd that (my) V4 compiler does not and Denis's V6.2
doesn't but I imagine Peter Eisentraut's does...

Okay, I figured it out:

The Solaris C compiler uses -Wl to pass options to the linker (like
everyone else). But the Solaris C++ compiler uses '-Qoption ld' to pass
options to the linker. Words are not sufficient...

So I guess that this patch is okay if you can assert that #1 above is
true. If it isn't we'll find out soon enough.

--
Peter Eisentraut peter_e@gmx.net

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#17Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#16)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

Bruce Momjian writes:

Was this resolved and applied?

No. The proposed patch should still be applied.

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

Lee Kindness writes:

1. The patch will not harm Sun compilers which do support -Wl
2. It will help those who do not
3. We need to investigate which versions do/don't support the option,
it seems odd that (my) V4 compiler does not and Denis's V6.2
doesn't but I imagine Peter Eisentraut's does...

Okay, I figured it out:

The Solaris C compiler uses -Wl to pass options to the linker (like
everyone else). But the Solaris C++ compiler uses '-Qoption ld' to pass
options to the linker. Words are not sufficient...

So I guess that this patch is okay if you can assert that #1 above is
true. If it isn't we'll find out soon enough.

--
Peter Eisentraut peter_e@gmx.net

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

--
Peter Eisentraut peter_e@gmx.net

#18Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Denis A Ustimenko (#1)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed &

Patch applied. Sorry for the delay. I got confused in the resulting
discussion. This will appear in 7.2 final.

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

Sorry, previous patch was wrong.

Denis Ustimenko
--------------------------------------
*** orig/postgresql-7.1.3//src/makefiles/Makefile.solaris       ?? ??? 17
00:14:25 2000
--- postgresql-7.1.3//src/makefiles/Makefile.solaris    ?? ??? 17 14:33:11
2001
***************
*** 6,12 ****
export_dynamic = -Wl,-E
rpath = -Wl,-rpath,$(libdir)
else
! rpath = -Wl,-R$(libdir)
endif
shlib_symbolic = -Wl,-Bsymbolic
--- 6,12 ----
export_dynamic = -Wl,-E
rpath = -Wl,-rpath,$(libdir)
else
! rpath = -R$(libdir)
endif
shlib_symbolic = -Wl,-Bsymbolic
*** orig/postgresql-7.1.3//src/Makefile.shlib   ?? ??? 15 10:25:07 2001
--- postgresql-7.1.3//src/Makefile.shlib        ?? ??? 17 13:00:29 2001
***************
*** 179,185 ****
ifeq ($(with_gnu_ld), yes)
LINK.shared               += -Wl,-soname,$(soname)
else
!     LINK.shared               += -Wl,-h,$(soname)
endif
SHLIB_LINK          += -lm -lc
endif
--- 179,185 ----
ifeq ($(with_gnu_ld), yes)
LINK.shared               += -Wl,-soname,$(soname)
else
!     LINK.shared               += -h $(soname)
endif
SHLIB_LINK          += -lm -lc
endif

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#19Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Peter Eisentraut (#17)
Re: compiling libpq++ on Solaris with Sun SPRO6U2 (fixed

Bruce Momjian writes:

Was this resolved and applied?

No. The proposed patch should still be applied.

Thanks. Applied.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026