Languages and Scripting

Re: CRYPT/LCRYPT on HP-UX Itanium.

 
grahamswilson
Trusted Contributor

CRYPT/LCRYPT on HP-UX Itanium.

When compiling a program to use the crypt function I get the following error. The same code works on LINUX.

gcc -o appmove -lcrypt appmove.c
ld: Can't find library or mismatched ABI for -lcrypt
Fatal error.
collect2: ld returned 1 exit status

How do I get this to work on HP-UX 11i version2 on Itanium?
5 REPLIES 5
piyush mathiya
Trusted Contributor

Re: CRYPT/LCRYPT on HP-UX Itanium.

Hi Wildon,
Can you please brief about it, because I am not sure but gcc is not internal utility, may be it is a script, just want some more information that what is the purpose of it.

Regards,
Piyush Mathiya
Steven Schweda
Honored Contributor

Re: CRYPT/LCRYPT on HP-UX Itanium.

Step one: figure out whether you don't have a
libcrypt., or, if you do have one,
how it was built.

Around here:

dyi # uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license

dyi # find /usr -name 'libcrypt*'
/usr/lib/hpux32/libcrypto.a
/usr/lib/hpux32/libcrypto.so
/usr/lib/hpux32/libcrypto.so.0
/usr/lib/hpux32/libcrypto.so.1
/usr/lib/hpux64/libcrypto.a
/usr/lib/hpux64/libcrypto.so
/usr/lib/hpux64/libcrypto.so.0
/usr/lib/hpux64/libcrypto.so.1

So _I_ don't have a libcrypt..

> The same code works on LINUX.

What code? I see no code. Hard to say
whether/why you even need libcrypt.
without more clues. What happens without the
"-lcrypt"?
James R. Ferguson
Acclaimed Contributor

Re: CRYPT/LCRYPT on HP-UX Itanium.

Hi:

This linker error occurs if you attempt to mix 32-bit and 64-bit objects. The "bitness" of the first object determines the choice "everyone" must follow.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: CRYPT/LCRYPT on HP-UX Itanium.

>gcc -lcrypt appmove.c

A good practice would be to always have -l options after any sources or objects. This is especially important for archive libs.

>JRF: This linker error occurs if you attempt to mix 32-bit and 64-bit objects.

Unfortunately you get this error for two causes. The latest linker patches should have my request for two separate messages to prevent confusion.
grahamswilson
Trusted Contributor

Re: CRYPT/LCRYPT on HP-UX Itanium.

Thanks all for your prompt and useful responses.

It turns out that HP-UX was "cleverer" than LINUX and the solution was simply not to tell the compiler to use "-lcrypt".

Without adding that parameter, the build was fine! :)