# Howto for compiling in 32-bit?

**URL:** <https://www.ruby-forum.com/t/howto-for-compiling-in-32-bit/157361>\
**Category:** Ruby\
**Created:** [January 9, 2009, 9:54pm UTC](https://www.ruby-forum.com/t/howto-for-compiling-in-32-bit/157361 "2009-01-09T21:54:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 9, 2009, 9:54pm UTC](https://www.ruby-forum.com/t/howto-for-compiling-in-32-bit/157361/1 "2009-01-09T21:54:29Z")

</div>

Anybody know of a HOWTO for compiling a 32-bit binary [like ruby] in a  
64-bit OS like…ubuntu on a 64 bit machine?  
Thanks much.  
-r

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 9, 2009, 10:23pm UTC](https://www.ruby-forum.com/t/howto-for-compiling-in-32-bit/157361/2 "2009-01-09T22:23:55Z")

</div>

Roger P. wrote:

> Anybody know of a HOWTO for compiling a 32-bit binary [like ruby] in a  
> 64-bit OS like…ubuntu on a 64 bit machine?  
> Thanks much.  
> -r

Google sez… if you are using GCC, try -m32 that should force the  
compiler to make a 32 bit binary. You may need the 32bit versions of the  
libraries that Ruby expects to see, and that’s a whole other kettle of  
bits. I suspect the Ubuntu forums would be the place to find out about  
that.

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 9, 2009, 10:28pm UTC](https://www.ruby-forum.com/t/howto-for-compiling-in-32-bit/157361/3 "2009-01-09T22:28:02Z")

</div>

On Sat, 10 Jan 2009 05:53:23 +0900, Roger P. wrote:

> Anybody know of a HOWTO for compiling a 32-bit binary [like ruby] in a  
> 64-bit OS like…ubuntu on a 64 bit machine?  
> Thanks much.  
> -r

In general, ensure you have the necessary libraries in /usr/lib32 and  
set ‘CC=gcc -m32’ (for a C program). Thusly:

$ CC=‘gcc -m32’ ./configure && make

Tracking down the libraries can be ‘fun’.

-jh

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 9, 2009, 11:20pm UTC](https://www.ruby-forum.com/t/howto-for-compiling-in-32-bit/157361/4 "2009-01-09T23:20:46Z")

</div>

> Google sez… if you are using GCC, try -m32 t

Wow your google fu is much better than mine.  
I did see one thing that is “supposed” to help.

> **[Ubuntu Forums](https://ubuntuforums.org/showthread.php?t=474790&page=23)**
>
> A help and support forum for Ubuntu Linux.

Disappointing that it’s not as easy as like apt-get install ruby.32 or  
something.

-=r
