title: Can't compile UNIX/Linux program as 32-bit program
body: <p>I wrote a basic UNIX program that uses some low-level I/O. Nothing special, here's the code if you want to look at it:</p>
  
  <pre><code>#include &lt;fcntl.h&gt;
  #include &lt;limits.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  
  #define BUFFSIZE 1024
  
  int main(int argc, char *argv[])
  {
      // Character buffer
      char buffer[BUFFSIZE];
      // File 1 descriptor
      int file1Desc = 0;
      // File 2 descriptor
      int file2Desc = 0;
      // Output file descriptor
      int outfileDesc = 0;
      // Count # of chars read in
      int n = 0;
      // Boolean: no stdin reads?
      unsigned char zeroSTDIN = 1;
  
      // Need at least two arguments, no more than 3
      if((argc &lt; 3) || (argc &gt; 4)){
          printf("ERROR!!!\nUsage: kitty file1 file2 &lt;outfile&gt;\n");
          return EXIT_FAILURE;
      }
  
      /** TRY TO OPEN FILES 1 AND 2 FOR READING **/
      // Check for stdin read flag
      if(argv[1][0] == '-' &amp;&amp; argv[1][1] == '\0'){
          file1Desc = STDIN_FILENO;
          zeroSTDIN = 0;
      }
      // Otherwise just open file 1 for reading
      else{
          if((file1Desc = open(argv[1],O_RDONLY)) &lt; 0){
              perror(argv[1]);
              printf("ERROR!!!\nUnable to open %s for reading\n",argv[1]);
              return EXIT_FAILURE;
          }
      }
      // Check for stdin read flag
      if(argv[2][0] == '-' &amp;&amp; argv[2][1] == '\0'){
          // Only one read from stdin
          if(!zeroSTDIN){
              perror(argv[2]);
              printf("ERROR!!!\nOnly one read from stdin\n",argv[1]);
          }
          file2Desc = STDIN_FILENO;
      }
      // Otherwise just open file2 for reading
      else{
          if((file2Desc = open(argv[2],O_RDONLY)) &lt; 0){
              perror(argv[2]);
              printf("ERROR!!!\nUnable to open %s for reading\n",argv[2]);
              if(file1Desc != STDIN_FILENO)
                  close(file1Desc);
              return EXIT_FAILURE;
          }
      }
  
      // If argument specified, try to open output file for writing
      if(argc == 4){
          if((outfileDesc = open(argv[3],O_WRONLY|O_CREAT|O_TRUNC)) &lt; 0){
              perror(argv[2]);
              printf("ERROR!!!\nUnable to open %s for writing\n",argv[3]);
              // Can't forget these
              if(file1Desc != STDIN_FILENO)
                  close(file1Desc);
              if(file2Desc != STDIN_FILENO);
                  close(file2Desc);
              return EXIT_FAILURE;
          }
      }
      // stdout otherwise
      else{
          outfileDesc = STDOUT_FILENO;
      }
  
      // While there is anything left to read from file 1
      while((n = read(file1Desc, buffer, BUFFSIZE)) &gt; 0){
          // Write n chars to output file
          if(write(outfileDesc, buffer, n) != n){
              printf("Error writing to output file from file 1\n");
              return EXIT_FAILURE;
          }
      }
      // While there is anything left to read from file 2
      while((n = read(file2Desc, buffer, BUFFSIZE)) &gt; 0){
          // Write n chars to output file
          if(write(outfileDesc, buffer, n) != n){
              printf("Error writing to output file from file 1\n");
              return EXIT_FAILURE;
          }
      }
  
      // Exit program
      if(file1Desc != STDIN_FILENO)
          close(file1Desc);
      if(file2Desc != STDIN_FILENO);
          close(file2Desc);
      if(argc == 4)
          close(outfileDesc);
      return 0;
  }
  </code></pre>
  
  <p>It compiles without any special options. However, I want to compile in 32-bit mode. I'm running Fedora 15 64-bit and it defaults to a 64-bit compilation.</p>
  
  <p>I'm trying to use the following options:</p>
  
  <pre><code>gcc -S -m32 -O3 -o llio.asm llio.c
  </code></pre>
  
  <p>So I want can look at the assembly code being produced, but I get the following compilation errors:</p>
  
  <pre><code>In file included from /usr/include/features.h:387:0,
                   from /usr/include/fcntl.h:27,
                   from kitty.c:1:
  /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>This site seems to know my issue: <a href="http://www.cyberciti.biz/faq/x86_64-linux-error-gnustub-32h-missing-error-and-solution/" rel="nofollow noreferrer">http://www.cyberciti.biz/faq/x86_64-linux-error-gnustub-32h-missing-error-and-solution/</a></p>
  
  <p>However, I looked and these files seem to already be installed. What am I missing?</p>
  
  <p><img src="https://i.stack.imgur.com/aWh3e.png" alt="Installed Files"></p>