You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by da...@apache.org on 2018/05/10 22:53:47 UTC
[3/3] kudu git commit: thirdparty: tweak clang compiler flags
thirdparty: tweak clang compiler flags
Prior to this small tweak the thirdparty clang build output thousands of
warnings similar to this one when compiling with clang:
Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/LazyValueInfo.cpp.o
clang: warning: -Wl,-rpath,/Users/dan/src/cpp/kudu/thirdparty/installed/uninstrumented/lib: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/Users/dan/src/cpp/kudu/thirdparty/installed/uninstrumented/lib' [-Wunused-command-line-argument]
Change-Id: Ide4ddbff14d3745c6f2c2f9b14b00da790a6cec6
Reviewed-on: http://gerrit.cloudera.org:8080/10352
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/3855328b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/3855328b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/3855328b
Branch: refs/heads/master
Commit: 3855328b73c28d9ce4dbe5e1773bd6abde2e935a
Parents: 07d6b5f
Author: Dan Burkert <da...@apache.org>
Authored: Tue May 8 17:00:22 2018 -0700
Committer: Dan Burkert <da...@apache.org>
Committed: Thu May 10 22:53:24 2018 +0000
----------------------------------------------------------------------
thirdparty/build-definitions.sh | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/3855328b/thirdparty/build-definitions.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index fe3f477..ebb4f72 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -252,6 +252,11 @@ build_llvm() {
TOOLS_ARGS="$TOOLS_ARGS -D${arg}=OFF"
done
+ # Remove '-nostdinc++' from the cflags for clang, since it already
+ # handles this when passing --stdlib=libc++ and passing this confuses
+ # the check for -fPIC.
+ CLANG_CXXFLAGS=$(echo "$EXTRA_CXXFLAGS" | sed -e 's,-nostdinc++,,g;')
+
case $BUILD_TYPE in
"normal")
# Default build: core LLVM libraries, clang, compiler-rt, and all tools.
@@ -269,6 +274,15 @@ build_llvm() {
if [ -n "$GCC_INSTALL_PREFIX" ]; then
TOOLS_ARGS="$TOOLS_ARGS -DGCC_INSTALL_PREFIX=$GCC_INSTALL_PREFIX"
fi
+
+ # Depend on zlib from the thirdparty tree. It's an optional dependency for
+ # LLVM, but a required [1] one for IWYU. When TSAN is enabled these flags
+ # are already set by build-thirdparty.sh in order to support the
+ # thirdparty libc++, so it's not necessary to set them again.
+ #
+ # 1. https://github.com/include-what-you-use/include-what-you-use/issues/539
+ CLANG_CXXFLAGS="$CLANG_CXXFLAGS -I$PREFIX/include"
+ CLANG_LDFLAGS="$CLANG_LDFLAGS -L$PREFIX/lib -Wl,-rpath,$PREFIX/lib"
;;
"tsan")
# Build just the core LLVM libraries, dependent on libc++.
@@ -303,18 +317,6 @@ build_llvm() {
$PREFIX/lib/clang/ \
$PREFIX/lib/cmake/{llvm,clang}
- # Remove '-nostdinc++' from the cflags for clang, since it already
- # handles this when passing --stdlib=libc++ and passing this confuses
- # the check for -fPIC.
- CLANG_CXXFLAGS=$(echo "$EXTRA_CXXFLAGS" | sed -e 's,-nostdinc++,,g;')
-
- # Depend on zlib from the thirdparty tree. It's an optional dependency for
- # LLVM, but a required [1] one for IWYU.
- #
- # 1. https://github.com/include-what-you-use/include-what-you-use/issues/539
- CLANG_CXXFLAGS="$CLANG_CXXFLAGS -I$PREFIX/include"
- CLANG_LDFLAGS="$EXTRA_LDFLAGS -L$PREFIX/lib -Wl,-rpath,$PREFIX/lib"
-
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
@@ -324,7 +326,8 @@ build_llvm() {
-DLLVM_INCLUDE_UTILS=OFF \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_RTTI=ON \
- -DCMAKE_CXX_FLAGS="$CLANG_CXXFLAGS $CLANG_LDFLAGS" \
+ -DCMAKE_CXX_FLAGS="$CLANG_CXXFLAGS $EXTRA_LDFLAGS" \
+ -DCMAKE_EXE_LINKER_FLAGS="$CLANG_LDFLAGS" \
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
$TOOLS_ARGS \
$EXTRA_CMAKE_FLAGS \