Operating System - HP-UX
1748140 Members
3507 Online
108758 Solutions
New Discussion юеВ

Re: Problem compiling with HP-UX cc ...

 
SOLVED
Go to solution
Derek Fairley
New Member

Problem compiling with HP-UX cc ...

Hi,
I'm new to HP-UX, working on an HP-UX Itanium II cluster, and trying to compile 64bit binaries using the cc compiler.

The compile steps seem to work fine (so my CFLAGS are okay?) but the linking step fails (with LFLAGS = +O3 -lm):
"ld: Can't find library or mismatched ABI for -lm" (see attached makefile & compiler messages).

I have compiled working binaries using gcc, but these won't be well optimised for this platform... Can anyone point me in the right direction to resolve this?

Thanks in advance,
D.
4 REPLIES 4
Steven Schweda
Honored Contributor
Solution

Re: Problem compiling with HP-UX cc ...

I know nothing, but I'd guess that "ld" is
looking for "libm.*" in the wrong place.
There seems to be an abundance of wrong
choices:

antinode@td164> find /usr/lib -name 'libm.*' -exec file {} \;
/usr/lib/hpux32/libm.so: ELF-32 shared object file - IA64
/usr/lib/hpux32/libm.so.1: ELF-32 shared object file - IA64
/usr/lib/hpux32/libm.a: archive file
/usr/lib/libm.1: s800 shared library -not stripped
/usr/lib/libm.2: PA-RISC1.1 shared library -not stripped
/usr/lib/hpux64/libm.so: ELF-64 shared object file - IA64
/usr/lib/hpux64/libm.so.1: ELF-64 shared object file - IA64
/usr/lib/hpux64/libm.a: archive file
/usr/lib/pa20_64/libm.2: ELF-64 shared object file - PA-RISC 2.0 (LP64)
/usr/lib/pa20_64/libm.sl: ELF-64 shared object file - PA-RISC 2.0 (LP64)
/usr/lib/libm.0: s800 shared library -not stripped
/usr/lib/libm.sl: PA-RISC1.1 shared library -not stripped

I'd expect you to want one of the IA64
choices.

"man ld" suggests that it (or the the dynamic
loader) can be misled by environment
variables like LPATH, RPATH, SHLIB_PATH,
and/or LD_LIBRARY_PATH. Unset 'em if you
have 'em.

If it really is looking in the wrong
directory, and if it's not obvious why, you
might try throwing in a "-L dir" option to
try to steer it back to a better one.

There may be an "ld" option which would offer
more clues as to where it seeks what, but, if
so, it's unknown to me (like so many things).
Derek Fairley
New Member

Re: Problem compiling with HP-UX cc ...

Steve,

Excellent - problem solved (& now I know a little more about cc...)

For the record, LD_LIBRARY_PATH was set to the pretty obscure /contrib/lsf/6.0/hpuxia64/lib

Adding -L /usr/lib/hpux64 fixed it.

many thanks!

D.
Derek Fairley
New Member

Re: Problem compiling with HP-UX cc ...

Problem solved.
Steven Schweda
Honored Contributor

Re: Problem compiling with HP-UX cc ...

> Problem solved.

Good news, but you might wish to look into
why LD_LIBRARY_PATH is set to anything,
especially globally. It's pretty harmless
when it's set in some shell script which runs
some program which needs it, but to have it
always set to anything may be asking for
trouble (like this). Including the default
value(s) in the colon-separated variable
value can help, but the right value for one
program can easily be wrong for another.

This fellow seems to have hit something
similar (setting more stuff), for example:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1067351