Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI (864 Views)
Reply
Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 1 of 18 (994 Views)
Accepted Solution

ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

[ Edited ]

I got the following errors when compiling a module linking another module's libraries. 

My machine info is lasted below:

CPU info:
  5 Intel(R) Itanium 2 9100 series processors (1.59 GHz, 12 MB)
          266 MHz bus, CPU version A1
HP-UX B.11.31
Machine:   ia64
 
result (to link to libCommon.a) =>

       aCC -v +DD64  +DSitanium2 -D_HP_SOURCE +z -z -ext +eh -D_REENTRANT  -g a.o b.o -Llib -lCommon -lNet -lrwtool -o result 

LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64
 /usr/ccs/bin/ld -z -o mascollectorreader -u___exit -umain -L/opt/aCC/lib/hpux64 a.o b.o -Llib -lCommon -lNet -lrwtool -lstd_v2 -lCsup -lm -lunwind -lCsup -lc -ldl >/var/tmp/AAA014657 2>&1
 /opt/aCC/bin/c++filt </var/tmp/AAA014657 1>&2
 
ld: (Warning) Ignore library lib/libCommon.a with bad
 machine type 15
ld: Mismatched ABI for -lCommon, found lib/libCommon.a
Fatal error.
 

libCommon.a =>
The compiling/ld commands for generating libCommon.a without a problem is listed below:
aCC -v +DD64 +DSitanium2 -DUNIX +DA2.0W -O -D_HP_SOURCE +z -I../include
-c Common.C
/opt/aCC/lbin/ecom -architecture 64 -ia64abi all -inst compiletime -sysdir /usr/include -test namespaces -koenig_lookup on -ansi_for_scope on -inline_power 2 -
link_type dynamic -fpeval float -fpevaldec _Decimal32 -tls_dyn on -xmath_ielf_path /opt/aCC/lib/hpux64/libmielf -target_os 11.31 -scheduler itanium2 -I../include --sys_include /opt/aCC/include_std --sys_include /opt/aCC/include_std/iostream_compat --sys_include /usr/include --sys_include /usr -D_HP_IA64ABI -D__BUILTIN_MILLI -D_BIND_LIBCALLS -D_Math_errhandling=MATH_ERREXCEPT -D__hpux -D__unix -D__ia64=1 -D__ia64__=1 -D_BIG_ENDIAN=1 -D__STDCPP__ -D_HP_NAMESPACE_STD -D_LP64 -D__LP64__ -D__cplusplus=199711L -D_INCLUDE__STDC_A1_SOURCE -D__HP_aCC=62500 -D_HP_INSTANTIATE_T_IN_LIB -D_INLINE_ASM -D_FLT_EVAL_METHOD=0 D_DEC_EVAL_METHOD=0 -DUNIX -D_HP_SOURCE -ucode hdriver=optlevel%2% -plusolistoption -Ol06all! -plusolis
toption -Ol12indirect! -plusolistoption -Ol13moderate! -plusooption -Oq02,al,ag,
cn,sz,ic,vo,Mf,Po,es,rs,Rf,Pr,sp,In,cl,om,vc,pi,fa,Pe,rr,pa,pv,nf,cp,Lx,Pg,ug,lu
,lb,uj,dn,sg,pt,kt,em,np,ar,rp,dl,Fs,bp,wp,Pc,mp,lr,cx,cr,pi,so,Rc,fa,ft,fe,ap,s
t,lc,Bl,sr,Qs,do,ib,pl,sd,ll,rl,dl,Lt,ol,fl,lm,ts,rd,Dp,If! Common.C

 

