You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by zh...@apache.org on 2023/03/14 03:14:50 UTC
[kudu] branch master updated: [codegen] fix build on Ubuntu 22.04
This is an automated email from the ASF dual-hosted git repository.
zhangyifan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 8ee73765f [codegen] fix build on Ubuntu 22.04
8ee73765f is described below
commit 8ee73765fb78c246d3455029cdf02e15eac28926
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Sun Mar 5 08:13:05 2023 -0800
[codegen] fix build on Ubuntu 22.04
Change-Id: If65f02b169098afec0d5682a7be6066568420982
Reviewed-on: http://gerrit.cloudera.org:8080/19582
Tested-by: Alexey Serbin <al...@apache.org>
Reviewed-by: Ashwani Raina <ar...@cloudera.com>
Reviewed-by: Wang Xixu <14...@qq.com>
Reviewed-by: Yifan Zhang <ch...@163.com>
---
src/kudu/codegen/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/src/kudu/codegen/CMakeLists.txt b/src/kudu/codegen/CMakeLists.txt
index eb32a41d5..28c96064f 100644
--- a/src/kudu/codegen/CMakeLists.txt
+++ b/src/kudu/codegen/CMakeLists.txt
@@ -106,6 +106,47 @@ if (APPLE)
${PREFIXED_IR_INCLUDES}
-isysroot "${CMAKE_OSX_SYSROOT}")
endif()
+else()
+ # Capture multi-line output of the preprocessor, joining stdout and stderr.
+ # The relevant part of the output looks like the following:
+ #
+ # #include "..." search starts here:
+ # #include <...> search starts here:
+ # /usr/include/c++/11
+ # /usr/include/x86_64-linux-gnu/c++/11
+ # /usr/include/c++/11/backward
+ # /usr/lib/gcc/x86_64-linux-gnu/11/include
+ # /usr/local/include
+ # /usr/include/x86_64-linux-gnu
+ # /usr/include
+ # End of search list.
+ execute_process(
+ COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E -Wp,-v /dev/null
+ ERROR_VARIABLE CXX_CPP_DIRS_VAR
+ OUTPUT_VARIABLE CXX_CPP_DIRS_VAR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE CXX_CPP_DIRS_EXIT_CODE)
+ if (NOT ${CXX_CPP_DIRS_CMD_EXIT_CODE} EQUAL 0)
+ message(FATAL_ERROR "failed to get preprocessor builtin directories")
+ endif()
+
+ # Use only the first two include paths: usually, that's enough.
+ # Using all the reported include paths might confuse codegen.
+ execute_process(
+ COMMAND echo ${CXX_CPP_DIRS_VAR}
+ COMMAND sed -n "s|^ ||p"
+ COMMAND head -2
+ COMMAND paste -s -d "\;"
+ RESULT_VARIABLE CXX_CPP_EXTRA_INCLUDE_DIRS_EXIT_CODE
+ OUTPUT_VARIABLE CXX_CPP_EXTRA_INCLUDE_DIRS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (${CXX_CPP_EXTRA_INCLUDE_DIRS_EXIT_CODE} EQUAL 0)
+ foreach(dir ${CXX_CPP_EXTRA_INCLUDE_DIRS})
+ set(PREFIXED_IR_INCLUDES ${PREFIXED_IR_INCLUDES} -I${dir})
+ endforeach()
+ else()
+ message(FATAL_ERROR "failed to deduce path to libc++ headers")
+ endif()
endif()
# Get preprocessing definitions, which enable directives for glog and gtest.