我在使用Linux。我通过存储库安装了Clang编译器和Musl标准C库。我试着用MUSLstdio.h通过Clang编译一个"hello world“程序,但是失败了。
我在程序的开头放了以下一行:
#include
但是在编译时(在详细模式下),它返回了以下错误:
==============================
(...)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/llvm-11/lib/clang/11.0.1/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
In file included from /home/pureos/hello.c:1:
/usr/include/x86_64-linux-musl/stdio.h:26:10: error: 'bits/alltypes.h' file not found with <angled> include; use "quotes" instead
#include <bits/alltypes.h>
^~~~~~~~~~~~~~~~~
"bits/alltypes.h"
==============================它似乎不识别"x86_64-linux-musl“目录中的”位“目录,但我看到它确实存在。
嗯,使用“clanghello.c -I /usr/include/x86_64-linux-musl/”编译了,但没有工作。毕竟,通过“已编译的-C a.out”命令对编译的程序进行的分析奇怪地表明,它一直在使用Glibc库,这正是我想要避免的。
编译器没有明确的理由使用Glibc,因为我在源代码中明确指定了绝对路径/usr/ include /x86_64-linux-musl/stdio.h;我尝试了角型(<>)包含和引号(""),但这些都不起作用。
在生成的"a.out“文件中运行"ldd”命令,它将显示它与"/lib/x86_64-linux-gnu/libc.so.6“文件相链接;但是,如果一切正常运行,它是否不应该链接到"/lib/x86_64-linux-musl/libc.so”或"/lib/ld-musl-x86_64.so.1“文件。
任何帮助都是欢迎的,问候。
https://stackoverflow.com/questions/74428590
复制相似问题