Symbol referencing errors

Started by Li Japinover 6 years ago10 messages
#1Li Japin
japinli@hotmail.com

Hi,

When I compile PostgreSQL-11.2 on SmartOS, I find the following errors:

Undefined            first referenced
 symbol                  in file
per_MultiFuncCall                   adminpack.o
end_MultiFuncCall                   adminpack.o
BuildTupleFromCStrings              adminpack.o
DecodeDateTime                      adminpack.o
TupleDescGetAttInMetadata           adminpack.o
path_is_prefix_of_path              adminpack.o
canonicalize_path                   adminpack.o
text_to_cstring                     adminpack.o
errmsg                              adminpack.o
superuser                           adminpack.o
errcode_for_file_access             adminpack.o
palloc                              adminpack.o
CurrentMemoryContext                adminpack.o
pstrdup                             adminpack.o
ReadDir                             adminpack.o
FreeFile                            adminpack.o
errfinish                           adminpack.o
init_MultiFuncCall                  adminpack.o
errstart                            adminpack.o
AllocateDir                         adminpack.o
GetUserId                           adminpack.o
is_member_of_role                   adminpack.o
psprintf                            adminpack.o
DataDir                             adminpack.o
Log_filename                        adminpack.o
Log_directory                       adminpack.o
AllocateFile                        adminpack.o
path_is_relative_and_below_cwd      adminpack.o
HeapTupleHeaderGetDatum             adminpack.o
errcode                             adminpack.o
FreeDir                             adminpack.o
ParseDateTime                       adminpack.o
path_contains_parent_reference      adminpack.o
pg_detoast_datum_packed             adminpack.o
CreateTemplateTupleDesc             adminpack.o
TupleDescInitEntry                  adminpack.o
ld: warning: symbol referencing errors
make[1]: Leaving directory
'/home/postgres/postgresql-11.2/contrib/adminpack'

My environment is:

# cat /etc/release
                                SmartOS x86_64
              Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
                   Copyright 2015 Joyent, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                   See joyent_20161108T160947Z for assembly date and time.
# $ pg_config
BINDIR = /home/postgres/pg11.2/bin
DOCDIR = /home/postgres/pg11.2/share/doc
HTMLDIR = /home/postgres/pg11.2/share/doc
INCLUDEDIR = /home/postgres/pg11.2/include
PKGINCLUDEDIR = /home/postgres/pg11.2/include
INCLUDEDIR-SERVER = /home/postgres/pg11.2/include/server
LIBDIR = /home/postgres/pg11.2/lib
PKGLIBDIR = /home/postgres/pg11.2/lib
LOCALEDIR = /home/postgres/pg11.2/share/locale
MANDIR = /home/postgres/pg11.2/share/man
SHAREDIR = /home/postgres/pg11.2/share
SYSCONFDIR = /home/postgres/pg11.2/etc
PGXS = /home/postgres/pg11.2/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/home/postgres/pg11.2' 'CFLAGS=-g -O0'
CC = gcc
CPPFLAGS =
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -g -O0
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,-R'/home/postgres/pg11.2/lib'
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lz -lreadline -lnsl -lsocket -lm
VERSION = PostgreSQL 11.2

Can anyone help me out? Thanks!

Best regards!

