gpt4 book ai didi

macos - ld:在带有 gcc/clang -static 标志的 OSX 10.6 上找不到 -lcrt0.o 的库

转载 作者:行者123 更新时间:2023-12-03 05:57:12 25 4
gpt4 key购买 nike

当我尝试构建以下程序时:

#include <stdio.h>

int main(void)
{
printf("hello world\n");
return 0;
}

在 OS X 10.6.4 上,具有以下标志:

gcc -static -o blah blah.c

它返回:

ld: library not found for -lcrt0.o
collect2: ld returned 1 exit status

还有其他人遇到过这种情况吗,或者其他人还没有受到过影响吗?有修复吗?

谢谢

最佳答案

这行不通。从 gccman 页面:

This option will not work on Mac OS X unless all libraries (including libgcc.a) have also been compiled with -static. Since neither a static version of libSystem.dylib nor crt0.o are provided, this option is not useful to most people.

关于macos - ld:在带有 gcc/clang -static 标志的 OSX 10.6 上找不到 -lcrt0.o 的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3801011/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com