Operating System - HP-UX
1752577 Members
4996 Online
108788 Solutions
New Discussion юеВ

Re: g++ problem when compiling under HP-UX 11

 
Andrew Bennett_5
New Member

g++ problem when compiling under HP-UX 11

Hello,

I have an odd cross-compilation issue. I recieved some code (which is written in mixed C/C++) which compiles with the FFTW library (www.fftw.org). It compiles under Redhat Linux with no problems, and runs fine.

However, when I compiled it using the HP-UX version of g++, I recieved no obvious warnings, but the code fails with a segmentation fault (core dump). According to gdb, the failure jumps around in the code between runs and occurs on simple lines (such as sending a string to cout).

I've been given the following advice about the compiler:
1. Reduce the optimisation level
2. Enforce strict syntax
3. Compile as static objects (larger executable)

I've tried no optimization, and debug-only (-g) optimization, but it seems to make no difference.

My question is twofold...
1. Can anyone help me to find relevent compiler switches which will allow me to try points 2 and 3 above (the documentaiton is long-winded and technical!)
2. Does anyone else have any suggestions as to what is causing the problem, and how to fix it?

The symptoms suggest a pointer problem, but it runs with no problems under Linux, and its completely baffling me!

Thanks for any help.
4 REPLIES 4
harry d brown jr
Honored Contributor

Re: g++ problem when compiling under HP-UX 11

Steve Ellcey
Valued Contributor

Re: g++ problem when compiling under HP-UX 11

For strict syntax, one of the most important things is to make sure that you use gcc to compile C code and g++ to compile C++ code. Other than that I would just examine the compile output for any warnings that might be pointing out possible problems. To create static objects (no shared libraries) you can link with the --static option (assuming you are using gcc or g++ for the link.

You don't mention what version of gcc/g++ you are using. If it isn't at least 3.4, I would try updating the gcc/g++ compilers. You can get new ones from http://www.hp.com/go/gcc.
Alex Lavrov.
Honored Contributor

Re: g++ problem when compiling under HP-UX 11

A little thing about "-g" flag. With "-g" you get larger executable with lower performance. I suggest that during the development use -g for debugging, but the production version, don't compile with -g. It increases performance.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Andrew Bennett_5
New Member

Re: g++ problem when compiling under HP-UX 11

Thanks for all your input. It turns out that I hadn't read the FFTW documentation properly: there's a known problem with g++/gcc versions prior to 3.2, and I've been using 3.0. Using an updated version got it working!