Japin Li

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Li Japin (#1)
Re: Symbol referencing errors

Li Japin <japinli@hotmail.com> writes:

When I compile PostgreSQL-11.2 on SmartOS, I find the following errors:
...
ld: warning: symbol referencing errors

Yeah, our SmartOS buildfarm members show those warnings too, eg

https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=damselfly&amp;dt=2019-04-22%2010%3A00%3A15&amp;stg=make-contrib

AFAICT they're harmless, so my advice is just ignore them.

If you're sufficiently annoyed by them to find the cause
and try to fix it, go ahead, but I haven't heard anyone
else worried about it. It might be that SmartOS wants
something like what we have to do on macOS and AIX,
ie provide the core postgres executable in some sort of
linker switch while linking shlibs that will be loaded
by that executable.

regards, tom lane

#3Li Japin
japinli@hotmail.com
In reply to: Tom Lane (#2)
Re: Symbol referencing errors

On 4/23/19 12:09 PM, Tom Lane wrote:

AFAICT they're harmless, so my advice is just ignore them.

If you're sufficiently annoyed by them to find the cause
and try to fix it, go ahead, but I haven't heard anyone
else worried about it. It might be that SmartOS wants
something like what we have to do on macOS and AIX,
ie provide the core postgres executable in some sort of
linker switch while linking shlibs that will be loaded
by that executable.

Yes, those errors does not impact the postgresql, but when
I use oracle_fdw extension, I couldn't startup the postgresql,
and I find that the dlopen throw an error which lead postmaster
exit, and there is not more information.

regards,

Japin Li

#4Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Tom Lane (#2)
Re: Symbol referencing errors

"Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

When I compile PostgreSQL-11.2 on SmartOS, I find the following errors:
...
ld: warning: symbol referencing errors

Tom> Yeah, our SmartOS buildfarm members show those warnings too, eg

Tom> https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=damselfly&amp;dt=2019-04-22%2010%3A00%3A15&amp;stg=make-contrib

Tom> AFAICT they're harmless, so my advice is just ignore them.

Tom> If you're sufficiently annoyed by them to find the cause
Tom> and try to fix it, go ahead, but I haven't heard anyone
Tom> else worried about it. It might be that SmartOS wants
Tom> something like what we have to do on macOS and AIX,
Tom> ie provide the core postgres executable in some sort of
Tom> linker switch while linking shlibs that will be loaded
Tom> by that executable.

I wonder if it's the use of -Bsymbolic that causes this (buildfarm logs
don't seem to go back far enough to check). (Note to original poster:
-Bsymbolic is there for a reason, you can't just remove it - but see
below.)

Since this is an ELF platform - arguably the closest thing to the
original reference ELF platform, at least by descent - it should not
require the kinds of tricks used on macOS and AIX; but we haven't done
the work needed to test using version scripts in place of -Bsymbolic for
fixing the symbol conflict problems. That ought to be a relatively
straightforward project for someone with access to a system to test on
(and I'm happy to advise on it).

The thing to do would be to try and copy the changes made to the *BSD
ports in commit e3d77ea6b instead of the change made in 4fa3741d1. The
contrib/postgres_fdw tests should show whether it worked or not.

--
Andrew (irc:RhodiumToad)

#5Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Li Japin (#3)
Re: Symbol referencing errors

On Tue, 2019-04-23 at 04:26 +0000, Li Japin wrote:

Yes, those errors does not impact the postgresql, but when
I use oracle_fdw extension, I couldn't startup the postgresql,
and I find that the dlopen throw an error which lead postmaster
exit, and there is not more information.

That may wall be a bug in oracle_fdw, since I have no reports of
anybody running it on that operating system.

Maybe you should open an oracle_fdw issue, but I don't know how
much I can help you, since this is the first time I have heard
of SmartOS.

Yours,
Laurenz Albe

#6Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Laurenz Albe (#5)
Re: Symbol referencing errors

On 2019-Apr-23, Laurenz Albe wrote:

Maybe you should open an oracle_fdw issue, but I don't know how
much I can help you, since this is the first time I have heard
of SmartOS.

SmartOS is just the continuation of OpenSolaris, AFAIU.

--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#6)
Re: Symbol referencing errors

Alvaro Herrera <alvherre@2ndquadrant.com> writes:

On 2019-Apr-23, Laurenz Albe wrote:

Maybe you should open an oracle_fdw issue, but I don't know how
much I can help you, since this is the first time I have heard
of SmartOS.

SmartOS is just the continuation of OpenSolaris, AFAIU.

Yeah. You can see these same link warnings on castoroides and
protosciurus, though they're no longer building HEAD for
lack of C99-compliant system headers.

regards, tom lane

#8Li Japin
japinli@hotmail.com
In reply to: Laurenz Albe (#5)
Re: Symbol referencing errors

Hi,

Finally, I find this crash is caused by shmget_osm, which does not support SmartOS (maybe,
I am not sure). When I install Oracle Instant Client 12.2.0.1.0, it works.

https://github.com/laurenz/oracle_fdw/issues/313

On 4/23/19 3:09 PM, Laurenz Albe wrote:

On Tue, 2019-04-23 at 04:26 +0000, Li Japin wrote:

Yes, those errors does not impact the postgresql, but when
I use oracle_fdw extension, I couldn't startup the postgresql,
and I find that the dlopen throw an error which lead postmaster
exit, and there is not more information.

That may wall be a bug in oracle_fdw, since I have no reports of
anybody running it on that operating system.

Maybe you should open an oracle_fdw issue, but I don't know how
much I can help you, since this is the first time I have heard
of SmartOS.

#9Andres Freund
andres@anarazel.de
In reply to: Andrew Gierth (#4)
Re: Symbol referencing errors

Hi,

On 2019-04-23 06:23:13 +0100, Andrew Gierth wrote:

I wonder if it's the use of -Bsymbolic that causes this (buildfarm logs
don't seem to go back far enough to check). (Note to original poster:
-Bsymbolic is there for a reason, you can't just remove it - but see
below.)

For the record, yes, the "ld: warning: symbol referencing errors" warnings are
due to -Bsymbolic while linking extensions. The man page says:
"The link-editor issues warnings for undefined symbols unless -z defs overrides"

Since this is an ELF platform - arguably the closest thing to the
original reference ELF platform, at least by descent - it should not
require the kinds of tricks used on macOS and AIX; but we haven't done
the work needed to test using version scripts in place of -Bsymbolic for
fixing the symbol conflict problems. That ought to be a relatively
straightforward project for someone with access to a system to test on
(and I'm happy to advise on it).

It's indeed trivial - the only change needed from linux is to replace
-Wl,--version-script=... with -Wl,-M...

Greetings,

Andres Freund

#10Andres Freund
andres@anarazel.de
In reply to: Andres Freund (#9)
1 attachment(s)
Re: Symbol referencing errors

Hi,

On 2022-08-23 01:34:36 -0700, Andres Freund wrote:

On 2019-04-23 06:23:13 +0100, Andrew Gierth wrote:

I wonder if it's the use of -Bsymbolic that causes this (buildfarm logs
don't seem to go back far enough to check). (Note to original poster:
-Bsymbolic is there for a reason, you can't just remove it - but see
below.)

For the record, yes, the "ld: warning: symbol referencing errors" warnings are
due to -Bsymbolic while linking extensions. The man page says:
"The link-editor issues warnings for undefined symbols unless -z defs overrides"

Since this is an ELF platform - arguably the closest thing to the
original reference ELF platform, at least by descent - it should not
require the kinds of tricks used on macOS and AIX; but we haven't done
the work needed to test using version scripts in place of -Bsymbolic for
fixing the symbol conflict problems. That ought to be a relatively
straightforward project for someone with access to a system to test on
(and I'm happy to advise on it).

It's indeed trivial - the only change needed from linux is to replace
-Wl,--version-script=... with -Wl,-M...

Patch attached. Passed check-world (without tap tests, didn't install the perl
mods) on solaris. Does anybody see a reason not to apply? Even just having
less noisy build logs seem like an advantage.

Greetings,

Andres Freund

Attachments:

v1-0001-solaris-Use-versioning-scripts-instead-of-Bsymbol.patchtext/x-diff; charset=us-asciiDownload
From 176c8c31a74e01d3005cc7df6bae5fcd951b2f0c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 23 Aug 2022 01:50:29 -0700
Subject: [PATCH v1] solaris: Use versioning scripts instead of -Bsymbolic

-Bsymbolic causes a lot of "ld: warning: symbol referencing errors"
warnings. It's quite easy to add the symbol versioning script, we just need a
slightly different parameter name.

Discussion: https://postgr.es/m/20220823083436.whtntk3bn3qpnvmb@awork3.anarazel.de
---
 src/Makefile.shlib | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 2af6192f0f3..3202b2e67de 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -188,10 +188,15 @@ ifeq ($(PORTNAME), linux)
 endif
 
 ifeq ($(PORTNAME), solaris)
-  LINK.shared		= $(COMPILER) -shared -Wl,-Bsymbolic
+  LINK.shared		= $(COMPILER) -shared
   ifdef soname
     LINK.shared	+= -Wl,-soname,$(soname)
   endif
+  BUILD.exports		= ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
+  exports_file		= $(SHLIB_EXPORTS:%.txt=%.list)
+  ifneq (,$(exports_file))
+    LINK.shared		+= -Wl,-M$(exports_file)
+  endif
 endif
 
 ifeq ($(PORTNAME), cygwin)
-- 
2.37.0.3.g30cc8d0f14