title: undefined reference to ruserok error
body: <p>I've run into a strange "undefined reference to" compile error that I cannot seem to find a resolution for.  I'm trying to configure/compile PAM 1.1.6 for my Gumstix Overo using the Yocto Project generated ARM compiler (arm-poky-linux-gnueabi-gcc), but I keep getting the following error during compilation:</p>
  
  <pre><code>.libs/pam_rhosts.o: In function `pam_sm_authenticate':
  modules/pam_rhosts/pam_rhosts.c:117: undefined reference to `ruserok'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>So, I did a some investigating and found out that during configure, the following test code is compiled and executed to determine the availability of ruserok, ruserok_af and iruserok.</p>
  
  <pre><code>/* end confdefs.h.  */
  /* Define $2 to an innocuous variant, in case &lt;limits.h&gt; declares $2.
     For example, HP-UX 11i &lt;limits.h&gt; declares gettimeofday.  */
  #define $2 innocuous_$2
  
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $2 (); below.
      Prefer &lt;limits.h&gt; to &lt;assert.h&gt; if __STDC__ is defined, since
      &lt;limits.h&gt; exists even on freestanding compilers.  */
  
  #ifdef __STDC__
  # include &lt;limits.h&gt;
  #else
  # include &lt;assert.h&gt;
  #endif
  
  #undef $2
  
  /* Override any GCC internal prototype to avoid an error.
     Use char because int might match the return type of a GCC
     builtin and then its argument prototype would still apply.  */
  #ifdef __cplusplus
  extern "C"
  #endif
  char $2 ();
  /* The GNU C library defines this for functions which it implements
      to always fail with ENOSYS.  Some functions are actually named
      something starting with __ and the normal name is an alias.  */
  #if defined __stub_$2 || defined __stub___$2
  choke me
  #endif
  
  int
  main ()
  {
  return $2 ();
    ;
    return 0;
  }
  </code></pre>
  
  <p>So, I copied, pasted (replacing all of the $2's with ruserok) and compiled this code using the generated GCC compiler</p>
  
  <pre><code>./arm-poky-linux-gnueabi-gcc -o test.o test.c
  </code></pre>
  
  <p>to see if the ruserok, ruserok_af and iuserok functions do/don't exist, and I received the following compilation error:</p>
  
  <pre><code>/tmp/ccU8YszI.o: In function `main':
  test.c:(.text+0x8): undefined reference to `ruserok'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>which, is the same "undefined reference to `ruserok'" error as above. As a sanity check, since I had installed the Ubuntu/Linaro ARM GCC compiler through the Ubuntu Software center earlier, I compiled the same code with the arm-linux-gnueabi-gcc compiler, but the code compiled fine without any errors.  Here the command I used for reference:</p>
  
  <pre><code>arm-linux-gnueabi-gcc -o test.o test.c
  </code></pre>
  
  <h2>So, my question is: Why would one compiler produce an "undefined reference to ruserok" error, while the other does not? Or asked differently, what is the difference between the two compilers that one compiler would produce an "undefined reference to ruserok" error?</h2>