Bug #706: Wrong shlib flag for GCC compilation on Solaris

Started by PostgreSQL Bugs Listalmost 24 years ago4 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Richard Cook (rcook@insightful.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Wrong shlib flag for GCC compilation on Solaris

Long Description
In the file .../src/Makefile.shlib, line 178, the "-G" flag is set for compilation of shared libraries on Solaris. This is okay if you are using the Sun toolset. Unfortunately GCC needs the flag "-shared" instead. The symptom that reveals this is that pgaccess won't work because libpgtcl.so contains the "main" symbol. My workaround was to edit in the new flag. Somebody on the team might want to modify the Makefile to account for use of the gcc toolset. This defect set me back three days. Please don't let anyone else suffer through this. It might be well to post it as a known problem on Solaris.

Sample Code

No file was uploaded with this report

#2Bruce Momjian
bruce@momjian.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #706: Wrong shlib flag for GCC compilation on Solaris

In current CVS I see this, which looks fine. Does yours look the same?

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

ifeq ($(PORTNAME), solaris)
shlib :=
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_
VERSION)
ifndef cplusplus
ifeq ($(GCC), yes)
LINK.shared = $(CC) -shared
else
LINK.shared = $(CC) -G
endif
else
ifeq ($(GXX), yes)
LINK.shared = $(CXX) -shared
else
LINK.shared = $(CXX) -G
endif
endif
ifeq ($(with_gnu_ld), yes)
LINK.shared += -Wl,-soname,$(soname)
else
LINK.shared += -h $(soname)
endif
endif

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

pgsql-bugs@postgresql.org wrote:

Richard Cook (rcook@insightful.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Wrong shlib flag for GCC compilation on Solaris

Long Description
In the file .../src/Makefile.shlib, line 178, the "-G" flag is set for compilation of shared libraries on Solaris. This is okay if you are using the Sun toolset. Unfortunately GCC needs the flag "-shared" instead. The symptom that reveals this is that pgaccess won't work because libpgtcl.so contains the "main" symbol. My workaround was to edit in the new flag. Somebody on the team might want to modify the Makefile to account for use of the gcc toolset. This defect set me back three days. Please don't let anyone else suffer through this. It might be well to post it as a known problem on Solaris.

Sample Code

No file was uploaded with this report

---------------------------(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
#3Richard Cook x261
rcook@insightful.com
In reply to: Bruce Momjian (#2)
Re: Bug #706: Wrong shlib flag for GCC compilation on Solaris

Bruce,

My apologies. The file I worked with was from the postgresql-7.1.3.tar.gz.
I had started out with the latest (7.2.1) tar, but after various failures
rolled back to the 7.1.3 source, since I found evidence on the net that
somebody had succeeded in building that on Solaris. I lost track of that
change in source over the holiday weekend. It looks like 7.2.1 has it
right.

Even so, I have not yet fully succeeded in building with the 7.2.1 source.
Using GCC, I got a running postgres, but failed to get pgaccess to work. I
think that may be due to a corrupt libssl.so, but have not gone back to
verify this. Using Sun tools, the compilation succeeded, but I got a
WriteControlFile failure (File exists) when running "make check", which I
never could diagnose.

So now I have a fully working 7.1.3 build, and I am tempted to leave well
enough alone. Are the changes in 7.2.1 worth yet another build attempt?

Richard

P.S. Thanks for your reply. I have your book right next to me.

On Tue, 9 Jul 2002, Bruce Momjian wrote:

Show quoted text

In current CVS I see this, which looks fine. Does yours look the same?

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

ifeq ($(PORTNAME), solaris)
shlib :=
lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_
VERSION)
ifndef cplusplus
ifeq ($(GCC), yes)
LINK.shared = $(CC) -shared
else
LINK.shared = $(CC) -G
endif
else
ifeq ($(GXX), yes)
LINK.shared = $(CXX) -shared
else
LINK.shared = $(CXX) -G
endif
endif
ifeq ($(with_gnu_ld), yes)
LINK.shared += -Wl,-soname,$(soname)
else
LINK.shared += -h $(soname)
endif
endif

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

pgsql-bugs@postgresql.org wrote:

Richard Cook (rcook@insightful.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Wrong shlib flag for GCC compilation on Solaris

Long Description
In the file .../src/Makefile.shlib, line 178, the "-G" flag is set for compilation of shared libraries on Solaris. This is okay if you are using the Sun toolset. Unfortunately GCC needs the flag "-shared" instead. The symptom that reveals this is that pgaccess won't work because libpgtcl.so contains the "main" symbol. My workaround was to edit in the new flag. Somebody on the team might want to modify the Makefile to account for use of the gcc toolset. This defect set me back three days. Please don't let anyone else suffer through this. It might be well to post it as a known problem on Solaris.

Sample Code

No file was uploaded with this report

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

http://archives.postgresql.org

#4Bruce Momjian
bruce@momjian.us
In reply to: Richard Cook x261 (#3)
Re: Bug #706: Wrong shlib flag for GCC compilation on Solaris

Richard Cook x261 wrote:

Bruce,

My apologies. The file I worked with was from the postgresql-7.1.3.tar.gz.
I had started out with the latest (7.2.1) tar, but after various failures
rolled back to the 7.1.3 source, since I found evidence on the net that
somebody had succeeded in building that on Solaris. I lost track of that
change in source over the holiday weekend. It looks like 7.2.1 has it
right.

Even so, I have not yet fully succeeded in building with the 7.2.1 source.
Using GCC, I got a running postgres, but failed to get pgaccess to work. I
think that may be due to a corrupt libssl.so, but have not gone back to
verify this. Using Sun tools, the compilation succeeded, but I got a
WriteControlFile failure (File exists) when running "make check", which I
never could diagnose.

Strange. We have tons of people on Solaris.

So now I have a fully working 7.1.3 build, and I am tempted to leave well
enough alone. Are the changes in 7.2.1 worth yet another build attempt?

Yes, each major release is pretty major in terms of fixes and features.

-- 
  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