c++ - 在tsan_libdispatch_mac.cc期间,使用cmake进行的LLVM构建失败。 “Error: conflicting types for …”

标签 c++ cmake clang llvm cilk

我至少已经根据here的方向为llvm编译器成功配置了构建。

当我使用cmake --build . -v进行构建时,得到以下错误输出:

$ cmake --build . -v
...
[ 63%] Building CXX object projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_libdispatch_mac.cc.o
cd /Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/build/projects/compiler-rt/lib/tsan && /usr/bin/clang++ --sysroot=/  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dclang_rt_tsan_osx_dynamic_EXPORTS -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/build/projects/compiler-rt/lib/tsan -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/tsan -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/build/include -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/include -I/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/tsan/..  -isystem / -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -Wall -std=c++11 -O3 -DNDEBUG -arch x86_64 -arch x86_64h -fPIC    -stdlib=libc++ -mmacosx-version-min=10.9 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fvisibility-inlines-hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fPIE -fno-rtti -msse3 -Wframe-larger-than=512 -Wglobal-constructors -o CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_libdispatch_mac.cc.o -c /Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc
/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc:144:22: error: 
      conflicting types for 'dispatch_sync'
DISPATCH_INTERCEPT_B(dispatch_sync)
                     ^
/usr/include/dispatch/queue.h:292:1: note: previous declaration is here
dispatch_sync(dispatch_queue_t queue, DISPATCH_NOESCAPE dispatch_block_t block);
^
/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc:145:22: error: 
      conflicting types for 'dispatch_barrier_sync'
DISPATCH_INTERCEPT_B(dispatch_barrier_sync)
                     ^
/usr/include/dispatch/queue.h:1278:1: note: previous declaration is here
dispatch_barrier_sync(dispatch_queue_t queue,
^
/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/llvm/projects/compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc:162:24: error: 
      conflicting types for 'dispatch_once'
TSAN_INTERCEPTOR(void, dispatch_once, dispatch_once_t *predicate,
                       ^
/usr/include/dispatch/once.h:73:1: note: previous declaration is here
dispatch_once(dispatch_once_t *predicate,
^
3 errors generated.
make[2]: *** [projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_libdispatch_mac.cc.o] Error 1
make[1]: *** [projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/all] Error 2
make: *** [all] Error 2

我以前能够通过简单地复制和粘贴详细输出并在命令行中对其进行纠正来解决由cmake设置的错误的编译器标志,但是我不确定在这里进行什么编辑才能使事情起作用。

我试过更改-isysroot,将头文件从/ usr / include或MacOSX10.14.sdk文件复制并粘贴到llvm / include中,而持久性问题是error: conflicting types ...
我什至尝试对tsan_libdispatch_mac.cc进行较小的修改,但没有一个起作用(例如,将#include <dispatch/dispatch.h>更改为#include <dispatch.h>,将“user_alloc”更改为“user_alloc_internal” ...)。

欢迎任何建议。

安东尼

最佳答案

基本上,我必须用一种形式here替换原始的tsan_libdispatch_mac.cc。我尚未完成完整安装,而测试性能要差得多,但是我的构建现在已经超过了这一点。

关于c++ - 在tsan_libdispatch_mac.cc期间,使用cmake进行的LLVM构建失败。 “Error: conflicting types for …”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60232232/

相关文章:

c++ - CMake:构建库并将其链接到可执行文件导致 undefined reference 错误

c++ - clang:单行注释中用空格分隔的反斜杠和换行符

c++ - 切换键/c++

c++ - C++,构造函数后的冒号是什么意思?

c++ - 安卓工作室 : Trying to compile a c++ multiple libraries code with interdependencies

c++ - 如何检测我的源代码中使用了哪些 C++11 功能

c++ - 我相信这是 clang 中的一个错误,与构造函数抛出的放置新表达式有关

c++ - CMake、VTK8 和 Embarcaderos Clang 编译器

c++ - 线程工作目录

c++ - 使用类型名递归实例化模板?