compiler construction - undefined reference to ruserok error -
i've run strange "undefined reference to" compile error cannot seem find resolution for. i'm trying configure/compile pam 1.1.6 gumstix overo using yocto project generated arm compiler (arm-poky-linux-gnueabi-gcc), keep getting following error during compilation:
.libs/pam_rhosts.o: in function `pam_sm_authenticate': modules/pam_rhosts/pam_rhosts.c:117: undefined reference `ruserok' collect2: error: ld returned 1 exit status
so, did investigating , found out during configure, following test code compiled , executed determine availability of ruserok, ruserok_af , iruserok.
/* end confdefs.h. */ /* define $2 innocuous variant, in case <limits.h> declares $2. example, hp-ux 11i <limits.h> declares gettimeofday. */ #define $2 innocuous_$2 /* system header define __stub macros , few prototypes, can conflict char $2 (); below. prefer <limits.h> <assert.h> if __stdc__ defined, since <limits.h> exists on freestanding compilers. */ #ifdef __stdc__ # include <limits.h> #else # include <assert.h> #endif #undef $2 /* override gcc internal prototype avoid error. use char because int might match return type of gcc builtin , argument prototype still apply. */ #ifdef __cplusplus extern "c" #endif char $2 (); /* gnu c library defines functions implements fail enosys. functions named starting __ , normal name alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; }
so, copied, pasted (replacing of $2's ruserok) , compiled code using generated gcc compiler
./arm-poky-linux-gnueabi-gcc -o test.o test.c
to see if ruserok, ruserok_af , iuserok functions do/don't exist, , received following compilation error:
/tmp/ccu8yszi.o: in function `main': test.c:(.text+0x8): undefined reference `ruserok' collect2: error: ld returned 1 exit status
which, same "undefined reference `ruserok'" error above. sanity check, since had installed ubuntu/linaro arm gcc compiler through ubuntu software center earlier, compiled same code arm-linux-gnueabi-gcc compiler, code compiled fine without errors. here command used reference:
arm-linux-gnueabi-gcc -o test.o test.c
so, question is: why 1 compiler produce "undefined reference ruserok" error, while other not? or asked differently, difference between 2 compilers 1 compiler produce "undefined reference ruserok" error?
compilers (and in particular gcc
) more code generators. intimately familiar libc, or standard c
library , libgcc compiler helper library. general command lines implicitly use -lc
(link libc). arm-linux-gnueabi-gcc
ubuntu crosstool-ng build eglibc.
i have no idea poky gcc about. might provide link got compiler from. poky configuration link, seems compiler mult-lib distribution or , there additional steps need perform configure cross-build.
the answer question,
why 1 compiler produce "undefined reference ruserok" error, while other not?
because 1 has ruserok
in library , other doesn't (or isn't configured see it).
Comments
Post a Comment