Compiler-rt on arch linux with clang++: dd_interceptors.cpp:225:20: error: redefinition of 'realpath'

anybody saw such an error already? building compiler-rt with clang, clang++ on arch linux fails with this error message, but it builds with g++:

/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp:225:20: error: redefinition of 'realpath'

compiler-rt is packaged and built for arch linux without patching, but it builds with gnu.

the whole error message:

1/1][100%][0.340s] Cleaning all built files...
Cleaning... 1004 files.
[1569/1688][ 92%][4697.448s] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/CodeComplete.cpp.o
/src/swift-language-git/src/llvm-project/clang-tools-extra/clangd/CodeComplete.cpp:80:11: warning: enumeration value 'CommentTag' not handled in switch [-Wswitch]
switch (Kind) {
^
1 warning generated.
[1585/1688][ 93%][4744.150s] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Protocol.cpp.o
/src/swift-language-git/src/llvm-project/clang-tools-extra/clangd/Protocol.cpp:231:11: warning: enumeration value 'CommentTag' not handled in switch [-Wswitch]
switch (Kind) {
^
1 warning generated.
[1586/1688][ 93%][4745.381s] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Quality.cpp.o
/src/swift-language-git/src/llvm-project/clang-tools-extra/clangd/Quality.cpp:119:11: warning: enumeration value 'CommentTag' not handled in switch [-Wswitch]
switch (D.Kind) {
^
1 warning generated.
[1677/1688][ 99%][4998.909s] Performing build step for 'compiler-rt'
[1005/1355][ 74%][83.818s] Building CXX object lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o
FAILED: lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o
/src/swift-language-git/src/build/Ninja-ReleaseAssert/llvm-linux-x86_64/./bin/clang++ -I/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/../.. -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG -m64 -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -MD -MT lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o -MF lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o.d -o lib/tsan/dd/CMakeFiles/clang_rt.dd-x86_64.dir/dd_interceptors.cpp.o -c /src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp:225:1: warning: attribute declaration must precede definition [-Wignored-attributes]
INTERCEPTOR(char*, realpath, const char *path, char *resolved_path) {
^
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/../../interception/interception.h:229:3: note: expanded from macro 'INTERCEPTOR'
DECLARE_WRAPPER(ret_type, func, _VA_ARGS_) \
^
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/../../interception/interception.h:154:20: note: expanded from macro 'DECLARE_WRAPPER'
_attribute((weak, alias("interceptor" #func), visibility("default")));
^
/usr/include/bits/stdlib.h:37:8: note: previous definition is here
_NTH (realpath (const char *restrict __name, char *_restrict __resolved))
^
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp:225:20: error: redefinition of 'realpath'
INTERCEPTOR(char*, realpath, const char *path, char *resolved_path) {
^
/usr/include/bits/stdlib.h:37:8: note: previous definition is here
_NTH (realpath (const char *restrict __name, char *_restrict __resolved))
^
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/dd_interceptors.cpp:225:1: warning: attribute declaration must precede definition [-Wignored-attributes]
INTERCEPTOR(char*, realpath, const char *path, char *resolved_path) {
^
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/../../interception/interception.h:229:3: note: expanded from macro 'INTERCEPTOR'
DECLARE_WRAPPER(ret_type, func, _VA_ARGS_) \
^
/src/swift-language-git/src/llvm-project/compiler-rt/lib/tsan/dd/../../interception/interception.h:154:57: note: expanded from macro 'DECLARE_WRAPPER'
_attribute((weak, alias("interceptor" #func), visibility("default")));
^
/usr/include/bits/stdlib.h:37:8: note: previous definition is here
_NTH (realpath (const char *restrict __name, char *_restrict __resolved))
^
2 warnings and 1 error generated.
[1010/1355][ 74%][89.389s] Building CXX object lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_interceptors_posix.cpp.o
ninja: build stopped: subcommand failed.
[1685/1688][ 99%][5035.713s] Linking CXX executable bin/c-index-test
FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-build
cd /src/swift-language-git/src/build/Ninja-ReleaseAssert/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-bins && /usr/bin/cmake --build . && /usr/bin/cmake -E touch /src/swift-language-git/src/build/Ninja-ReleaseAssert/llvm-linux-x86_64/tools/clang/runtime/compiler-rt-stamps//compiler-rt-build
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

==> ERROR: A failure occurred in build().
Aborting...

Terms of Service

Privacy Policy

Cookie Policy