Bug #865: PostgreSQL 7.3 and 7.3.1 fails to compile pg_dump

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

D. Wright (wright@pair.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
PostgreSQL 7.3 and 7.3.1 fails to compile pg_dump

Long Description
While I can get PostgreSQL 7.2 to compile fine on my machine (running FreeBSD), I can not get 7.3 or 7.3.1 to compile.

I run configure with the following options (same as I used to compile 7.2):

--with-perl --enable-syslog --with-maxbackends=256 --with-libraries=/usr/lib:/usr/local/lib/:/usr/local/lib/lp

Then, when I run gmake, I get the following error:

pg_dump.c:192: elements of array `long_options' have incomplete type
pg_dump.c:193: warning: excess elements in struct initializer after `long_options[0]'
pg_dump.c:193: `no_argument' undeclared (first use in this function)
pg_dump.c:193: (Each undeclared identifier is reported only once
pg_dump.c:193: for each function it appears in.)
pg_dump.c:193: warning: excess elements in struct initializer after `long_options[0]'
pg_dump.c:193: warning: excess elements in struct initializer after `long_options[0]'
pg_dump.c:193: warning: excess elements in struct initializer after `long_options[0]'
pg_dump.c:194: warning: excess elements in struct initializer after `long_options[1]'
pg_dump.c:194: warning: excess elements in struct initializer after `long_options[1]'
pg_dump.c:194: warning: excess elements in struct initializer after `long_options[1]'
pg_dump.c:194: warning: excess elements in struct initializer after `long_options[1]'
...

Sample Code

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #865: PostgreSQL 7.3 and 7.3.1 fails to compile pg_dump

pgsql-bugs@postgresql.org writes:

Then, when I run gmake, I get the following error:

pg_dump.c:192: elements of array `long_options' have incomplete type
pg_dump.c:193: warning: excess elements in struct initializer after `long_options[0]'
pg_dump.c:193: `no_argument' undeclared (first use in this function)

Apparently, our configure script thinks you have getopt_long(), but you
really don't. Can you look into the situation and figure out why
configure is confused?

It surprises me that this would happen when 7.2 worked okay --- I don't
think we changed that configure test since 7.2. Are you sure nothing
changed on your machine since you last built 7.2?

A stopgap solution is just to remove #define HAVE_GETOPT_LONG from the
pg_config.h file made by configure; but if you don't want to fight the
problem in future, you'll need to help us figure out why configure is
making the wrong choice.

regards, tom lane

#3Dan Wright
wright@smx.pair.com
In reply to: Tom Lane (#2)
Re: Bug #865: PostgreSQL 7.3 and 7.3.1 fails to compile

On Tue, 7 Jan 2003, Tom Lane wrote:

Apparently, our configure script thinks you have getopt_long(), but you
really don't. Can you look into the situation and figure out why
configure is confused?

It surprises me that this would happen when 7.2 worked okay --- I don't
think we changed that configure test since 7.2. Are you sure nothing
changed on your machine since you last built 7.2?

Yes, I'm sure. This is what happens when I run configure with the 7.2.3 source:

root@dev# ./configure --with-perl --enable-syslog --with-maxbackends=256
--with-libraries=/usr/lib:/usr/local/lib/:/usr/local/lib/lpe | grep -i getopt
checking for getopt.h... no
checking for getopt_long... no

And this is with 7.3.1 (run several minutes later on the same machine):

root@dev# !./conf
./configure --with-perl --enable-syslog --with-maxbackends=256
--with-libraries=/usr/lib:/usr/local/lib/:/usr/local/lib/lpe | grep -i getopt
checking for library containing getopt_long... -lgnugetopt
checking getopt.h usability... no
checking getopt.h presence... no
checking for getopt.h... no
checking for getopt_long... yes

This is from config.log (in the 7.3.1 source):

configure:9866: gcc -o conftest -pipe -L/usr/lib -L/usr/local/lib/
-L/usr/local/lib/lpe conftest.c -lz -lreadline -lcrypt -lgnugetopt -lcompat -lm
-lutil >&5
configure:9869: $? = 0
configure:9872: test -s conftest
configure:9875: $? = 0
configure:9885: result: yes

I have confirmed the conftest.c which tests getopt_long in that section of the
code does indeed complie without errors.

I'm a bit stumped as to what to check next.

-Dan

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dan Wright (#3)
Re: Bug #865: PostgreSQL 7.3 and 7.3.1 fails to compile pg_dump

Dan Wright <wright@smx.pair.com> writes:

On Tue, 7 Jan 2003, Tom Lane wrote:

It surprises me that this would happen when 7.2 worked okay --- I don't
think we changed that configure test since 7.2. Are you sure nothing
changed on your machine since you last built 7.2?

Yes, I'm sure. This is what happens when I run configure with the 7.2.3 source:
[snip]

Okay, I was wrong. Looking at the sources, it's clear that 7.3 checks
getopt_long in libgnugetopt and libgetopt, whereas 7.2 only looks for it
in mainstream libraries. So it seems that your machine has libgnugetopt.so
or libgnugetopt.a, but not the corresponding header file (getopt.h).
Perhaps you need to install gnugetopt_devel to go with the gnugetopt RPM?

regards, tom lane