Build failure: TIMEZONE_GLOBAL undeclared

Started by Michael Fuhrover 21 years ago5 messagesbugs
Jump to latest
#1Michael Fuhr
mike@fuhr.org

A build of the latest CVS sources fails when compiling pgtz.c:

gcc -O2 -fno-strict-aliasing -g -Wall -Wmissing-prototypes -Wmissing-declarations -DFRONTEND -I../../src/include -I/usr/local/ssl/include -c -o pgtz.o pgtz.c
pgtz.c: In function `get_timezone_offset':
pgtz.c:99: error: `TIMEZONE_GLOBAL' undeclared (first use in this function)

PostgreSQL 8.0.0beta2 (CVS)
Solaris 9
gcc 3.4.1
gmake 3.80
src/timezone/pgtz.c 1.28
src/include/port.h 1.60

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

#2Bruce Momjian
bruce@momjian.us
In reply to: Michael Fuhr (#1)
Re: Build failure: TIMEZONE_GLOBAL undeclared

Michael Fuhr wrote:

A build of the latest CVS sources fails when compiling pgtz.c:

gcc -O2 -fno-strict-aliasing -g -Wall -Wmissing-prototypes -Wmissing-declarations -DFRONTEND -I../../src/include -I/usr/local/ssl/include -c -o pgtz.o pgtz.c
pgtz.c: In function `get_timezone_offset':
pgtz.c:99: error: `TIMEZONE_GLOBAL' undeclared (first use in this function)

PostgreSQL 8.0.0beta2 (CVS)
Solaris 9
gcc 3.4.1
gmake 3.80
src/timezone/pgtz.c 1.28
src/include/port.h 1.60

Wow, that is confusing. How could TIMEZONE_GLOBAL not be defined? Is
there some way port.h is not being included? If so I can't see it, and
it compiles here fine, which is strange. Your file version numbers
match mine though so you have all the versions I have.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Michael Fuhr
mike@fuhr.org
In reply to: Bruce Momjian (#2)
Re: Build failure: TIMEZONE_GLOBAL undeclared

On Thu, Sep 09, 2004 at 02:03:52AM -0400, Bruce Momjian wrote:

Michael Fuhr wrote:

gcc -O2 -fno-strict-aliasing -g -Wall -Wmissing-prototypes -Wmissing-declarations -DFRONTEND -I../../src/include -I/usr/local/ssl/include -c -o pgtz.o pgtz.c
pgtz.c: In function `get_timezone_offset':
pgtz.c:99: error: `TIMEZONE_GLOBAL' undeclared (first use in this function)

Wow, that is confusing. How could TIMEZONE_GLOBAL not be defined? Is
there some way port.h is not being included? If so I can't see it, and
it compiles here fine, which is strange.

It compiles fine on FreeBSD 4.10-STABLE with gcc 2.95.4. Running
the preprocessor on pgtz.c with "-E -dM" instead of "-c -o pgtz.o"
shows that on Solaris 9, HAVE_STRUCT_TM_TM_ZONE isn't defined and
HAVE_INT_TIMEZONE is, so the compiler hits the "return -TIMEZONE_GLOBAL"
line and fails:

#if defined(HAVE_STRUCT_TM_TM_ZONE)
return tm->tm_gmtoff;
#elif defined(HAVE_INT_TIMEZONE)
return -TIMEZONE_GLOBAL;
#else
#error No way to determine TZ? Can this happen?
#endif

On FreeBSD 4.10, HAVE_STRUCT_TM_TM_ZONE is defined, so the compiler
hits the "return tm->tm_gmtoff" line. Neither Solaris nor FreeBSD
has TIMEZONE_GLOBAL defined, presumably because port.h defines it
inside the "#ifdef WIN32" block beginning at line 169 (in port.h
version 1.60).

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

#4Bruce Momjian
bruce@momjian.us
In reply to: Michael Fuhr (#3)
Re: Build failure: TIMEZONE_GLOBAL undeclared

OK, got it. Patch attached. That Win32 block was so big I didn't even
see it. Thanks for the detective work.

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

Michael Fuhr wrote:

On Thu, Sep 09, 2004 at 02:03:52AM -0400, Bruce Momjian wrote:

Michael Fuhr wrote:

gcc -O2 -fno-strict-aliasing -g -Wall -Wmissing-prototypes -Wmissing-declarations -DFRONTEND -I../../src/include -I/usr/local/ssl/include -c -o pgtz.o pgtz.c
pgtz.c: In function `get_timezone_offset':
pgtz.c:99: error: `TIMEZONE_GLOBAL' undeclared (first use in this function)

Wow, that is confusing. How could TIMEZONE_GLOBAL not be defined? Is
there some way port.h is not being included? If so I can't see it, and
it compiles here fine, which is strange.

It compiles fine on FreeBSD 4.10-STABLE with gcc 2.95.4. Running
the preprocessor on pgtz.c with "-E -dM" instead of "-c -o pgtz.o"
shows that on Solaris 9, HAVE_STRUCT_TM_TM_ZONE isn't defined and
HAVE_INT_TIMEZONE is, so the compiler hits the "return -TIMEZONE_GLOBAL"
line and fails:

#if defined(HAVE_STRUCT_TM_TM_ZONE)
return tm->tm_gmtoff;
#elif defined(HAVE_INT_TIMEZONE)
return -TIMEZONE_GLOBAL;
#else
#error No way to determine TZ? Can this happen?
#endif

On FreeBSD 4.10, HAVE_STRUCT_TM_TM_ZONE is defined, so the compiler
hits the "return tm->tm_gmtoff" line. Neither Solaris nor FreeBSD
has TIMEZONE_GLOBAL defined, presumably because port.h defines it
inside the "#ifdef WIN32" block beginning at line 169 (in port.h
version 1.60).

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+9-9
#5Michael Fuhr
mike@fuhr.org
In reply to: Bruce Momjian (#4)
Re: Build failure: TIMEZONE_GLOBAL undeclared

On Thu, Sep 09, 2004 at 10:18:26AM -0400, Bruce Momjian wrote:

OK, got it. Patch attached. That Win32 block was so big I didn't even
see it. Thanks for the detective work.

Builds fine on Solaris 9 now -- thanks.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/