Thread: Solaris ODBC - linker flag needs to be set when building shared objects

Solaris ODBC - linker flag needs to be set when building shared objects

From
pgsql-bugs@postgresql.org
Date:
Mike McDonough (mpm@goldwiretech.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Solaris ODBC - linker flag needs to be set when building shared objects

Long Description
Linker flag which needs to be set when building shared objects to prevent a symbol in the executable overriding one in
theshared object: '-Bsymbolic' needs to be set in Makefile.shlib. This flag is set for linux builds, but not for
solaris.

  LDFLAGS_ODBC          := -Bsymbolic



Sample Code
Makefile.shlib:

---- CUT -------
ifeq ($(PORTNAME), linux)
  install-shlib-dep     := install-shlib
  shlib                         := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
  LDFLAGS_SL            := -Bdynamic -shared -soname $(shlib)
  LDFLAGS_ODBC          := -Bsymbolic -lc -lm
  SHLIB_LINK            += -lc
  CFLAGS                        += $(CFLAGS_SL)
endif

ifeq ($(PORTNAME), solaris_i386)
  install-shlib-dep     := install-shlib
  shlib                         := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
  LDFLAGS_SL            := -G
#+++rwhit, 12/12/00 added -Bsymbolic to fix SQLPrimaryKeys() - it's calls
#                   to other SQL*() functions were being resolved by
#                   the driver manager versions rather than the pgsql
#                   versions
  LDFLAGS_ODBC          := -Bsymbolic
  SHLIB_LINK            += -ldl -lsocket -lresolv -lnsl -lm -lc
  CFLAGS                        += $(CFLAGS_SL)
endif

ifeq ($(PORTNAME), solaris_sparc)
  install-shlib-dep     := install-shlib
  shlib                         := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
  LDFLAGS_SL            := -G
#+++rwhit, 12/12/00 added -Bsymbolic to fix SQLPrimaryKeys() - it's calls
#                   to other SQL*() functions were being resolved by
#                   the driver manager versions rather than the pgsql
#                   versions
  LDFLAGS_ODBC          := -Bsymbolic
  SHLIB_LINK            += -ldl -lsocket -lresolv -lnsl -lm -lc
  CFLAGS                        += $(CFLAGS_SL)
endif
--- END CUT ---

No file was uploaded with this report

Re: Solaris ODBC - linker flag needs to be set when building shared objects

From
Peter Eisentraut
Date:
> Mike McDonough (mpm@goldwiretech.com) reports a bug with a severity of 2

> Solaris ODBC - linker flag needs to be set when building shared objects

> Long Description

> Linker flag which needs to be set when building shared objects to
> prevent a symbol in the executable overriding one in the shared
> object: '-Bsymbolic' needs to be set in Makefile.shlib. This flag is
> set for linux builds, but not for solaris.

> #+++rwhit, 12/12/00 added -Bsymbolic to fix SQLPrimaryKeys() - it's calls
> #                   to other SQL*() functions were being resolved by
> #                   the driver manager versions rather than the pgsql
> #                   versions

Can you explain why this flag is needed?  What call is getting resolved
how and how should it have been resolved?  Since this flag is only
portable to ELF systems the problem should really be fixed some other way.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/