Operating System - HP-UX
1827251 Members
3102 Online
109716 Solutions
New Discussion

gcc makes segmentation error when executing codes with <iostream> included.

 
Jin-Ho Song
Occasional Advisor

gcc makes segmentation error when executing codes with <iostream> included.

I've found that 64bit gcc on hpux doesn't go easy as in linux or something. I've spent several weeks in doing the same thing...

Binary version of gcc from hp site, the first one, had the following configuration,

Reading specs from /usr/local/pa20_64/lib/gcc-lib/hppa64-hp-hpux11.00/3.2/specs
Configured with: ../gcc/configure --prefix=/usr/local/pa20_64 --enable-languages=c,c++ --host=hppa64-hp-hpux11.00 --target=hppa64-hp-hpux11.00 --with-ld=/usr/ccs/bin/ld --with-gnu-as --enable-libstdcxx-v3 --disable-checking
Thread model: single
gcc version 3.2 20020708 (experimental)

But it had errors when building gnu softwares, say, it stops out of memory(lack of maxssiz parameter or something). Then I got a pre-built version configured with gnu ld from http://www.cmve.net/~merijn/, and it didn't make errors as in the above, but it had errors like incompatable header file, and makes a lot of link error due to gnu linker, so I finally built my own 64bit gcc from original hp 64bit gcc configured with hp linker.

Well, it went well for some time, but I found that it had errors when executing c++ codes(not in compiling). Whenever the code includes iostream object like 'cout', it makes segmentation error. If I inserted stdio.h function like printf(), it works fine.

//hello.cc
#include
int main()
{
std::cout << "hello" << std::endl;
return 0;
}

contgw:/usr/local>./hello
Segmentation fault (core dumped)

Anybody can give me any hint for this?
Thanks in advance.
newbie for HP-seeker for free-of-charge stuffs.
3 REPLIES 3
Jin-Ho Song
Occasional Advisor

Re: gcc makes segmentation error when executing codes with <iostream> included.

Not so many answers here...sad...

Well, when I run gdb with the executable, I get the following error messages.


contgw:/usr/local>gdb hello
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "hppa64-hp-hpux11.11"...
(gdb) r
Starting program: /usr/local/hello
warning: (Internal error: pc 0x800003ffff7c2c4c in read in psymtab, but not in symtab.)


Program received signal SIGSEGV, Segmentation fault.
warning: (Internal error: pc 0x800003ffff7c2c4c in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x800003ffff7c2c4c in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x800003ffff7c2c4c in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x800003ffff7c2c4c in read in psymtab, but not in symtab.)

0x800003ffff7c2c4c in ?? ()
at /CLO/Products/OPENSOURCE/src/PL/gcc/obj_gcc/hppa64-hp-hpux11.00/libstdc++-v3/include/istream:273
273 /CLO/Products/OPENSOURCE/src/PL/gcc/obj_gcc/hppa64-hp-hpux11.00/libstdc++-v3/include/istream: No such file or directory.
in /CLO/Products/OPENSOURCE/src/PL/gcc/obj_gcc/hppa64-hp-hpux11.00/libstdc++-v3/include/istream
warning: (Internal error: pc 0x800003ffff7c2c4c in read in psymtab, but not in symtab.)

Please help.
newbie for HP-seeker for free-of-charge stuffs.
T G Manikandan
Honored Contributor

Re: gcc makes segmentation error when executing codes with <iostream> included.

1.how much memory is free on the system?
Is the memory usage OK on the system and also the swap usage.

2.Increase the kernel parameters

maxdsiz |
maxssiz | for 32 -bit applications

maxdsiz_64 |
maxssiz_64 |for 64 bit applications

By default the data size and stack size of the process is 64 MB.

Increase to some value higher.
Most SIGSEGV problems are due to the above.


Revert
Jin-Ho Song
Occasional Advisor

Re: gcc makes segmentation error when executing codes with <iostream> included.

I've checked out kernel parameters with SAM and the current value for maxssiz is 8.3MB.
You mean I need to increase it to 64MB, right?

If this is the case, I don't know how to update the kernel values. That's why I discarded 64bit gcc 3.2 from hp site which made errors like SIGSEGV. Can you let me know the detailed steps I need to take if you don't mind?

Regards.
newbie for HP-seeker for free-of-charge stuffs.