Force gcc to compile 32 bit programs on 64 bit platform


I’ve got a proprietary program that I’m trying to use on a 64 bit system.

When I launch the setup it works ok, but after it tries to update itself and compile some modules and it fails to load them.

I’m suspecting it’s because it’s using gcc and gcc tries to compile them for a 64 bit system and therefore this program cannot use these modules.

Is there any way (some environmental variables or something like that) to force gcc to do everything for a 32 bit platform. Would a 32 bit chroot work?


You need to make GCC use the -m32 flag.

You could try writing a simple shell script to your $PATH and call it gcc (make sure you don’t overwrite the original gcc, and make sure the new script comes earlier in $PATH, and that it uses the full path to GCC.

I think the code you need is just something like /bin/gcc -m32 $* depending on your shell (the $*is there to include all arguments, although it might be something else – very important!)


You’ll also need the 32bit C library, as well as 32 bit versions of whatever external libraries the program links against in some cases. – Tim Post Aug 17 ’10 at 11:12

Indeed. Standard libraries: C: apt-get install gcc-multilib; C++: apt-get install g++-multilib. – Bart Nov 20 ’14 at 17:13

HowTo Compile a 32-bit Application Using gcc On the 64-bit Linux Version


Ihad to compile a 32-bit application using GNU gcc on the 64-bit version of Linux.

Luckily, gcc man page directed me to the ‘-m32’ and ‘-m64’ options. These options generate code for 32-bit or 64-bit environments, respectively.

  1. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system.
  2. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD’s x86-64 architecture.

You can pass -m64 or -m32 options as follows to Gnu gcc

For 32 bit version:

$ gcc -m32 -o output32 hello.c

For 64 bit version :

$ gcc -m64 -o output64 hello.c

Run it as follows:

$ ./output32


Long int size is 4 bytes long!

Now let us see 64 bit output:
$ ./output64

Long int size is 8 bytes long!

Sample code – hello.c

#include <stdio.h>
int main() {
    long z; printf("Long int size is %i bytes long!\n", sizeof(z)); return 0;

A note about glibc-devel on 64 bit systems

You may see an error as follows on 64 bit system when you try to build 32 bit app:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:

This error message shows up on the 64 bit systems where GCC multilib feature is enabled, and it indicates that 32 bit version of libc is not installed. To fix this problem, on aCentOS/RHEL 5.x type the following yum command:

# yum -y install glibc-devel.i386 libstdc++-devel.i386

To fix this problem, on a CentOS/RHEL 6.x type the following yum command:

# yum -y install glibc-devel.i686 glibc-devel ibstdc++-devel.i686

To fix this problem on a Debian or Ubuntu Linux type the following apt-get command:

$ sudo apt-get install g++-multilib libc6-dev-i386

To fix this problem on a Suse (SLES) / OpenSUSE Linux type the following zypper command:

# zypper in glibc-devel-32bit
See also

Jump to first non-whitespace character in line in emacs


I’m looking for the emacs equivalent of vi’s ^.

How can I move my cursor to the first non-whitespace character in a line?

shareimprove this question

The command is back-to-indentation, bound by default to M-m.

shareimprove this answer

This is what I picked up from a previous Stack Overflow question:

(defun smart-beginning-of-line ()
  "Move point to first non-whitespace character or beginning-of-line.

Move point to the first non-whitespace character on this line.
If point was already at that position, move point to beginning of line."
  (let ((oldpos (point)))
    (and (= oldpos (point))
(global-set-key [home] 'smart-beginning-of-line)
(global-set-key "\C-a" 'smart-beginning-of-line)
shareimprove this answer

Microsoft Word Icon Changed to Unknown Program [Solved/Closed]


Recently my microsoft word (program) icon changed from the classic picture to the unknown programs icon. I wanted to know how to get the real icon back. My icons for everything else (such as Microsoft Excel) on the desktop still displa properly. When I click on the Microsoft Word unknown programs icon, it sill opens to a normal new document scree, so this is no problem.

Go to microsoft office– microsoft office tools– microsoft office picture manager– help– detect and repair– check restore my shortcuts while repairing.

This should restore all the microsoft office shortcuts and icons

How do you use gcc to generate assembly code in Intel syntax?


The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?


Have you tried this?

gcc -S -masm=intel test.c

Untested, but I found it in this forum where someone claimed it worked for them.

I just tried this on the mac and it failed, so I looked in my man page:

       Output asm instructions using selected dialect.  Supported choices
       are intel or att (the default one).  Darwin does not support intel.

It may work on your platform.

For Mac OSX:

clang++ -S -mllvm --x86-asm-syntax=intel test.cpp



GCC preprocessor output and compilation in one pass


Is it possible to generate preprocessor output and compilation in one step with GCC?

Something like:

gcc -E -c -o main.o

that would generate main.o and main.i



Look at gcc -save-temps option.

It compiles the source file and saves the result of the preprocessing in a .i file. (It also saves the result of the assembler phase to a .s file).

gcc -save-temps -c -o main.o

will generate main.o but also main.i and main.s.

main.i is the result of the preprocessing.


Breakpoint not hit when remote debugging on Internet for ASP.NET


I have sit up remote debugging on a Window 2003 server accessed through the Internet. I have VS 2008 SP1 installed on my XP dev box.

I launched the site on the remote server and attached to all the w3wp.exe processes on the remote server. I noticed that the .dll did not load the symbols file. When I try to load the corresponding .pdb file from my local machine, it says file does not match. I have “Require source files to exactly match the original version” unchecked. The assembly on the remote server is the same as the one on my dev box. The site and .dll was copied from dev boc to remote server and code hasn’t changed since. So I know .dll and .pdb files should match or at least I need to force the matching.


  1. How do I get the .pdb file to load? I know breakpoints won’t trigger unless symbols file is loaded. I noticed that the .pdb file does not exist in the “Temporary ASP.NET Files” folder on the remote server. The .dll does.
  2. What’s the proper sequence to start debugging remotely inside VS? (Remote set up is done and I can see remote processes). In VS, I have start page as the url of the remote site. I start without debugging and then attach to w3wp.exe(s) on the remote. Is this all?

Are you running a Web Site or a Web Application (is it a compiled project, that you deploy the DLL for, or a collection of aspx and aspx.cs files that you deploy)?

If it’s a Web Application, did you deploy a release build, or a debug build? You won’t be able to hit breakpoints when “debugging” a release build, as the code is fairly heavily optimised.

Have you got “debug=true” set in the web.config compilation section? If not, again, debugging is going to be difficult.

Finally, the steps I use when remote debugging are:

  1. Deploy latest debug build of files
  2. Request page on remote server to start/restart application
  3. Ensure that the VS Remote Debugging Monitor is up and running on the remote server
  4. In VS, go to Tools (or Debug) | Attach to Process…, ensure that the remote server is selected in the Qualifier, and select w3wp.exe for the correct app-pool, etc.
  5. Request page that will fire break point.
  6. Debug!

If the breakpoints are hollow (thin red circles rather than filled disks), I’ll often check the Stack window in VS to see what has and hasn’t been loaded.