This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Can't find iostream on 4.2.1
- From: Robert Norris <rob at cataclysm dot cx>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 10 Oct 2007 12:55:37 +1000
- Subject: Can't find iostream on 4.2.1
Hi all,
I'm working on cross compilers for AROS, a free operating system. We
have patches for gcc and g++/libstdc++ for 3.4, and just for gcc
(gcc-core specifically) for 4.0.0. I've been trying to put together an
updated patch including g++/libstdc++ for 4.2 and beyond, using the
previous work as a guide.
While I still have a way to go, I did get a basic setup working using
4.0.3. My patches applied more-or-less as-is to 4.1.2, and to 4.2.1.
I'm now seeing issues with 4.2.1 where it can't seem to find the C++
headers, but it works fine with 4.0 and 4.1.
configure is run like so:
----------
$ PATH=$PATH:$(pwd)/../usr40/bin ../gcc-4.0.3/configure
--prefix=$(pwd)/../usr40 --target=i386-pc-aros
--enable-sjlj-exceptions --enable-long-long
--with-headers=/home/rob/code/aros/git/src/bin/linux-i386/AROS/Development/include
--with-libs=/home/rob/code/aros/git/src/bin/linux-i386/AROS/Development/lib
----------
I'm compiling a simple "hello world program":
----------
#include <iostream>
using namespace std;
int main() {
cout << "hello" << endl;
return 0;
}
----------
----------
$ PATH=$PATH:$(pwd)/usr40/bin i386-pc-aros-g++ -o hello hello.cpp -L $(pwd)/usr40/lib
$ PATH=$PATH:$(pwd)/usr41/bin i386-pc-aros-g++ -o hello hello.cpp -L $(pwd)/usr41/lib
$ PATH=$PATH:$(pwd)/usr42/bin i386-pc-aros-g++ -o hello hello.cpp -L $(pwd)/usr42/lib
hello.cpp:1:20: error: iostream: No such file or directory
hello.cpp: In function 'int main()':
hello.cpp:6: error: 'cout' was not declared in this scope
hello.cpp:6: error: 'endl' was not declared in this scope
----------
Some strace output:
----------
$ PATH=$PATH:$(pwd)/usr40/bin strace -f i386-pc-aros-g++ -o hello hello.cpp -L $(pwd)/usr40/lib 2>&1 | grep iostream
[pid 12681] read(3, "#include <iostream>\n\nusing names"..., 101) = 101
[pid 12681] stat64("/home/rob/code/aros/gcc/usr40/bin/../lib/gcc/i386-pc-aros/4.0.3/../../../../include/c++/4.0.3/iostream.gch", 0xbf9cab94) = -1 ENOENT (No such file or directory)
[pid 12681] open("/home/rob/code/aros/gcc/usr40/bin/../lib/gcc/i386-pc-aros/4.0.3/../../../../include/c++/4.0.3/iostream", O_RDONLY|O_NOCTTY) = 4
[pid 12681] read(4, "// Standard iostream objects -*-"..., 2958) = 2958
----------
----------
$ PATH=$PATH:$(pwd)/usr41/bin strace -f i386-pc-aros-g++ -o hello hello.cpp -L $(pwd)/usr41/lib 2>&1 | grep iostream
[pid 12696] read(3, "#include <iostream>\n\nusing names"..., 101) = 101
[pid 12696] stat64("/home/rob/code/aros/gcc/usr41/bin/../lib/gcc/i386-pc-aros/4.1.2/../../../../include/c++/4.1.2/iostream.gch", 0xbf85c214) = -1 ENOENT (No such file or directory)
[pid 12696] open("/home/rob/code/aros/gcc/usr41/bin/../lib/gcc/i386-pc-aros/4.1.2/../../../../include/c++/4.1.2/iostream", O_RDONLY|O_NOCTTY) = 4
[pid 12696] read(4, "// Standard iostream objects -*-"..., 2962) = 2962
----------
----------
$ PATH=$PATH:$(pwd)/usr42/bin strace -f i386-pc-aros-g++ -o hello hello.cpp -L $(pwd)/usr42/lib 2>&1 | grep iostream
[pid 12711] read(3, "#include <iostream>\n\nusing names"..., 101) = 101
[pid 12711] stat64("/home/rob/code/aros/gcc/usr42/bin/../lib/gcc/i386-pc-aros/4.2.1/include/iostream.gch", 0xbf989b24) = -1 ENOENT (No such file or directory)
[pid 12711] open("/home/rob/code/aros/gcc/usr42/bin/../lib/gcc/i386-pc-aros/4.2.1/include/iostream", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 12711] stat64("/home/rob/code/aros/gcc/usr42/bin/../lib/gcc/i386-pc-aros/4.2.1/../../../../i386-pc-aros/sys-include/iostream.gch", 0xbf989b24) = -1 ENOENT (No such file or directory)
[pid 12711] open("/home/rob/code/aros/gcc/usr42/bin/../lib/gcc/i386-pc-aros/4.2.1/../../../../i386-pc-aros/sys-include/iostream", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
[pid 12711] write(2, "iostream: No such file or direct"..., 35iostream: No such file or directory) = 35
----------
As you can see, 4.2.1 doesn't seem to be looking in
usr42/include/c++/4.2.1 for iostream and other headers.
I don't think this has anything to do with my changes, but I don't know
enough about GCC to be sure. I've really just been trying to build it
and fix errors as they pop up.
FYI, my patches (extremely rough) are here:
http://cataclysm.cx/random/gcc/gcc-4.0.3-aros-wip.patch.bz2
http://cataclysm.cx/random/gcc/gcc-4.1.2-aros-wip.patch.bz2
http://cataclysm.cx/random/gcc/gcc-4.2.1-aros-wip.patch.bz2
Can anyone offer some pointers on where to start looking?
Cheers,
Rob.