Porting From Linux To Hpux

Gents,

i'm a senior applications developer and need to port a Linux server application ( no additional / special libraries or unique header files ) to a HPUX enviroment.

Any chance to compile it on the Linux using flags to create an HPUX binary with gcc?

Not trivially.

What version of HPUX?

I use both gcc and HPUX's cc/aCC compilers on Itanium2, PA-RISC 1.1 and PA-RISC 2.0 running HP-UX 11.11 in both 32bit and 64bit mode and they both do the job well.

Do you need help with the compiler options?

This is a:

UP_UX B.11.0 U 9000/800 system,
it is really trivial application but as usualy do not run on HPUX box.

I've tried to do the 'cc' but it fails with plenty of errors...

(a) What kind of errors?

(b) does it assume certain include files?

(c) is it using "gcc" pragmas?

(d) does it compile on Linux with "-Wall -Werror", if not, fix those firsts.

well..
linux compiles it well with -Wall -Werror

HPUX drops for example:

error 1002: unexpected character "//comment here"

Not suprising, that's a C++ comment in a C source file.

I suggest you strip the C++ comments out of the source.

Just because gcc/g++ accepts it, does not make it ANSI C. :slight_smile:

Ok i'll work on the code to make it 'clear' and come back to you with the latest results.. :slight_smile: thanks porter!

You might try loading gcc on to the HP server and recompiling on the HP with gcc.

In addition to "-Wall -Werror" as porter has already mentioned i would consider including "-ansi pedantic" in the list of standard compiler options. It pays to give out only programs which don't produce any error this way.

bakunin