This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
g++ can't locate iosfwd
- From: Maciej BliziÅski <maciej at opencsw dot org>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 21 Aug 2011 13:51:18 +0100
- Subject: g++ can't locate iosfwd
Continuing my work on Solaris packages, I came across a new problem.
I'm trying to compile the following code:
#include <iosfwd>
int main(void) {
}
The result:
$ /opt/csw/gcc4/bin/sparc-sun-solaris2.10-g++ 1.cpp
1.cpp:1:18: fatal error: iosfwd: No such file or directory
compilation terminated.
The file is there on the file system:
$ ls -l /opt/csw/gcc4/include/c++/*/iosfwd
-rw-r--r-- 1 root bin 6917 Aug 21 04:39 /opt/csw/gcc4/include/c++/4.6.1/iosfwd
Looking at the truss output, gcc tries to locate the header in wrong places:
22203: stat64("/opt/csw/lib/gcc/sparc-sun-solaris2.10/4.6.1/include/iosfwd.gch",
0xFFBFF038) Err#2 ENOENT
22203: open64("/opt/csw/lib/gcc/sparc-sun-solaris2.10/4.6.1/include/iosfwd",
O_RDONLY|O_NOCTTY) Err#2 ENOENT
22203: stat64("/opt/csw/gcc4/include/iosfwd.gch", 0xFFBFF038) Err#2 ENOENT
22203: open64("/opt/csw/gcc4/include/iosfwd", O_RDONLY|O_NOCTTY) Err#2 ENOENT
22203: stat64("/opt/csw/lib/gcc/sparc-sun-solaris2.10/4.6.1/include-fixed/iosfwd.gch",
0xFFBFF038) Err#2 ENOENT
22203: open64("/opt/csw/lib/gcc/sparc-sun-solaris2.10/4.6.1/include-fixed/iosfwd",
O_RDONLY|O_NOCTTY) Err#2 ENOENT
22203: stat64("/usr/include/iosfwd.gch", 0xFFBFF038) Err#2 ENOENT
22203: open64("/usr/include/iosfwd", O_RDONLY|O_NOCTTY) Err#2 ENOENT
Where is the problem - are the header files misplaced, or is g++
looking in the wrong place? Is there a recommended fix?
The build description is here:
https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/gcc4/branches/bootstrap-4.6/Makefile
My guess would be that the location of the header files is driven by
the --prefix or --includedir setting. In my build the setting was:
--prefix=/opt/csw/gcc4
--includedir=/opt/csw/gcc4/include
...and other locations:
--exec_prefix=/opt/csw/gcc4
--bindir=/opt/csw/gcc4/bin
--sbindir=/opt/csw/gcc4/sbin
--libexecdir=/opt/csw/gcc4/libexec
--datadir=/opt/csw/gcc4/share
--sysconfdir=/etc/opt/csw/gcc4
--sharedstatedir=/opt/csw/gcc4/share
--localstatedir=/var/opt/csw/gcc4
--libdir=/opt/csw/lib
--infodir=/opt/csw/gcc4/share/info
--mandir=/opt/csw/gcc4/share/man
Are the above settings sensible?
Maciej