Please share your light. Thanks a lot.
 
 
P.S. this thread has been moved from HP-UX > Messaging  to HP-UX > languages - HP Forum Moderator

 

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 2 of 18 (968 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

What does "file lib/libCommon.a" show?  What's in that archive?

How did you create that archive?  With /usr/ccs/bin/ar?

 

>aCC -v +DD64 a.o b.o -Llib -lCommon -lNet -lrwtool

 

Instead of -lrwtool you should have -lrwtool_v2

 

 

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 3 of 18 (955 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

Thanks for the reply. The libNet.a was generated from compiled Common.o as listed below without a problem.

ar rvu libNet.a Common.o

 

ar t libNet.a

Common.o    (BTW, Common.o include <sys/socket.h>

 

I replaced the -lrwtool with -lrwtool_v2 to generate the binary result, the same warning and error were reported.

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 4 of 18 (948 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

>ar rvu libNet.a Common.o

 

Again, which ar(1) did you use?  What does this show?

$ whence ar

 

You must not use a foreign devil ar.

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 5 of 18 (935 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

whence ar =>
/usr/bin/ar

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 6 of 18 (932 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

[ Edited ]

>/usr/bin/ar

 

Assuming that is a symlink to /usr/ccs/bin/ar, what do these show?

$ file lib/libCommon.a

$ /usr/ccs/bin/elfdump -f -g lib/libCommon.a

 

Have you removed and recreated libCommon.a?

 

>ar rvu libNet.a Common.o

 

What's in libCommon.a?

 

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 7 of 18 (929 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

ls -l /usr/bin/ar
lrwxr-xr-x 1 bin bin 15 Aug 10 2010 /usr/bin/ar@ -> /usr/ccs/bin/ar

 

Actually I have two .a file created with the same warning and error displayed. I always do "make clean" before creating them.

file libNet.a
libNet.a: archive file

 

file libCommon.a
libCommon.a: archive file

 

ar t libNet.a
Connection.o

 

/usr/ccs/bin/elfdump -f -g libNet.a 

libNet.a:

*** Archive Symbol Table ***
1174 _ZN21Connection_Err_SocketC1EPc
1174 _ZN21Connection_Err_SocketC3EPc
1174 _ZN21Connection_Err_SocketC2EPc
1174 _ZN18Connection_Err_SvcC1EPc
1174 _ZN18Connection_Err_SvcC3EPc
1174 _ZN18Connection_Err_SvcC2EPc
1174 _ZN18Connection_Err_SecC1EPc
1174 _ZN18Connection_Err_SecC3EPc
1174 _ZN18Connection_Err_SecC2EPc
1174 _ZN10ConnectionC1Ev
1174 _ZN10ConnectionC2Ev
1174 _ZN10ConnectionD1Ev
1174 _ZN10ConnectionD0Ev
1174 _ZN10ConnectionD2Ev
1174 _ZN10Connection11receiveDataEPci
1174 _ZN10Connection17simpleReceiveDataEPci
1174 _ZN10Connection19setErrorExplanationEPc
1174 _ZN10Connection19getErrorExplanationEv
1174 _ZN10Connection8sendDataEPhi

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 8 of 18 (924 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

Also please do this:

/usr/ccs/bin/elfdump -f -g libCommon.a

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 9 of 18 (921 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

Thanks Dennis. Please see attached.

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 10 of 18 (912 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

>ld: (Warning) Ignore library lib/libCommon.a with bad machine type 15

 

This error says that this archive has 64 bit PA objects in it.

Remove lib/libCommon.a and rebuild.

Are you doing anything tricky and using XPADE?

 

>Please see attached.

 

The -f output all has:

Machine:                 IPF

Flags:                       IA-64

I don't see:

Machine:                PA-RISC
Flags:                      PA2.0

 

Do you still get that error?

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 11 of 18 (909 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

"make clean" was always done before creating lib/libCommon.a. 

 

I didn't use XPADE.

 

Following contains most of the machinfo output: My server should be a Itanium instead of the PA-RISC machine.

machinfo
CPU info:
5 Intel(R) Itanium 2 9100 series processors (1.59 GHz, 12 MB)
266 MHz bus, CPU version A1

Memory: 12282 MB (11.99 GB)

Firmware info:
Firmware revision: 04.20.00
FP SWA driver revision: 1.18
IPMI is supported on this system.
BMC firmware revision: 4.14

Platform info:
Model: "ia64 hp server Integrity Virtual Machine"

 

OS info:
Nodename:

Release: HP-UX B.11.31
Version: U (unlimited-user license)
Machine: ia64
ID Number: 2730369916
vmunix _release_version:
@(#) $Revision: vmunix: B.11.31_LR FLAVOR=perf

 

Thanks again for looking into this,

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 12 of 18 (903 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

>"make clean" was always done before creating lib/libCommon.a.

 

Please make sure you do a "rm -f lib/libCommon.a".

Make sure you hunt down all copies of libCommon.a and all copies of objects that go into that archive and remove them.

Make sure that you do a "file *.o" on each object file directory and the output is like:

foo.o:         ELF-64 relocatable object file - IA64

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 13 of 18 (900 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

After "make clean", all the .o and .a files were removed. Then the make command generated all the .o files and those two .a files without a problem as usual. The the result of all the "file ~.o" all showns "ELF-64 relocatable object file - IA64". But same ld  warning and error were reported again when trying to build another module and link it with -lCommon -lNet -lrwtool_v2. BTW, my aCC and ld are the 2009 version on this server. 

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 14 of 18 (897 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

Dennis: You are right. I searched libNet.a on the entire server and saw multiple copies and then realized that the LIBPATH pointed to a very old lib folder. After corrected it, the issues was resolved. You are great.

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 15 of 18 (893 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

>the issues was resolved. You are great.

 

Great!  Please click on the Kudos stars for all replies that were helpful.

Also pick one of them and use the Post Options to mark it as the solution.

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 16 of 18 (882 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

Dennis:  I wish that you will receive/enjoy www.biblesforamerica.org as a token of appreciation. BTW, may I know where to click Kudos stars? Also do you have an idea regarding the following ld errors?

 

aCC -v +DD64 +DSitanium2 -L/usr/lib/hpux64 -L/opt/langtools/lib/hpux64 -D_HP_SOURCE +z  -g xxx.o -L/home/users/vision/vision_src/comlib_cpp/lib -lCommon -lNet -lrwtool_v2 -o mascollectorreader
LPATH=/usr/lib/hpux64:/opt/langtools/lib/hpux64
/usr/ccs/bin/ld -o mascollectorreader -u___exit -umain -L/opt/aCC/lib/hpux64 -L
/usr/lib/hpux64 -L /opt/langtools/lib/hpux64 xxx.o -L /home/users/vision/vision_src/comlib_cpp/lib -lCommon -lNet -lrwtool_v2 -lstd_v2 -lCsup -lm -lunwind -lCsup -lc -ldl >/var/tmp/AAA025854 2>&1
/opt/aCC/bin/c++filt </var/tmp/AAA025854 1>&2
ld: Unsatisfied symbol "virtual table of Invalid_Directory" in file xxx.o
ld: Unsatisfied symbol "type info of Invalid_Directory" in file xxx.o

The class Invalid_Directory is defined in the comlib_cpp/include/ErrorLog.h as listed below:
class Invalid_Directory : public exception
{
private:
  const char *desc;

public:
  Invalid_Directory(const char* ExceptionName) : desc(ExceptionName) {;}
  virtual const char* what () const throw() {
    return (const char*)desc;
   }
  virtual ~Invalid_Directory() throw();
};

xxx.C has ”#include <ErrorLog.h>” and “ErrorLog ERROR_LOG; “ and the codes listed below:

        try {

            ERROR_LOG.open(ErrLogDir,ErrLogFile);

        } catch ( Invalid_Directory ) {

            cout << "Error: Failed to open logfile ( dir: " << ErrLogDir << " file: " << ErrLogFile << " )" << endl;
            exit(1);
        }

 

Acclaimed Contributor
Dennis Handly
Posts: 25,054
Registered: ‎03-06-2006
Message 17 of 18 (872 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

>may I know where to click Kudos stars?

 

The Kudos stars are the white stars to the bottom left of each post.

 

>do you have an idea regarding the following ld errors?

ld: Unsatisfied symbol "virtual table of Invalid_Directory"
ld: Unsatisfied symbol "type info of Invalid_Directory"

 

These unsat symbols occur because you haven't defined the key function for that class:

   virtual ~Invalid_Directory() throw();

 

You need to define this virtual destructor.

Occasional Advisor
sunsl
Posts: 10
Registered: ‎05-18-2013
Message 18 of 18 (864 Views)

Re: ld: (Warning) Ignore library libCommon.a with bad machine type 15 and ld: Mismatched ABI

I will do the Kudos stars. virtual ~Invalid_Directory() throw() {}; cleared out those errors.

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.