This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ppc c++ header location oddities
- To: egcs-bugs at cygnus dot com
- Subject: ppc c++ header location oddities
- From: "Jack Howarth" <howarth at nitro dot med dot uc dot edu>
- Date: Tue, 23 Mar 1999 09:03:06 -0500
- Cc: law at cygnus dot com, jason at cygnus dot com, meissner at cygnus dot com
On linuxppc with egcs 1.1.2, glibc 2.1.1pre1, binutils 2.9.1.0.22b
and Linux 2.2.3 I am seeing some odd behavior in the c++ compiler.
The bug in question is that the c++ compiler seems to malfunction under
some cases when c++ headers are in different locations. This bug became
apparent when RedHat started to build kde 1.1 with a prefix of /usr
instead of /opt/kde. While we could build kdelibs with a /usr prefix
we found that configure could not build the small kde program to test
the kde headers with the kdelibs installed in /usr instead of /opt/kde.
Likewise when RedHat moved the qt headers from /usr/lib/qt/include to
/usr/include/qt I found that while qt could build the resulting
installation could not be used to build qt based programs. The error
in both cases is that multiple redeclarations appear when the headers
are in new locations. Oddly placing a symlink from /usr/include/qt to
/usr/lib/qt/include resolves the issue building qt programs.
To examine this more closely I looked at how kdebase tests the
kde headers using a disk with just the kdelibs installed in /opt/kde
(which seems normally immune to build problems). I also discovered that
kdebase's configure uses the following program to test for the kde
headers...
confdefs.h
#define PACKAGE "kdebase"
#define VERSION "1.1"
#define ENABLE_NLS 1
#define ksize_t socklen_t
#define HAVE_BOOL 1
conftest.C
#include <stdio.h>
#include "confdefs.h"
#include <kapp.h>
int main() {
printf("kde_htmldir=\"%s\"\n", KApplication::kde_htmldir().data());
printf("kde_appsdir=\"%s\"\n", KApplication::kde_appsdir().data());
printf("kde_icondir=\"%s\"\n", KApplication::kde_icondir().data());
printf("kde_sounddir=\"%s\"\n", KApplication::kde_sounddir().data());
printf("kde_datadir=\"%s\"\n", KApplication::kde_datadir().data());
printf("kde_locale=\"%s\"\n", KApplication::kde_localedir().data());
printf("kde_cgidir=\"%s\"\n", KApplication::kde_cgidir().data());
printf("kde_confdir=\"%s\"\n", KApplication::kde_configdir().data());
printf("kde_mimedir=\"%s\"\n", KApplication::kde_mimedir().data());
printf("kde_toolbardir=\"%s\"\n", KApplication::kde_toolbardir().data());
printf("kde_wallpaperdir=\"%s\"\n", KApplication::kde_wallpaperdir().data());
printf("kde_bindir=\"%s\"\n", KApplication::kde_bindir().data());
printf("kde_partsdir=\"%s\"\n", KApplication::kde_partsdir().data());
return 0;
}
when these are compiled with the command...
g++ -c -O2 -Wall -I/opt/kde/include -I/usr/lib/qt
/include -I/usr/X11R6/include conftest.C
...the object file is created and no errors are reported. However if
I copy the headers from /opt/kde/include into a directory /usr/include/kde
and try building with...
g++ -c -O2 -Wall -I/usr/include/kde -I/usr/lib/qt
/include -I/usr/X11R6/include conftest.C
...the compile fails and I get errors of the form...
In file included from /usr/lib/qt/include/qobjectdefs.h:28,
from /usr/lib/qt/include/qwindowdefs.h:29,
from /usr/lib/qt/include/qcolor.h:28,
from /usr/include/kde/kconfigbase.h:80,
from /usr/include/kde/kconfig.h:53,
from /usr/include/kde/kapp.h:31,
from conftest.C:3:
/usr/lib/qt/include/qglobal.h:508: declaration of C function `void qObsolete(const char *, const char *)' conflicts with
/usr/lib/qt/include/qglobal.h:507: previous declaration `void qObsolete(const char *, const char *, const char *)' here
Removing the /opt/kde/include directory does not solve this problem. So finally
I made preprocessed source files for the two build methods using the commands...
g++ -c -E -O2 -Wall -I/usr/include/kde -I/usr/lib
/qt/include -I/usr/X11R6/include -o conftest.i.notkde conftest.C
and
g++ -c -E -O2 -Wall -I/opt/kde/include -I/usr/lib
/qt/include -I/usr/X11R6/include -o conftest.i.kde conftest.C
...and found if I diff'ed them with...
diff conftest.i.notkde conftest.i.kde
...I got...
2349c2349
< # 1 "/usr/include/kde/kapp.h" 1 3 4
---
> # 1 "/opt/kde/include/kapp.h" 1
2380c2380
< # 1 "/usr/include/kde/kconfig.h" 1 3 4
---
> # 1 "/opt/kde/include/kconfig.h" 1
2433c2433
< # 1 "/usr/include/kde/kconfigbase.h" 1 3 4
---
> # 1 "/opt/kde/include/kconfigbase.h" 1
3501c3501
< # 80 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 80 "/opt/kde/include/kconfigbase.h" 2
4737c4737
< # 81 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 81 "/opt/kde/include/kconfigbase.h" 2
5569c5569
< # 82 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 82 "/opt/kde/include/kconfigbase.h" 2
5573c5573
< # 1 "/usr/include/kde/kconfigdata.h" 1 3 4
---
> # 1 "/opt/kde/include/kconfigdata.h" 1
5854c5854
< # 46 "/usr/include/kde/kconfigdata.h" 2 3 4
---
> # 46 "/opt/kde/include/kconfigdata.h" 2
6089c6089
< # 47 "/usr/include/kde/kconfigdata.h" 2 3 4
---
> # 47 "/opt/kde/include/kconfigdata.h" 2
6175c6175
< # 85 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 85 "/opt/kde/include/kconfigbase.h" 2
6306c6306
< # 116 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 116 "/opt/kde/include/kconfigbase.h" 2
7408c7408
< # 117 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 117 "/opt/kde/include/kconfigbase.h" 2
7410c7410
< # 1 "/usr/include/kde/kdebug.h" 1 3 4
---
> # 1 "/opt/kde/include/kdebug.h" 1
7464c7464
< # 75 "/usr/include/kde/kdebug.h" 3 4
---
> # 75 "/opt/kde/include/kdebug.h"
7475c7475
< # 118 "/usr/include/kde/kconfigbase.h" 2 3 4
---
> # 118 "/opt/kde/include/kconfigbase.h" 2
8116c8116
< # 53 "/usr/include/kde/kconfig.h" 2 3 4
---
> # 53 "/opt/kde/include/kconfig.h" 2
8175c8175
< # 31 "/usr/include/kde/kapp.h" 2 3 4
---
> # 31 "/opt/kde/include/kapp.h" 2
8194c8194
< # 1 "/usr/include/kde/klocale.h" 1 3 4
---
> # 1 "/opt/kde/include/klocale.h" 1
8340c8340
< # 22 "/usr/include/kde/klocale.h" 2 3 4
---
> # 22 "/opt/kde/include/klocale.h" 2
8513c8513
< # 49 "/usr/include/kde/kapp.h" 2 3 4
---
> # 49 "/opt/kde/include/kapp.h" 2
8517c8517
< # 1 "/usr/include/kde/drag.h" 1 3 4
---
> # 1 "/opt/kde/include/drag.h" 1
10031c10031
< # 136 "/usr/include/kde/drag.h" 2 3 4
---
> # 136 "/opt/kde/include/drag.h" 2
10270c10270
< # 138 "/usr/include/kde/drag.h" 2 3 4
---
> # 138 "/opt/kde/include/drag.h" 2
10752c10752
< # 52 "/usr/include/kde/kapp.h" 2 3 4
---
> # 52 "/opt/kde/include/kapp.h" 2
11425c11425
< # 56 "/usr/include/kde/kapp.h" 2 3 4
---
> # 56 "/opt/kde/include/kapp.h" 2
...thus it appears on the ppc that the egcs 1.1.2 c++ compiler has some
flaw that causes multiple reads of headers depending on where they
are located in the directory tree. Any ideas of how we can pin this problem
down and eliminate it?
Jack
--
------------------------------------------------------------------------------
Jack W. Howarth, Ph.D. 231 Bethesda Avenue
NMR Facility Director Cincinnati, Ohio 45267-0524
Dept. of Molecular Genetics phone: (513) 558-4420
Univ. of Cincinnati College of Medicine fax: (513) 558-8474