GCC在Alpine Linux中找不到stdio.h [英] GCC can't find stdio.h in Alpine Linux
问题描述
在全新的Alpine Linux中,我通过以下方式安装了GCC
apk add --update-cache gcc
但还是一个简单的程序
#include< stdio.h>
int main(int argc,char * argv []){
返回0;
}
已编译并带有消息
< pre class = lang-none prettyprint-override>
致命错误:stdio.h:没有这样的文件或目录
除GCC之外,还安装 libc-dev
,或仅安装 build-base
strong>( alpine-sdk
可能是一个过大的杀伤力)。要安装,请运行以下命令:
apk add libc-dev
您需要单独安装,因为在Alpine Linux中,GCC软件包不依赖 libc- dev
有充分的理由:
您可以使用gcc编译没有libc的东西,例如管理程序固件等。
August Klein还指出,在Debian中,GCC仅出于相同的原因推荐 libc-dev
(但大多数人不这样做-无安装建议
)。
In a fresh Alpine Linux I installed GCC by
apk add --update-cache gcc
but still a simple program
#include <stdio.h>
int main(int argc, char *argv[]) {
return 0;
}
compiled with message
fatal error: stdio.h: No such file or directory
Install libc-dev
in addition to GCC, or just install build-base
for everything (alpine-sdk
is probably an overkill). To install run the following command:
apk add libc-dev
You need to install it separately because in Alpine Linux, the package GCC doesn't depend on libc-dev
for good reason:
You can use gcc to compile things without libc, for example hypervisors firmware etc.
And August Klein also noted that in Debian, GCC only recommends libc-dev
for the same reason (but most people don't do --no-install-recommends
anyway).
这篇关于GCC在Alpine Linux中找不到stdio.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!