Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

CPPFLAGS="-D_FORTIFY_SOURCE=2" breaks compiler-rt with clang++, only with gnu c++: realpath redefinition #46132

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR47163
Status NEW
Importance P release blocker
Reported by solo turn (soloturn@gmail.com)
Reported on 2020-08-13 19:54:18 -0700
Last modified on 2020-09-12 12:42:42 -0700
Version unspecified
Hardware PC Linux
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
am trying to create a swift-lang package for arch linux, with a continuous
build here: https://github.com/soloturn/swift-aur/actions

funny is that on arch linux which first has newest packages, and second, dev
packages do not exist, there is just one package including the developer
version in many cases.

compiler-rt can be built with g++, but using clang++ fails

$ export CC=clang
$ export CC=clang
$ makepkg -s

and it really gives the same error when compiling swift.

/usr/bin/clang++  -I../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
../lib/tsan/dd/dd_interceptors.cpp
../lib/tsan/dd/dd_interceptors.cpp:225:1: warning: attribute declaration must
precede definition [-Wignored-attributes]

__NTH (realpath (const char *__restrict __name, char *__restrict __resolved))
       ^
../lib/tsan/dd/dd_interceptors.cpp:225:20: error: redefinition of 'realpath'

see here the original bug report towards swift:
https://bugs.swift.org/browse/SR-13082
Quuxplusone commented 4 years ago
the export needs to be

$ export CC=clang
$ export CXX=clang++
$ makepkg -s

then it fails. if the variables are not set it takes the default, g++, and
compiles.

the command executed can be seen in the PKGBUILD file,
https://github.com/archlinux/svntogit-packages/blob/packages/compiler-rt/trunk/PKGBUILD

cd "$srcdir/$pkgname-$pkgver.src/build"
cmake .. -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/usr
ninja
Quuxplusone commented 4 years ago
unsetting the arch linux default flag:
CPPFLAGS="-D_FORTIFY_SOURCE=2"

makes it build.