I have a problem building the beta2 (tarball, not current CVS) on
alphaev67-dec-osf4.0f, compiled by cc -std. All the 7.1.X tree compiled
fine, and I didn't have a chance before to build 7.2.

While building backend/utils/fmgr/dfmgr.c

make[4]: Entering directory
`/usr/local/src/postgresql-7.2b2/src/backend/utils/fmgr'
cc -std -O4 -Olimit 2000 -I../../../../src/include 
-DPKGLIBDIR=\"/tmp/pg72b2/usr/local/pgsql/lib\" -DDLSUFFIX=\".so\"  -c
-o dfmgr.o dfmgr.c
cc: Error: dfmgr.c, line 123: In this statement, "RTLD_GLOBAL" is not
declared.
(undeclared)
                file_scanner->handle = pg_dlopen(fullname);
---------------------------------------^
make[4]: *** [dfmgr.o] Error 1

pg_dlopen is defined in src/include/dynloader.h

#define  pg_dlopen(f)  dlopen((f), RTLD_LAZY | RTLD_GLOBAL)

This is what my Digital Unix sysadm told me:

RTLD_GLOBAL is not a valid definition under 4.0x - possibly under 5.x
but I haven't got a machine handy to check it on.  The only two
allowed values are:

  If mode is RTLD_LAZY, then the run-time loader does symbol resolution
only
  as needed.  Typically, this means that the first call to a function in
the
  newly loaded library will cause the resolution of the address of that
func-
  tion to occur.  If mode is RTLD_NOW, then the run-time loader must do
all
  symbol binding during the dlopen call.  The dlopen function returns a
han-
  dle that is used by dlsym or dlclose call.  If an error occurs, a NULL
  pointer is returned.

I suspect that RTLD_GLOBAL might be something new... actually it
appears to be a Linuxism or glibcism.  From the Linux dlopen man page:

       flag  must  be either RTLD_LAZY, meaning resolve undefined
       symbols as code from the dynamic library is  executed,  or
       RTLD_NOW,  meaning  resolve  all  undefined symbols before
       dlopen returns, and fail if this cannot be done.   Optionï¿½
       ally,  RTLD_GLOBAL  may  be or'ed with flag, in which case
       the external symbols defined in the library will  be  made
       available to subsequently loaded libraries.

the last few lines being the relevant ones.  I suspect it is something
to be sent off to the mailing list.   The flag appears to be available
also under Solaris 2.8 (where they also have RTLD_LOCAL for the
opposite effect).

Hope this helps, do you prefer I file it as a bug?

-- 
Alessio F. Bragadini		alessio@albourne.com
APL Financial Services		http://village.albourne.com
Nicosia, Cyprus		 	phone: +357-22-755750

"It is more complicated than you think"
		-- The Eighth Networking Truth from RFC 1925

Thu, 15 Nov 2001 10:11:31 +0200
Alessio Bragadini <alessio@albourne.com>
Problem compiling beta2 on Digital Unix (cc)
Alessio Bragadini writes:

> cc: Error: dfmgr.c, line 123: In this statement, "RTLD_GLOBAL" is not
> declared.
> (undeclared)

I'm going to apply the attached patch to appear in beta3.

Most systems that use the dlopen()-style interface support RTLD_GLOBAL.
Some older ones don't, but they should act like it by default.

-- 
Peter Eisentraut   peter_e@gmx.net
Thu, 15 Nov 2001 17:14:35 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: Problem compiling beta2 on Digital Unix (cc)