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

Update and expand examples #68

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

Conversation

Johanmyst
Copy link
Contributor

… how to use SVF from a custom LLVM pass during the default compiler pass; now shows how to use SVF from the SVF package & transient dependencies; updated READMEs and compiler commands accordingly
@jumormt
Copy link
Collaborator

jumormt commented May 16, 2024

Thanks for your contribution @Johanmyst . I am wondering whether this patch supports linking the debug version of SVF so developer can debug SVF code. Currently this function is implemented like this, which link the debug-version SVF if SVF-example is built in debug mode and release-version otherwise.

@jumormt
Copy link
Collaborator

jumormt commented May 16, 2024

Another issue is that it requires a Z3Config.cmake to be able to link with z3. However, if a user is using a z3 pre-built binary the cmake configuration will crash like this:
image
Here is the structure of z3 pre-built binary:
image

@jumormt
Copy link
Collaborator

jumormt commented May 16, 2024

I also tried building current SVF-example with your patch but get the error:
image
Although I've already set the Z3_DIR in both the environment and command line.

@Johanmyst
Copy link
Contributor Author

Thanks for your contribution @Johanmyst . I am wondering whether this patch supports linking the debug version of SVF so developer can debug SVF code. Currently this function is implemented like this, which link the debug-version SVF if SVF-example is built in debug mode and release-version otherwise.

As far as I am aware (I tested both builds) this should happen automatically. Whichever version you build, once you run cmake --install <build_dir>, it will install whatever tree was built into the specified installation prefix. The SVFConfig.cmake will be placed under <prefix>/lib/cmake/SVF/SVFConfig.cmake. As long as (if you install in a non-standard location) that directory is searched by cmake (the default prefix /usr/local is picked up automatically, but otherwise you might need to add the <prefix>/lib directory to $CMAKE_PREFIX_PATH (see this link) for it to be picked up.

Note that you could also install both build types (in separate locations) and specify whichever you want by prioritising it through the HINTS system in find_package(). If you were to install the Release-build into prefix A, and the Debug-build into prefix B, you could prioritise either build type like this: find_package(SVF CONFIG REQUIRED HINTS ${PREFIX_A}). The HINTS paths are searched before others, so this would ensure the desired version is found first.

If you encounter issues with this, please let me know as in my tests this seemed to work perfectly fine!

@Johanmyst
Copy link
Contributor Author

Another issue is that it requires a Z3Config.cmake to be able to link with z3. However, if a user is using a z3 pre-built binary the cmake configuration will crash like this: image Here is the structure of z3 pre-built binary: image

Ah, this is because the pre-built Z3 libraries don't seem to come with the cmake package files. I thought I addressed this in this commit (#1460).

In that commit I made the Z3 CMake package non-mandatory; if it was not found I simply applied the "old way" of searching for the Z3 files manually. I used find_dependency() in the SVFConfig.cmake.in file, which according to its documentation should mirror the original find_package() call's signature (i.e. if the original find_package(Z3) was called without REQUIRED, this call shouldn't use REQUIRED either. In that case it should just revert back to how Z3 was found previously.

Was the SVF build you were using when you saw this error including this last commit (#1460)? If so, I could just replace the find_dependency() call with an explicit find_package() call without the REQUIRED marker.

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