Skip to content
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

Try to fix CMake for ZStd. #575

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
[submodule "vendor/vast/src"]
path = vendor/vast/src
url = https://github.com/trailofbits/vast.git
branch = mx_codegen
Copy link
Member

Choose a reason for hiding this comment

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

Is mx_codegen branch is maintained? Why not built with master branch and merge required changes from mx_codegen?

Copy link
Member

Choose a reason for hiding this comment

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

That will require multiplier to switch to llvm 19.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a brief attempt in 2024 to update to latest VAST, but there were a lot of issues because it started using C++ ranges heavily in a few places, and the Clang patches for PASTA/Multiplier patches fell over on them. There were other issues, even after commenting out the relevant code in VAST. Eventually I got too busy with Patchestry and gave up. I think the proper solution in the future is to re-do all or parts of Multiplier's bootstrap, but using "plain old Clang", rather than PASTA. It's also possible that there's a simple fix. Something about PASTA's Run.cpp is potentiall off.

[submodule "vendor/intervaltree/src"]
path = vendor/intervaltree/src
url = https://github.com/ekg/intervaltree.git
45 changes: 31 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,43 @@ if(NOT TARGET gflags::gflags)
endif()
endif()

find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
find_package(CapnProto CONFIG REQUIRED)
find_package(xxHash CONFIG REQUIRED)
find_package(zstd CONFIG REQUIRED)
find_package(Filesystem REQUIRED COMPONENTS Final Experimental GLOBAL)
find_package(CapnProto CONFIG REQUIRED GLOBAL)
find_package(xxHash CONFIG REQUIRED GLOBAL)
find_package(zstd CONFIG REQUIRED GLOBAL)

find_path(ZSTD_INCLUDE_DIRS
NAMES zstd.h
HINTS "${MX_VENDOR_INSTALL_DIR}/${MX_INSTALL_INCLUDE_DIR}"
"${CMAKE_INSTALL_PREFIX}/${MX_INSTALL_INCLUDE_DIR}")

find_library(ZSTD_LIBRARIES
NAMES zstd
HINTS "${MX_VENDOR_INSTALL_DIR}/${MX_INSTALL_LIB_DIR}"
"${CMAKE_INSTALL_PREFIX}/${MX_INSTALL_LIB_DIR}")

if(NOT TARGET zstd::libzstd_static)
message(FATAL_ERROR "Cannot find appropriate static zstd target; known targets are ${zstd_LIBRARIES}")
add_library(zstd::libzstd_static STATIC IMPORTED)
set_target_properties(zstd::libzstd_static PROPERTIES
INTERFACE_COMPILE_FEATURES "cxx_std_${CMAKE_CXX_STANDARD}"
INTERFACE_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIRS}
INTERFACE_LINK_LIBRARIES ${ZSTD_LIBRARIES}
)
endif()

if(NOT TARGET zstd::zstd)
add_library(zstd::zstd ALIAS zstd::libzstd_static)
endif()

find_package(gap CONFIG REQUIRED)
find_package(Clang CONFIG REQUIRED)
find_package(pasta CONFIG REQUIRED)
find_package(glog CONFIG REQUIRED)
find_package(reproc++ CONFIG REQUIRED)
find_package(RocksDB CONFIG REQUIRED)
find_package(LLVM CONFIG REQUIRED)
find_package(MLIR CONFIG REQUIRED)
find_package(VAST CONFIG REQUIRED)
find_package(gap CONFIG REQUIRED GLOBAL)
find_package(glog CONFIG REQUIRED GLOBAL)
find_package(reproc++ CONFIG REQUIRED GLOBAL)
find_package(RocksDB CONFIG REQUIRED GLOBAL)
find_package(LLVM CONFIG REQUIRED GLOBAL)
find_package(MLIR CONFIG REQUIRED GLOBAL)
find_package(VAST CONFIG REQUIRED GLOBAL)
find_package(Clang CONFIG REQUIRED GLOBAL)
find_package(pasta CONFIG REQUIRED GLOBAL)

include("cmake/mlir.cmake")
include("cmake/vast.cmake")
Expand Down
5 changes: 1 addition & 4 deletions vendor/llvm-project/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ if(NOT MX_USE_VENDORED_CLANG)
endif()
endif()

find_package(zstd CONFIG REQUIRED QUIET HINTS "${MX_VENDOR_INSTALL_DIR}")

set(src_dir "${CMAKE_CURRENT_LIST_DIR}/src")
set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/build")

Expand Down Expand Up @@ -93,9 +91,8 @@ execute_process(COMMAND ${CMAKE_COMMAND}
-DLLVM_INCLUDE_TESTS:BOOL=OFF
-DLLVM_INCLUDE_TOOLS:BOOL=ON
-DLLVM_INSTALL_UTILS:BOOL=ON
-DLLVM_ENABLE_ZSTD:BOOL=ON
-DLLVM_ENABLE_ZSTD:BOOL=OFF
-DLLVM_ENABLE_LLD:BOOL=${LLVM_ENABLE_LLD}
"-Dzstd_DIR=${zstd_DIR}"
"${src_dir}/llvm"
WORKING_DIRECTORY "${build_dir}")

Expand Down
Loading