Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00 (486 Views)
Reply
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 1 of 15 (486 Views)
Accepted Solution

HP-UX 11.11 compiled binaries running on HP-UX 11.00

I'm probably missing something really obvious here, but when I compile (using gcc 3.4.3) binaries (PA-RISC2.0) on a HP-UX 11.11 box, when I try and run them on a HP-UX 11.00 box I get a SIGSEV core dump and ldd doesn't work on them either.

I tried compiling them as PA-RISC1.1 binaries but gcc/g++ steadfastly refuses to do so despite every combination of -march=1.1 and +DA1.1 and +DAportable etc I've tried.


Acclaimed Contributor
A. Clay Stephenson
Posts: 17,825
Registered: ‎07-16-1998
Message 2 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I don't use gcc on HP-UX but evenso you know you are not following the Yellow Brick Road by trying execute 11.11 code on 11.0 boxes. The code is upwardly compatible only. I have actually run 11.11 produced code on 11.0 boxes and the HP compilers respect the +DAportable et al options. The most likely culprit is differences in shared library functions so you might try statically linked code but in all cases if you get this to work, it's working by accident. I also assume that you are not trying to execute 64-bit code on a 32-bit box or PA-RISC 2.0 on a less then PA-8000 equipped box.
If it ain't broke, I can fix that.
Honored Contributor
Kent Ostby
Posts: 1,836
Registered: ‎09-26-2000
Message 3 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

compiled on 11.00 --> should run on 11.11.

There are no guarentees going in the direction that you are trying to move your code.
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 4 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

Shalom,

The real answer is, it depends.

It depends on the compiler, it depends on the code, it depends on the options.

It might work, it might not.

I'd say write a good test plan.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Honored Contributor
H.Merijn Brand (procura
Posts: 6,188
Registered: ‎10-13-1997
Message 5 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

-march is not a valid gcc option for HP-UX

-mpa-risc-1-1 is


I've just tried, and I am *sure* it depends on the libs you link against.

11.11:
/tmp 104 > cat xx.c
#include

int main (int argc, char *argv[])
{
(void)printf ("Hello, world\n");
return (0);
} /* main */
/tmp 105 > gcc -static -o xx xx.c
/tmp 106 > ./xx
Hello, world
/tmp 107 > ux
HP-UX 11.11/64 U 9000/800/rp3410/64 PA8800/800(2) pa-2.0 4094 Mb
/tmp 108 >

NFS from 11.00
/hpux1111/tmp 102 > ./xx
Hello, world
/hpux1111/tmp 103 > ux
HP-UX 11.00/64 U 9000/800/L1000-44/64 PA8500/440 pa-2.0 512 Mb
/hpux1111/tmp 104 >

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 6 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

Sorry for the delay in replying, I've had all sorts of problems trying to log in with the new passport type scheme that the forums are using.

I can compile a PA-RISC2.0 binary on the 11.11 box and run it on the 11.00 box happily, but that binary doesn't use any "special" libraries. It is in fact a simple "hello world" application. I just wanted to see if PA-RISC2.0 code (in general) will run on a 11.00 box.

My "proper" code is built in a complicated build environment and to replicate that on the 11.00 box would be a nightmare. (hence the unsupported backwards porting problem). I am just investigating whether the code would ever run successfully on an 11.00 box before investing too much effort in providing an 11.00 build environment.

PS. I've tried -mpa-risc-1-1 as well, and as procura says, I think it depends on which libraries you are linking too.
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 7 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I've now dowloaded gcc 3.4.3 for 11.00 from Merijn's web-site, but when I try and complile a simple (C++) hello world I get

/usr/ccs/bin/ld: Unrecognized argument: +init
/usr/ccs/bin/ld: Usage: /usr/ccs/bin/ld flags... files...


Any clues?
Honored Contributor
H.Merijn Brand (procura
Posts: 6,188
Registered: ‎10-13-1997
Message 8 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I've never used g++, but it is now vital to know if you are using the 32bit version or the 64bit version, as the 32bit gcc/g++ can only work with HP ld (which makes the message strange), and the 64bit gcc/g++ prefers the GNU ld, which is localted in /usr/local/pa20_64/bin, which makes me assume that your path is wrong, or my depot is corrupted.

Can you check for the existance of /usr/local/pa20_64/bin/ld ?
Maybe it is there as ld.exe
In that case, you can blame me.

Enjoy, Have FUN! H.merijn
Enjoy, Have FUN! H.Merijn
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 9 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I downloaded the latest linker cumulative patches and that problem has gone away.

I now have to work out why some pstat calls are failing with unknown `struct __psdev'.

Ho hum, such is the developer's lot.
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 10 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I'm using the 32-bit version. Now I've got

/usr/ccs/bin/ld: Invalid loader fixup in text space needed in output file for symbol "__gxx_personality_sj0" in input file "/usr/local/pa20_32/lib/libstdc++.a(ios_init.o)"
collect2: ld returned 1 exit status
Honored Contributor
H.Merijn Brand (procura
Posts: 6,188
Registered: ‎10-13-1997
Message 11 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

99.5% of the circumstances where I saw that message are from non-relocatable objects.

You probably need to add -fPIC to all your CCFLAGS (or whatever your makefiles use to pass the flags to gcc/g++)

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 12 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

Thnaks for the tip, but I'm actually trying to build a shared library (linking in libstdc++) so I already have -fPIC and -shared in the flags.

I can compile this on 11.11 with the same version of gcc, but on 11.00 I can't and on 11.00 I don't have libstdc++.sl either, only the archive version. Could this be related?
Honored Contributor
H.Merijn Brand (procura
Posts: 6,188
Registered: ‎10-13-1997
Message 13 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I think so. The objects in that static .a file are most likely not compiled with -fPIC.

I just checked my libstdc++.a, and the objects do not tell you how they are compiled.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 14 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

I gave up and regressed to gcc 3.2.3 from the HP archive. This is a depot and installed and ran fine. The only slight naus was that the stdio.h header file had a mistake in it (arguments for snprintf were wrong - didn't agree with man page either) but editing stdio.h fixed that. My code compiles fine and runs OK.
Honored Contributor
Stephen Keane
Posts: 1,155
Registered: ‎11-24-2004
Message 15 of 15 (486 Views)

Re: HP-UX 11.11 compiled binaries running on HP-UX 11.00

As previous comment.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.