Operating System - HP-UX
1752294 Members
4704 Online
108786 Solutions
New Discussion юеВ

ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

 
SOLVED
Go to solution
Shamim1
Advisor

ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

--------------------------------------------------------------------------------------------------------------------------
# make
make all-recursive
make[1]: Entering directory `/shamim/syslog-ng-2.0.2'
Making all in src
make[2]: Entering directory `/shamim/syslog-ng-2.0.2/src'
gcc -g -O2 -Wall -g -o syslog-ng main.o libsyslog-ng.a -static -lnsl -lrt -ll -L/usr/local/lib/hpux32 -lglib-2.0 -lintl

-liconv -L/usr/local/lib -levtlog
ld: Can't find library or mismatched ABI for -lnsl
Fatal error.
collect2: ld returned 1 exit status
make[2]: *** [syslog-ng] Error 1
make[2]: Leaving directory `/shamim/syslog-ng-2.0.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/shamim/syslog-ng-2.0.2'
make: *** [all] Error 2
#
------------------------------------------------------------------------------------------------------------

System Details:
---------------
# uname -a
HP-UX kmghp2 B.11.23 U ia64 3887625253 unlimited-user license
# getconf KERNEL_BITS
64
#
#
# Product(s) not contained in a Bundle:
#

GNU_C_C++ 4.2.1
Ignite-UX C.6.7.79 HP-UX System Installation Services
Libnet 1.1.2.1 Libnet
SOE-Openssh 4.3p2-1 SOE-Openssh 4.3p2 - SSH-SecSH protocol suite, encryption for network services
SOE-Perl 5.8.7-0 SOE-Perl 5.8.7 - Practical Extraction and Reporting Language
bison 2.3 bison
byacc 20040328 byacc
flex 2.5.4a flex
gawk 3.1.5 gawk
gettext 0.14.5 gettext
glib 1.2.10 glib
glib2 2.12.4 glib2
gmp 4.2.1 gmp
libgcc 4.1.2 libgcc
libiconv 1.10 libiconv
libol 0.3.18 libol
libpcap 0.9.8 libpcap
libtool 1.5.24 libtool
pkgconfig 0.21 pkgconfig
#

# whereis gcc
gcc: /opt/hp-gcc-4.2.1/bin/gcc /opt/hp-gcc/bin/gcc /opt/gcc-3.0.1-32/man/man1/gcc.11 /opt/hp-gcc-4.2.1/man/man1/gcc.1

/opt/hp-gcc/man/man1/gcc.1
#

# ls -la /usr/local/lib/hpux32/libg*
-rwxr-xr-x 1 root sys 971 Oct 10 2005 /usr/local/lib/hpux32/libgettextlib.la
-r-xr-xr-x 1 root sys 187572 Oct 10 2005 /usr/local/lib/hpux32/libgettextlib.so
-rw-r--r-- 1 root sys 19608 Oct 10 2005 /usr/local/lib/hpux32/libgettextpo.a
-rwxr-xr-x 1 root sys 1029 Oct 10 2005 /usr/local/lib/hpux32/libgettextpo.la
-r-xr-xr-x 1 root sys 22948 Oct 10 2005 /usr/local/lib/hpux32/libgettextpo.so
-rwxr-xr-x 1 root sys 1010 Oct 10 2005 /usr/local/lib/hpux32/libgettextsrc.la
-r-xr-xr-x 1 root sys 425764 Oct 10 2005 /usr/local/lib/hpux32/libgettextsrc.so
-rw-r--r-- 1 root sys 1611132 Oct 4 2006 /usr/local/lib/hpux32/libglib-2.0.a
-rw-r--r-- 1 root sys 884 Oct 4 2006 /usr/local/lib/hpux32/libglib-2.0.la
-r-xr-xr-x 1 root sys 1203484 Oct 4 2006 /usr/local/lib/hpux32/libglib-2.0.so
-rw-r--r-- 1 root sys 837484 Nov 27 2006 /usr/local/lib/hpux32/libglib.a
-rwxr-xr-x 1 root sys 673 Nov 27 2006 /usr/local/lib/hpux32/libglib.la
-r-xr-xr-x 1 root sys 498132 Nov 27 2006 /usr/local/lib/hpux32/libglib.so
-rw-r--r-- 1 root sys 16548 Oct 4 2006 /usr/local/lib/hpux32/libgmodule-2.0.a
-rw-r--r-- 1 root sys 936 Oct 4 2006 /usr/local/lib/hpux32/libgmodule-2.0.la
-r-xr-xr-x 1 root sys 68188 Oct 4 2006 /usr/local/lib/hpux32/libgmodule-2.0.so
-rw-r--r-- 1 root sys 22584 Nov 27 2006 /usr/local/lib/hpux32/libgmodule.a
-rw-r--r-- 1 root sys 694 Nov 27 2006 /usr/local/lib/hpux32/libgmodule.la
-r-xr-xr-x 1 root sys 68660 Nov 27 2006 /usr/local/lib/hpux32/libgmodule.so
-rw-r--r-- 1 root sys 1628698 Jul 15 2006 /usr/local/lib/hpux32/libgmp.a
-rwxr-xr-x 1 root sys 760 Jul 15 2006 /usr/local/lib/hpux32/libgmp.la
-r-xr-xr-x 1 root sys 848472 Jul 15 2006 /usr/local/lib/hpux32/libgmp.so
-rw-r--r-- 1 root sys 762856 Oct 4 2006 /usr/local/lib/hpux32/libgobject-2.0.a
-rw-r--r-- 1 root sys 936 Oct 4 2006 /usr/local/lib/hpux32/libgobject-2.0.la
-r-xr-xr-x 1 root sys 610692 Oct 4 2006 /usr/local/lib/hpux32/libgobject-2.0.so
-rw-r--r-- 1 root sys 25800 Oct 4 2006 /usr/local/lib/hpux32/libgthread-2.0.a
-rw-r--r-- 1 root sys 936 Oct 4 2006 /usr/local/lib/hpux32/libgthread-2.0.la
-r-xr-xr-x 1 root sys 68968 Oct 4 2006 /usr/local/lib/hpux32/libgthread-2.0.so
-rw-r--r-- 1 root sys 16510 Nov 27 2006 /usr/local/lib/hpux32/libgthread.a
-rwxr-xr-x 1 root sys 704 Nov 27 2006 /usr/local/lib/hpux32/libgthread.la
-r-xr-xr-x 1 root sys 69092 Nov 27 2006 /usr/local/lib/hpux32/libgthread.so
#



# file /usr/local/lib/hpux32/libglib-2.0.a
/usr/local/lib/hpux32/libglib-2.0.a: archive file
#


# file /usr/local/lib/hpux32/libglib-2.0.so
/usr/local/lib/hpux32/libglib-2.0.so: ELF-32 shared object file - IA64
#

# file ./src/main.o
./src/main.o: ELF-32 relocatable object file - IA64
#


-------------------------------------------------------------------------------
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

Shalom,

Whats the environment, especially SHLIB_PATH.

I see this code is ELF-32. I'm not an expert, but can code written like that work with an IA-64 system even with 32 bit compatability libraries?

I wonder aloud where did the code come from? Whats the big picture on this project.

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
Shamim1
Advisor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

# echo $PATH
/usr/local/bin:/usr/local/lib:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/X11:/opt/graphics/common/bin:/opt/upgrade/bin:/usr/contrib/bin/X11:/opt/ipf/bin:/opt/resmon/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/sec_mgmt/bastille/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/gnome/bin:/opt/ignite/bin:/opt/mozilla:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/hpsmh/bin:/opt/gwlm/bin:/opt/vse/bin:/opt/hpvm/bin:/opt/ignite/bin:/usr/sbin/:/sbin:/home/root:/usr/contrib/bin:/usr/local/lib/hpux32:/opt/hp-gcc-4.2.1/bin/gcc:/opt/hp-gcc-4.2.1/bin/:/opt/hp-gcc-4.2.1/bin/:/opt/hp-gcc-4.2.1/bin/:/opt/hp-gcc/bin/:/usr/local/lib/hpux32/
#



Yes this is an ia64 system. And I'm trying to compile syslog_ng for static library linking.

Regards
Shamim
Don Morris_1
Honored Contributor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

I don't have an 11.23 box handy -- but I believe your problem is that you need /usr/lib/hpux32 in your library path as well.

Here's why (based on my 11.31 box, but I doubt there's much difference here):

# ll /usr/lib/libnsl*
-r-xr-xr-x 1 bin bin 585728 Jun 4 2006 /usr/lib/libnsl.1
lrwxr-xr-x 1 root sys 10 Jun 28 2006 /usr/lib/libnsl.sl -> ./libnsl.1
-r-xr-xr-x 1 bin bin 98304 Mar 29 2001 /usr/lib/libnsl_s.1
-r-xr-xr-x 1 bin bin 126976 May 30 2006 /usr/lib/libnsl_s.2
lrwxr-xr-x 1 root sys 12 Jun 28 2006 /usr/lib/libnsl_s.sl -> ./libnsl_s.2

# file /usr/lib/libnsl.1
/usr/lib/libnsl.1: PA-RISC1.1 shared library -not stripped

[all the libnsl files here are PA -- PA 32 (SOM) and IPF 32 (ELF-32) are not compatible ABIs, hence the error].

# file /usr/lib/hpux32/libnsl.so
/usr/lib/hpux32/libnsl.so: ELF-32 shared object file - IA64

That's the one you want (for 64-bit, obviously use /usr/lib/hpux64/libnsl.so).
Dennis Handly
Acclaimed Contributor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

As Don says, -lnsl should be in /usr/lib/hpux??/libnsl.so.

>ld: Can't find library or mismatched ABI for -lnsl

If you have a recent linker patch, I've asked this message be split into two parts so you don't have to guess which part of the "or" is wrong.

>SEP: I see this code is ELF-32. I'm not an expert, but can code written like that work with an IA-64 system even with 32 bit compatibility libraries?

ELF-32 is the native 32 bit IPF format. Nothing to do with compatibility libs.

>Don: /usr/lib/hpux32 in your library path as well.

No, that's the default.

# ll /usr/lib/libnsl*

This shows the problem. You can't use -static on IPF. There is no archive versions of libnsl, libc, etc.

What Shamim1 could try is use -Wl,-a,archive_shared.

(It would have been helpful to add -v to the gcc command line to see the linker options.)
Shamim1
Advisor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

Thanks a ton for your response. However still no successs. Here is the output for "gcc -v"

# gcc -v
Using built-in specs.
Target: ia64-hp-hpux11.23
Configured with: /tmp/gcc-4.2.1.tar.gz/gcc-4.2.1/configure --host=ia64-hp-hpux11.23 --target=ia64-hp-hpux11.23 --build=ia64-hp-hpux11.23 --prefix=/opt/hp-gcc-4.2.1 --with-gnu-as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix --enable-languages=c,c++
Thread model: posix
gcc version 4.2.1
#

Regards
Shamim
Dennis Handly
Acclaimed Contributor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

>Here is the output for "gcc -v"

You need to add it to your link line.

>However still no success.

You didn't remove -static or use the tried and true -Wl,-a,archive_shared.
Dennis Handly
Acclaimed Contributor
Solution

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

Have you successfully linked your application yet? If you are happy with your answers please read the following about assigning points:

http://forums11.itrc.hp.com/service/forums/helptips.do?#33
Shamim1
Advisor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

Hello Dennis,

Thanks for your help, I really appreciate your timely help. However I'm still struggling with the problem, And I put that on hold.
Dennis Handly
Acclaimed Contributor

Re: ld: Can't find library or mismatched ABI for -lnsl--- on HP-UX kmghp2 B.11.23 U ia64 3887625253

>I'm still struggling with the problem,

Let us know what your problems are when you get back to it.