Re: list_head naming conflict gcc 4.2/perl/solaris

Lists: pgsql-hackers
From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: list_head naming conflict gcc 4.2/perl/solaris
Date: 2009-06-01 19:57:48
Message-ID: 1243886268.1319.27.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

During integration gcc4.2 into Solaris. My colleague hit a following
problem with PostgreSQL compilation:

http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6845982

cd /builds/sfw-fixes/usr/src/cmd/postgres/postgresql-8.2/postgresql-8.2.13/src/pl/plperl
+ /ws/onnv-tools/SUNWspro/SS12/bin/cc -xO3 -m32 -xchip=pentium -xspace -Xa -xildoff -xc99=all -xc99=none -xCC -KPIC -I. -I../../../src/include -I/builds/sfw-fixes/proto/root_i386/usr/include -I/builds/sfw-fixes/proto/root_i386/usr/sfw/include -I/usr/sfw/include -I/usr/include/kerberosv5 -I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE -c -o plperl.o plperl.c
"/usr/include/sys/list.h", line 52: identifier redeclared: list_head
current : function(pointer to struct list {unsigned int list_size, unsigned int list_offset, struct list_node {..} list_head}) returning pointer to void
previous: function(pointer to struct List {enum NodeTag {T_TIDBitmap(902), (blah blah)

At this moment there is no clear conclusion how to fix it in solaris system headers to satisfy all side. :(

My idea is to rename list_head to pg_list_head (and other functions analogously) to avoid name conflict.

Comments, better ideas?

Thanks Zdenek


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list_head naming conflict gcc 4.2/perl/solaris
Date: 2009-06-01 20:03:12
Message-ID: 603c8f070906011303s3c3bf4b5y20a74edc95fcf979@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jun 1, 2009 at 3:57 PM, Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com> wrote:
> During integration gcc4.2 into Solaris. My colleague hit a following
> problem with PostgreSQL compilation:
>
> http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6845982
>
> cd /builds/sfw-fixes/usr/src/cmd/postgres/postgresql-8.2/postgresql-8.2.13/src/pl/plperl
> + /ws/onnv-tools/SUNWspro/SS12/bin/cc -xO3 -m32 -xchip=pentium -xspace -Xa -xildoff -xc99=all -xc99=none -xCC -KPIC -I. -I../../../src/include -I/builds/sfw-fixes/proto/root_i386/usr/include -I/builds/sfw-fixes/proto/root_i386/usr/sfw/include -I/usr/sfw/include -I/usr/include/kerberosv5 -I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE -c -o plperl.o plperl.c
> "/usr/include/sys/list.h", line 52: identifier redeclared: list_head
>        current : function(pointer to struct list {unsigned int list_size, unsigned int list_offset, struct list_node {..} list_head}) returning pointer to void
>        previous: function(pointer to struct List {enum NodeTag {T_TIDBitmap(902), (blah blah)
>
> At this moment there is no clear conclusion how to fix it in solaris system headers to satisfy all side.  :(
>
> My idea is to rename list_head to pg_list_head (and other functions analogously) to avoid name conflict.
>
>        Comments, better ideas?

Uh... isn't it rather bad form for the operating system headers to be
defining commonly used type names like "list"? I'd be very surprised
if PostgreSQL is the only application that is going to break on this.

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list_head naming conflict gcc 4.2/perl/solaris
Date: 2009-06-01 20:09:36
Message-ID: 23415.1243886976@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
> My idea is to rename list_head to pg_list_head (and other functions analogously) to avoid name conflict.

There is zero chance of that happening. We have thousands of references
to those functions in the core code, and who knows how many more in
third-party code we don't control.

What is <sys/list.h>, and why is it being imported by the Perl headers?
Can we do something like "#define list_head solaris_list_head" around
the problematic #include? (Which one is that, anyway?)

regards, tom lane


From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list_head naming conflict gcc 4.2/perl/solaris
Date: 2009-06-01 20:27:07
Message-ID: 1243888027.1319.45.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Robert Haas píše v po 01. 06. 2009 v 16:03 -0400:
> On Mon, Jun 1, 2009 at 3:57 PM, Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com> wrote:
> > During integration gcc4.2 into Solaris. My colleague hit a following
> > problem with PostgreSQL compilation:
> >
> > http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6845982
> >
> > cd /builds/sfw-fixes/usr/src/cmd/postgres/postgresql-8.2/postgresql-8.2.13/src/pl/plperl
> > + /ws/onnv-tools/SUNWspro/SS12/bin/cc -xO3 -m32 -xchip=pentium -xspace -Xa -xildoff -xc99=all -xc99=none -xCC -KPIC -I. -I../../../src/include -I/builds/sfw-fixes/proto/root_i386/usr/include -I/builds/sfw-fixes/proto/root_i386/usr/sfw/include -I/usr/sfw/include -I/usr/include/kerberosv5 -I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE -c -o plperl.o plperl.c
> > "/usr/include/sys/list.h", line 52: identifier redeclared: list_head
> > current : function(pointer to struct list {unsigned int list_size, unsigned int list_offset, struct list_node {..} list_head}) returning pointer to void
> > previous: function(pointer to struct List {enum NodeTag {T_TIDBitmap(902), (blah blah)
> >
> > At this moment there is no clear conclusion how to fix it in solaris system headers to satisfy all side. :(
> >
> > My idea is to rename list_head to pg_list_head (and other functions analogously) to avoid name conflict.
> >
> > Comments, better ideas?
>
> Uh... isn't it rather bad form for the operating system headers to be
> defining commonly used type names like "list"?

It is in solaris since 2003 for kernel structure linked list. When I
look on it closer, it seems that problem is more in perl which includes
some sys/ headers which is probably not good practice. :(

> I'd be very surprised
> if PostgreSQL is the only application that is going to break on this.

At this moment I know only about PostgreSQL. How I understand it now, it
appears only when source is compiling with Perl.

I will look more on it tomorrow.

thanks Zdenek


From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list_head naming conflict gcc 4.2/perl/solaris
Date: 2009-06-01 20:45:27
Message-ID: 1243889127.1319.62.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Tom Lane píše v po 01. 06. 2009 v 16:09 -0400:
> Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:

> What is <sys/list.h>, and why is it being imported by the Perl headers?

It seems that problem is with Perl. It includes sys/mode.h. The new
change for gcc 4.2 is that mode.h includes vnode.h and it finally
sys/list.h which is generic list for kernel structures.

> Can we do something like "#define list_head solaris_list_head" around
> the problematic #include? (Which one is that, anyway?)

I will try it. There is following hack:

CFLAGS="-D_SYS_VNODE_H"

which disable vnode.h and breaks include chain.

I need to install fresh nightly build of Solaris to test it on live
system.

Thanks Zdenek


From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: list_head naming conflict gcc 4.2/perl/solaris
Date: 2009-06-03 20:08:09
Message-ID: 1244059689.1380.23.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Zdenek Kotala píše v po 01. 06. 2009 v 22:45 +0200:
> Tom Lane píše v po 01. 06. 2009 v 16:09 -0400:
> > Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
>
>
> > What is <sys/list.h>, and why is it being imported by the Perl headers?
>
> It seems that problem is with Perl. It includes sys/mode.h. The new
> change for gcc 4.2 is that mode.h includes vnode.h and it finally
> sys/list.h which is generic list for kernel structures.
>
> > Can we do something like "#define list_head solaris_list_head" around
> > the problematic #include? (Which one is that, anyway?)
>
> I will try it. There is following hack:
>
> CFLAGS="-D_SYS_VNODE_H"
>
> which disable vnode.h and breaks include chain.
>
> I need to install fresh nightly build of Solaris to test it on live
> system.

Perl includes sys/mode.h which is probably not necessary (it look likes
that it is something for AIX), but it seems that sys/*.h headers
modifications break more than only PostgreSQL. And kernel guys should
fix it. Which means no change for PostgreSQL. Only who will use
opensolaris devel builds 116 could have a problem. I will skip these
build(s) on my buildfarm animals.

Zdenek