Skip to content

[SYCL][UR] Fix build with libc++ #19521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from
Open

[SYCL][UR] Fix build with libc++ #19521

wants to merge 1 commit into from

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Jul 18, 2025

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.

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.

#19347

OUTPUT_VARIABLE LIBCXX_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} --print-file-name=libc++abi.a
Copy link
Contributor Author

@sarnex sarnex Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change here is because --print-file-name doesn't work as required here so the lookup always fails, so just fall back to the underlyting compiler's errors.

@sarnex sarnex temporarily deployed to WindowsCILock July 21, 2025 15:50 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock July 21, 2025 15:50 — with GitHub Actions Inactive
@sarnex sarnex marked this pull request as ready for review July 21, 2025 18:13
@sarnex sarnex requested review from a team as code owners July 21, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants