Skip to content

Commit f8983a6

Browse files
sarnexkbenzie
authored andcommitted
Fix build with libc++ (#19521)
We previously added support for building `libsycl` individually with `libc++`. At that time, `libsycl` didn't link against `libLLVM` so they did not need to be using the same STL implementation. Now, `libsycl` does link against `libLLVM`, one example [here](https://github.com/intel/llvm/blob/sycl/sycl/source/CMakeLists.txt#L98). Remove all the code that was to support `libsycl` in particular and just make it work with the normal option LLVM uses, `LLVM_ENABLE_LIBCXX`. Most of the code I added actually checks `LLVM_LIBCXX_USED`, because LLVM checks at configure time if `libc++` actually works even when passed `LLVM_ENABLE_LIBCXX`, and if it fails, it falls back to `libstdc++`, and most of the time we actually want to know if we are actually using `libc++`. I added a CMake option `SYCL_LIBDEVICE_CXX_FLAGS` to set the flags for libdevice because it will be required if someone doesn't use the LLVM option and just does it through `CMAKE_CXX_FLAGS`, as those aren't used for libdevice but it still uses the STL. The two changes in `unified-runtime/source/loader/layers/sanitizer/msan/msan_libdevice.hpp` and `sycl/source/builtins/common_functions.cpp` fix compile errors with `libc++`. I also plan to add a job to the nightly to lock this down. intel/llvm#19347 --------- Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
1 parent 0679ee4 commit f8983a6

2 files changed

Lines changed: 1 addition & 11 deletions

File tree

source/loader/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,10 @@ if(UR_ENABLE_SANITIZER)
211211
# In in-tree build, if LLVM is built with libc++, we also need to build
212212
# symbolizer.cpp with libc++ abi and link libc++ in.
213213
if(NOT UR_STANDALONE_BUILD AND LLVM_LIBCXX_USED)
214-
execute_process(
215-
COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libc++.a
216-
OUTPUT_VARIABLE LIBCXX_PATH
217-
OUTPUT_STRIP_TRAILING_WHITESPACE)
218-
execute_process(
219-
COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libc++abi.a
220-
OUTPUT_VARIABLE LIBCXX_ABI_PATH
221-
OUTPUT_STRIP_TRAILING_WHITESPACE)
222214
set_property(SOURCE
223215
${symbolizer_sources}
224216
APPEND_STRING PROPERTY COMPILE_FLAGS
225217
" -stdlib=libc++ ")
226-
if(NOT EXISTS ${LIBCXX_PATH} OR NOT EXISTS ${LIBCXX_ABI_PATH})
227-
message(FATAL_ERROR "libc++ is required but can't find the libraries")
228-
endif()
229218
# Link with gcc_s fisrt to avoid some symbols resolve to libc++/libc++abi/libunwind's one
230219
target_link_libraries(ur_loader PRIVATE gcc_s ${LIBCXX_PATH} ${LIBCXX_ABI_PATH})
231220
endif()

source/loader/layers/sanitizer/msan/msan_libdevice.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#pragma once
1515

1616
#include "sanitizer_common/sanitizer_libdevice.hpp"
17+
#include <cstddef>
1718

1819
#if !defined(__SPIR__) && !defined(__SPIRV__)
1920
namespace ur_sanitizer_layer {

0 commit comments

Comments
 (0)