为什么clang++链接到gcc
Why is clang++ linking to gcc?
我有一个简单的"Hello,world"风格的程序,我正在FreeBSD:上用clang++编译
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
cout << "Oh, hello" << endl;
return EXIT_SUCCESS;
}
我用clang++及其libc++编译的:
$ clang++ -stdlib=libc++ -v ohhello.cpp
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/bin
"/usr/bin/clang++" -cc1 -triple x86_64-unknown-freebsd11.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name ohhello.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/bin/../lib/clang/3.8.0 -internal-isystem /usr/include/c++/v1 -fdeprecated-macro -fdebug-compilation-dir /usr/home/mike/projects/ohhello -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/ohhello-050a75.o -x c++ ohhello.cpp
clang -cc1 version 3.8.0 based upon LLVM 3.8.0 default target x86_64-unknown-freebsd11.0
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/v1
/usr/bin/../lib/clang/3.8.0/include
/usr/include
End of search list.
"/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/ohhello-050a75.o -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
在链接器步骤中,我多次看到"-lgcc"answers"-lgcc_s"。如果clang++使用的是libc++(而不是libstdc++(,为什么它试图链接到gcc?
感谢
libgcc
不是gcc。它是一个小型的、非编译器专用的C库。它是由gcc提供的,但它不是编译器特有的。
相关文章:
- 未知的 GCC 链接器错误,但已成功构建
- 微控制器的首次 gcc 链接器脚本编译但不运行
- 简单派生类上的Linux GCC链接错误
- 可能的 GCC 链接器错误会导致将弱符号和局部符号链接在一起时出错
- GCC链接器 - 将存档中的所有对象文件映射到特定部分
- 在Mac 10.9 Mavericks上,clang配置与gcc链接配置不同吗
- 使用GCC链接库中的Ubuntu中的C 代码
- GCC链接器:使用了哪些输入库
- 如何将GCC链接器固定地址添加到链接文件中
- 源代码生成的gcc链接错误
- fedora上的gcc链接器错误:未定义的引用
- GCC链接器抱怨对现有全局变量的未定义引用
- 编译静态库时出现 GCC 链接器错误
- 为什么gcc链接器对.a文件和.o文件的行为不同
- gcc链接的默认库
- 如何将C++共享库与 gcc 链接
- x86_64-pc-cygwin-gcc 链接器错误
- GCC 链接错误"__wcsrtombs: Zusicherung »data.__outbuf[-1] == '