Operating System - HP-UX
1819682 Members
3575 Online
109605 Solutions
New Discussion юеВ

Building Portable Static Binaries With HP C/ANSI C Compiler

 
SOLVED
Go to solution
Steve Bonds
Trusted Contributor

Building Portable Static Binaries With HP C/ANSI C Compiler

Forum dwellers:

I'm trying to isolate the source of a coredump issue with the popular Open Source version control product "CVS" and to do so I'd like to build a portable, statically linked version to avoid any chance that incompatible libraries are contributing to the crashes.

Unfortunately, I can't seem to find a way to build this. When I use "+DAportable -noshared", the compiler doesn't complain, but it generates a dynamically linked binary. When I use "+DA2.0W -noshared" I get a nice fat statically linked binary, but it coredumps with illegal instruction errors. (Which is odd, since this is an L2000 running 11.0/64bit, which is PA2.0W-compatible.)

How can I build a statically linked PA1.1 binary? Any idea why +DA2.0W code would core on an illegal instruction under HPUX 11.0/64-bit?

Thanks,

-- Steve
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

Howdy Steve:

Try this here little trick when you compile:

cc +DA1.1 -Wl,-a,archive -o myfile myfile.c

ldd myfile should tell y'all that myfile ain't no shared executable.
If it ain't broke, I can fix that.
Steve Bonds
Trusted Contributor

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

I'll give that a try and come back with some points for you.

-- Steve
Steve Bonds
Trusted Contributor

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

"file" reports the binary as shared (odd) but ldd correctly reports it as not. Thanks for the override-the-linker tip.

Any idea why +DA2.0W code would give illegal instruction errors on an L2000?

-- Steve
H.Merijn Brand (procura
Honored Contributor

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

Does the kernel on the L2000 support 64bit? I think this is one of the last machines that allowed 32bit kernels, but I could be mistaken.

Another source to this problem might be a missing 64bit library

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Steve Bonds
Trusted Contributor

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

Yes, and I checked via "getconf KERNEL_BITS" that we loaded the system with the right version of HP-UX.

This system has PA8600 CPUs. Last I heard, this was PA2.0 compatible. ;-)

-- Steve
A. Clay Stephenson
Acclaimed Contributor

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

The first thing that I would look at are cc, as, and ld patches. It is also possible that there is some faulty code in one of the libxxx.a libraries. Let's face it, not that much code is statically linked these days, so a bug in one of the archive libraries might go undetected for some time. I'm betting that the latest compiler and library patches will fix you.
If it ain't broke, I can fix that.
Steve Bonds
Trusted Contributor

Re: Building Portable Static Binaries With HP C/ANSI C Compiler

I already found one linker patch that looked promising, but it didn't fix the issue. The system is very up-to-date on patches so it may be an obscure library used by CVS.

I plan to whip out the debugger and find the code responsible in the next couple of days.

-- Steve