作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我遇到了一个奇怪的“ undefined reference ”编译错误,我似乎找不到解决方法。我正在尝试使用Yocto Project生成的ARM编译器(arm-poky-linux-gnueabi-gcc)为我的Gumstix Overo配置/编译PAM 1.1.6,但在编译过程中始终出现以下错误:
.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
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#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;
}
./arm-poky-linux-gnueabi-gcc -o test.o test.c
/tmp/ccU8YszI.o: In function `main':
test.c:(.text+0x8): undefined reference to `ruserok'
collect2: error: ld returned 1 exit status
arm-linux-gnueabi-gcc -o test.o test.c
最佳答案
编译器(尤其是gcc
)不仅仅是代码生成器。他们非常熟悉 libc 或标准C
库,以及 libgcc 编译器帮助程序库。常规命令行隐式使用-lc
(与 libc 链接)。 Ubuntu的arm-linux-gnueabi-gcc
是一个带有eglibc的crosstool-ng构建。
我不知道Poky gcc是什么。您可能会提供指向从何处获得编译器的链接。从Poky configuration link看来,编译器是一个multi-lib发行版或诸如此类的东西,可能还需要执行其他步骤来配置交叉构建。
问题的答案,
Why would one compiler produce an "undefined reference to ruserok" error, while the other does not?
ruserok
,而另一个则没有(或未配置为查看)。
关于compiler-construction - 未定义对ruserok错误的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15890007/
我是一名优秀的程序员,十分优秀!