[llvm] 00dc72f - [CAS] LLVM_ENABLE_ONDISK_CAS requires `flock` on UNIX (#159207)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 09:52:40 PDT 2025
Author: Steven Wu
Date: 2025-09-17T16:52:36Z
New Revision: 00dc72fa1f328ae52554c5d404460de7381cb7f7
URL: https://github.com/llvm/llvm-project/commit/00dc72fa1f328ae52554c5d404460de7381cb7f7
DIFF: https://github.com/llvm/llvm-project/commit/00dc72fa1f328ae52554c5d404460de7381cb7f7.diff
LOG: [CAS] LLVM_ENABLE_ONDISK_CAS requires `flock` on UNIX (#159207)
As a follow up to #159122, after figure out reason why CAS unit tests
are failing on Solaris, update the CMake configuration to build ondisk
CAS implementation. We now check the existance of `flock` before
enabling the configuration.
In the future, we can find ways to support OnDiskCAS on other platforms
that do not have `flock`. This can techinically be done with a POSIX
compilant file lock but that will put a restriction on the usage of CAS.
Added:
Modified:
llvm/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 9eacbc2b5abb5..b98192968a3ab 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -879,13 +879,6 @@ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
option (LLVM_ENABLE_TELEMETRY "Enable the telemetry library. If set to OFF, library cannot be enabled after build (eg., at runtime)" ON)
-set(LLVM_ENABLE_ONDISK_CAS_default ON)
-if("${CMAKE_SYSTEM_NAME}" MATCHES SunOS)
- # Build OnDiskCAS by default only on non-Solaris machines.
- set(LLVM_ENABLE_ONDISK_CAS_default OFF)
-endif()
-option(LLVM_ENABLE_ONDISK_CAS "Build OnDiskCAS." ${LLVM_ENABLE_ONDISK_CAS_default})
-
set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
CACHE STRING "Doxygen-generated HTML documentation install directory")
set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/ocaml-html"
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 52a64afa135d0..24142c934b918 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1469,3 +1469,11 @@ if(LLVM_ENABLE_LLVM_LIBC)
message(WARNING "Unable to link against LLVM libc. LLVM will be built without linking against the LLVM libc overlay.")
endif()
endif()
+
+check_symbol_exists(flock "sys/file.h" HAVE_FLOCK)
+set(LLVM_ENABLE_ONDISK_CAS_default OFF)
+if(HAVE_FLOCK OR LLVM_ON_WIN32)
+ # LLVM OnDisk CAS currently requires flock on Unix.
+ set(LLVM_ENABLE_ONDISK_CAS_default ON)
+endif()
+option(LLVM_ENABLE_ONDISK_CAS "Build OnDiskCAS." ${LLVM_ENABLE_ONDISK_CAS_default})
More information about the llvm-commits
mailing list