-
Notifications
You must be signed in to change notification settings - Fork 479
Various build system fixes and improvements #1703
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
Conversation
|
Also: note that the coverage checks fail for this pull request because a necessary fix (in this pull request (#1702)) to the coverage test flags is not included in this pull request. That pull request fixes the flags to ensure trying to delete coverage information when it doesn't exist doesn't throw a fatal error (as it does here). |
|
Will your new build system impact other projects using SVF as a library, such as https://github.com/SVF-tools/SVF-example If so, please submit a pull request to fix their cmake on these projects. |
Thanks for this note. It looks good now |
Numerous fixes and improvements to the overall build system. Core changes include: - Moved CMake files (templates, input, etc.) into dedicated `cmake` subdirectory - Fixed relocatability of install tree (support for `cmake --install <build-dir> --install-prefix=<prefix>`) - Relocatable packages no longer depend on absolute paths of dependencies (i.e., Z3, LLVM) - SVF root, source, build, and install directories now exposed properly & correctly handle relocations - Required ABI flags of users (e.g., minimum C++ standard, PIC, etc.) now exposed through interface library (invisible) - Exported `pkconfig` package defines the core required flags - Explicit support for using SVF in-tree (i.e., building SVF from another project's `CMakeLists.txt` with `add_subdirectory(SVF)`) - Added IPO compiler support check when LTO is enabled (trying to use LTO if not supported throws a fatal error) - Required ABI flags of dependencies (i.e., Z3, LLVM) are now exposed publically on the CMake package's libraries (i.e., `SvfCore` and `SvfLLVM`; so they are inherited when using SVF with `find_package(SVF)` and `target_link_libraries(myLib <PUBLIC|PRIVATE|INTERFACE> SVF::Core SVF::LLVM)`) - Exposing SVF version to parent (i.e., updating `SVF_VERSION` defined in parent scope when adding SVF with `add_subdirectory(SVF)`) now conditional on there being a parent project to suppress warnings when not using SVF this way
Oops, it still has this error after merging your first PR. |
|
I rebased from upstream now; should pass now I think |
Thanks. Could you take a look at SVF-example and SVF courses? We may need to change their make too. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1703 +/- ##
==========================================
- Coverage 63.68% 63.67% -0.01%
==========================================
Files 244 244
Lines 25975 25980 +5
Branches 4574 4575 +1
==========================================
+ Hits 16541 16543 +2
- Misses 9434 9437 +3
🚀 New features to boost your workflow:
|
@Johanmyst, we would like to merge your build system if you could take a look and fix the above issue. Looks to me that the current build system has to work together with the projects using SVF as a lib. |
Thanks for testing & giving feedback! While some of these variables would be trivial to add back, I removed some others on purpose as they don't work well with how (modern) CMake is structured, specifically w.r.t. relocation. More specifically, CMake is typically used by (1) configuring (
While prefixes set by (1) and (2) are visible during configuration, overriding the prefix at installation (3) is not. Consequently, any paths derived from the installation prefix during configuration (i.e., when the variables you highlighted are set) could be incorrect, possibly causing issues for end-users. This is why I removed the "hardcoded" (i.e., explicitly relying on In the changes I proposed, these paths are not necessary when using the SVF CMake package. Instead, SVF's CMake package can simply be found with However, I suppose they also can't do any harm to include. I'll create a fairly simple modification to re-add those paths explicitly, including some other optimisations. I'll test it and add it to this pull request when I'm done! |
This commit incorporates the requested changes to the build system & exported variables in the SVF CMake package. Additionally, this commit contains some minor optimisations & improvements to the existing structure, such as eliminating one forgotten instance of explicitly using `$CMAKE_INSTALL_PREFIX`
|
I've integrated your requested changes and made sure all existing use cases are fully supported, please see [640b3c9] for details. The main changes are:
Please let me know if there are any other parts you'd prefer changed or would like further clarification on! NB: Should I update the "Setup guide" wiki page to reflect this installation method & usage? |
Thanks. When locating z3, can you make sure we need to first search for the executable from Z3HOME, and then the system-installed one, to avoid version issues. |
@Johanmyst thanks, would you like to make a pull request to fix the current cmake on SVF-example |
|
No problem, please see pull request #72 for the updates! Also, please note the comment I included there about SVF's NPM package. |
|
0001-fix-for-external-dependency.patch
Thank you |
I think installing public header files into a dedicated project subdirectory is actually considered better & cleaner (e.g., see #268), and fairly standard (e.g., LLVM installs its headers into Note that this only concerns the install tree. Internally, SVF still includes its own files without the SVF prefix. Users that build SVF as part of their build tree (i.e., use SVF by cloning it into their own project and adding Instead, I propose (and included in the commit) allowing users to override this behaviour with the
Their inverses were already being exposed, but I changed it the variables you requested. Also added some warning messages in case the configured mode of the LLVM instance used doesn't match SVF's build configuration (e.g., the LLVM instance used could throw an exception but the SVF build is set to explicitly not support handling exceptions). Note, by the way, that these are — when necessary — publicly exposed. As in: when a user links against SVF with
Sure, I've added explicitly searching both the |
|
@Johanmyst Thanks and merged it. |






As per @yuleisui's request in this pull request (1697), this pull request contains the various fixes, improvements, and other changes related to the build system.
If you'd like, I could add a section to the setup guide wiki page to explain installing & using SVF's CMake packages. Additionally, I could also add a new page detailing how to use SVF from within an out-of-tree LLVM pass directly from the default clang pass-pipeline (i.e., analyse & possibly modify a module using information from SVF's analyses during regular compilation (by simply adding a
--Wl,--load-pass-plugin=libSVFUser.so)?📝 Overview
This PR consolidates one orthogonal areas of work into one release:
For full details on each change, see the linked commits below.
🚀 Highlights
⚙️ Detailed Changes
1️⃣ Build System ([583bff0])
cmake/cmake --install … --install-prefix=<prefix>).pcwith core flags (less complete than the CMake package)add_subdirectory(SVF)now works transparentlySVF::Core&SVF::LLVMSVF_VERSIONin parent scope when parent CMake project exists2️⃣ CI/Workflow Fix ([96c021b])
--ignore-errors unusedto alllcov --remove …calls/usr/*or other paths3️⃣ Automated CMake Formatting ([0bc1472])
.cmake-format.pysocmake-formatcan lint & format all CMake filesCMakeLists.txt,*.cmake, etc.4️⃣ Existence-Check APIs ([ce288cf])
hasLLVMValue(),hasLHSTopLevelPtr(), etc., for getters that assert on missing entries5️⃣ WPA Backend Polymorphism ([93446f6])
VersionedFlowSensitive’sprintStat(),dumpTopLevelPtsTo(),solveAndWritePtsToFile(),readPtsFromFile(), etc., as public6️⃣ Optimised SVFG Read/Write Fix ([def7c04])