CentOS Icon CentOS Logo
CentOS Text
   
  
www.centos.org Forum Index
   CentOS 5 - General Support
  /lib/* vs /lib64/*

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread
  •  dabd
      dabd
/lib/* vs /lib64/*
#1
Newbie
Joined: 2012/3/30
From
Posts: 1
I am trying to compile (with gcc) a C program on a CentOS 5 machine. The resulting executable shows that it is loading shared libraries from /lib64:
ldd <my executable>
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000035ea800000)
libpcap.so.0.9.4 => /usr/lib64/libpcap.so.0.9.4 (0x00002aaaaaac5000)
libc.so.6 => /lib64/libc.so.6 (0x00000035e9c00000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

A previously installed version of the software I am trying to compile shows:
linux-gate.so.1 => (0xffffe000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00526000)
libc.so.6 => /lib/libc.so.6 (0x003e4000)
/lib/ld-linux.so.2 (0x56555000)

Why is my newly compiled exe pointing to /lib64? The libs in those directory are different from the ones in /lib which is causing me problems interacting with existing software which is using libs under /lib.
How can I make my executable use /lib instead of /lib64?

Thanks.
Posted on: 2012/3/30 10:12
Create PDF from Post Print
Top
  •  TrevorH
      TrevorH
Re: /lib/* vs /lib64/*
#2
Moderator
Joined: 2009/9/24
From Brighton, UK
Posts: 6361
Compile it for 32 bit not 64.
_________________
Linux/VoIP Systems Administrator
Posted on: 2012/3/30 11:14
Create PDF from Post Print
Top
  •  jlehtone
      jlehtone
Re: /lib/* vs /lib64/*
#3
Professional Board Member
Joined: 2007/12/11
From Finland
Posts: 1329
Do:
Quote:
file <my executable>
file <old executable>

Do you by any chance see
"ELF 64-bit LSB executable, ..."
"ELF 32-bit LSB executable, ..."

You are compiling on a 64-bit system, where the default is to complie 64-bit binaries, which link to 64-bit libraries. The old binary has been compiled as 32-bit and naturally links to 32-bit libraries.

On a 64-bit CentOS installation the 64-bit libraries are in /lib64 and the 32-bit libraries are in /lib. The 32-bit libraries are needed only for executing 32-bit binaries. The libraries are not really different in functionality, but the 64-bit are "native" and the 32-bit kind of wrappers that let a 32-bit binary to execute in 64-bit system.

If you really want, you probably can pass "-m32" flag to the compiler but in my opinion you shouldn't, unless the same binary has to be run in a 32-bit OS.
Posted on: 2012/3/30 11:21
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.




"Linux" is a registered trademark of Linus Torvalds. | All other trademarks are property of their respective owners. | All other content is Copyright @ 2004-2009 by the CentOS Project or "each individual contributor (forums, comments, etc.) unless otherwise assigned".| Theme based on a theme by 7dana.com