Skip to content

Commit 00dc72f

Browse files
[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.
1 parent 5f8bce4 commit 00dc72f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

llvm/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -879,13 +879,6 @@ option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
879879
option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
880880
option (LLVM_ENABLE_TELEMETRY "Enable the telemetry library. If set to OFF, library cannot be enabled after build (eg., at runtime)" ON)
881881

882-
set(LLVM_ENABLE_ONDISK_CAS_default ON)
883-
if("${CMAKE_SYSTEM_NAME}" MATCHES SunOS)
884-
# Build OnDiskCAS by default only on non-Solaris machines.
885-
set(LLVM_ENABLE_ONDISK_CAS_default OFF)
886-
endif()
887-
option(LLVM_ENABLE_ONDISK_CAS "Build OnDiskCAS." ${LLVM_ENABLE_ONDISK_CAS_default})
888-
889882
set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
890883
CACHE STRING "Doxygen-generated HTML documentation install directory")
891884
set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/ocaml-html"

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,3 +1469,11 @@ if(LLVM_ENABLE_LLVM_LIBC)
14691469
message(WARNING "Unable to link against LLVM libc. LLVM will be built without linking against the LLVM libc overlay.")
14701470
endif()
14711471
endif()
1472+
1473+
check_symbol_exists(flock "sys/file.h" HAVE_FLOCK)
1474+
set(LLVM_ENABLE_ONDISK_CAS_default OFF)
1475+
if(HAVE_FLOCK OR LLVM_ON_WIN32)
1476+
# LLVM OnDisk CAS currently requires flock on Unix.
1477+
set(LLVM_ENABLE_ONDISK_CAS_default ON)
1478+
endif()
1479+
option(LLVM_ENABLE_ONDISK_CAS "Build OnDiskCAS." ${LLVM_ENABLE_ONDISK_CAS_default})

0 commit comments

Comments
 (0)