0

I have libc6-i386 installed on my 64-bit capable Intel i3 processor.

Should I rather install the amd64-versions of libc or stick to the i386 as I have an Intel processor?

0

1 Answer 1

4

TL;DR: If you are running the 64-bit version of Ubuntu and you're invoking GCC as gcc (for C) or g++ (for C++), you need not be worried about the presence of libc-i386 on your system. A 64-bit system with a working compiler will produce binaries that link against the proper, 64-bit version of libc.

Does libc6-i386 compile 64-bit executables?

libc-i386 doesn't compile anything because it is not a compiler. The C compiler is gcc. Both libc binaries and libc header files are important but passive in the build process. Code is preprocessed, including information from the header files. It is compiled. It is linked to libc. libc is not doing any of this, your build tools--principally gcc (in the sense that that's the command you most frequently run to make these things happen)--do this.

If you are running the 64-bit version of Ubuntu and you have a C compiler installed, then you already have the necessary libraries and header files to compile and link programs against a 64-bit implementation of libc. My guess is that this is the situation you are in. Note that the presence of a 32-bit libc does not prevent the 64-bit libc from being used by default unless you are cross-compiling a 32-bit binary (which you would generally know you were doing, as it requires a bit of effort, and you would probably not be invoking gcc as gcc). Therefore, you need not be worried about the presence of libc-i386 on your system.

If you are running the 32-bit version of Ubuntu and you want to cross-compile 64-bit binaries, then you'll need something that provides the 64-bit version of libc as well as header files for it. (Header files provided officially in Ubuntu are provided by packages whose names end in -dev.) However, while 32-bit binaries can run on a 64-bit operating system, 64-bit binaries cannot run on a 32-bit operating system. So unless you really need to cross-compile, it's usually best to build 64-bit programs in a 64-bit operating system.

Given the small amount of information you've provided, it would be difficult to give an answer more specific to your situation.

1
  • Thanks. I had not in mind that libc6 itself is not linking or compiling anything. You were right, I am running on Ubuntu 64 bit and I'm also compiling for 64 bit. The problem I initially had was that my gcc couldn't find a function pthread_atfork although I used the flag -pthread. But that's another question. :)
    – Wauzl
    Commented Apr 10, 2013 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .