ELFCLASS32 KILLED

  • Follow


Hi all,

when i execute this particulare code I get this error:
ld.so.1: ./int:fatal:/usr/lib/64/libstdc++.so.6:wrong ELF class:
ELFCLASS32 killed.

This is the code:

//int.cpp

#include <iostream>
#include <kvm.h>
#include <fcntl.h>
#include <errno.h>
int main()
{
	kvm_t  *kd;
kd = kvm_open(NULL, NULL, NULL, O_RDONLY, &#8220;Errore&#8220;);
if (kd = = NULL)
{
	perror(&#8220;kvm_open&#8221;);
	return &#8211;1;
}
return 0;
}
 

I compile this program in this way: g++ -m64 -0 int -lkvm int.cpp

if I use this other string(g++ -o int -lkvm int.cpp) I get this error
at run-time: /dev/ksyms is not a 32-bit kernel namelist.
 
Does anyone know why? Any comments appreciated, thanks
P.S.: my OS is Solaris9
0
Reply jem_76 2/14/2005 5:29:18 PM

JM5 <jem_76@libero.it> wrote:
> Hi all,
> 
> when i execute this particulare code I get this error:
> ld.so.1: ./int:fatal:/usr/lib/64/libstdc++.so.6:wrong ELF class:
> ELFCLASS32 killed.

This looks like a bad gcc installation. 
Everything in /usr/lib/64/ should be ELFCLASS64.

> This is the code:
> 
> //int.cpp
> 
> #include <iostream>
> #include <kvm.h>
> #include <fcntl.h>
> #include <errno.h>
> int main()
> {
> 	kvm_t  *kd;
> kd = kvm_open(NULL, NULL, NULL, O_RDONLY, &#8220;Errore&#8220;);
> if (kd = = NULL)
> {
> 	perror(&#8220;kvm_open&#8221;);
> 	return &#8211;1;
> }
> return 0;
> }
>  
> 
> I compile this program in this way: g++ -m64 -0 int -lkvm int.cpp
> 
> if I use this other string(g++ -o int -lkvm int.cpp) I get this error
> at run-time: /dev/ksyms is not a 32-bit kernel namelist.

RTFM. From kvm_open(3KVM):

    NOTES
	 Kernel core dumps should be  examined  on  the  platform  on
	 which  they were created. While a 32-bit application running
	 on a 64-bit kernel can examine a 32-bit core dump, a  64-bit
	 application running on a 64-bit kernel cannot examine a ker-
	 nel core dump from the 32-bit system.

gcc -m64 option builds a 64bit binary. 
Without the flag, gcc builds a 32bit binary by default.

Your problem is that you don't have 64bit libstdc++ installed.
BTW, since it's a pure c program, you don't need libstdc++.
Try compiling your program with gcc instead, 
which will get rid of libstdc++ dependency.
Of course, if your program really needs c++ stuff
and you need to build 64bit app (like in this case,
to read 64bit kernel image), you need to fix the gcc installation.
-- 
#pragma ident "Seongbae Park, compiler, http://blogs.sun.com/seongbae/"
0
Reply Seongbae 2/14/2005 5:51:08 PM


1 Replies
912 Views

(page loaded in 0.239 seconds)

Similiar Articles:













7/20/2012 6:07:23 PM


Reply: