c - 错误 gcc - 未定义对符号 '__getauxval@@GLIBC_2.17' 的引用
问题描述
大家好。
我正在尝试编译简单的 C 代码。
#include <stdio.h>
void main()
{
printf("Hello world\n");
}
但我得到这个错误。
$ gcc main.c
/data/data/com.termux/files/usr/bin/ld: /data/data/com.termux/files/usr/bin/../lib/gcc/aarch64-unknown-linux-gnu/10.2.0/libgcc.a(lse-init.o): undefined reference to symbol '__getauxval@@GLIBC_2.17'
/data/data/com.termux/files/usr/bin/ld: /data/data/com.termux/files/usr/lib/libc.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
我了解该错误是由于 compidator 找不到字体而发生的,但这并不准确。同样的错误发生在C++中。
如何修复此错误?
解决方案
简而言之,发生此错误是因为 libc 类型的库不在公共目录中。这些库:
-rwxr-xr-x 1 10504 10504 1827624 Aug 4 16:27 /lib/conlib/libc-2.32.so
-rw-r--r-- 1 10504 10504 4592750 Aug 4 16:27 /lib/conlib/libc.a
-rw-r--r-- 1 10504 10504 351 Aug 4 16:27 /lib/conlib/libc.so
lrwxrwxrwx 1 10504 10504 18 Aug 4 16:27 /lib/conlib/libc.so.6 -> libc-2.32.so
-rw-r--r-- 1 10504 10504 24964 Aug 4 16:27 /lib/conlib/libc_nonshared.a
推荐阅读
- java - 有什么方法可以知道 Android 上的 Parcel 中的对象类型是什么?
- git - K8S:如何通过 SSH 服务(Gitea)在同一主机上访问 pod,ingress-nginx 暴露为 HTTP?
- python - Groupby多年来每个月的最大值和最小值
- java - 如何从 eclipse e4 中的处理程序执行方法中获取图标
- javascript - JWT 验证错误:JsonWebTokenError: invalid algorithm
- equals - 两个字面上相同的 CGAL::Point_3 点之间不相等
- python-3.x - 数据提取到图形输出
- java - JUnit 5 @Tag does not work as expected with @BeforeEach/@AfterEach
- mongodb - 在 Mono 对象上执行 block() 时出现异常我从 ReactiveMongoRepository 对象返回
- java - ORA-28040: 没有匹配的身份验证协议 Oracle