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

Build Z3 from source for P4Tools. #4697

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Build Z3 from source for P4Tools. #4697

wants to merge 2 commits into from

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented May 31, 2024

Fixes #4693.

@fruffy fruffy added the p4tools Topics related to the P4Tools back end label May 31, 2024
@fruffy fruffy force-pushed the fruffy/z3_source branch 8 times, most recently from 5ba0346 to 156b925 Compare May 31, 2024 21:18
@jafingerhut
Copy link
Contributor

I have no urgency for this issue, but if I understand correctly that with this change, then building p4c will by default fetch z3 source code of a particular desired version and build it from source code, then as long as that version also compiles and works for arm64 processors (e.g. Apple Silicon running arm64/aarch64 Linux in a VM), it would slightly simplify the work of those building P4 tools for that processor ach.

@fruffy
Copy link
Collaborator Author

fruffy commented Jun 19, 2024

I have no urgency for this issue, but if I understand correctly that with this change, then building p4c will by default fetch z3 source code of a particular desired version and build it from source code, then as long as that version also compiles and works for arm64 processors (e.g. Apple Silicon running arm64/aarch64 Linux in a VM), it would slightly simplify the work of those building P4 tools for that processor ach.

Yes! It also allows us to finally upgrade Z3 in tools and fix some of the segmentation fault problems. But there is still some work to do.

set(P4TOOLS_Z3_INCLUDE_DIR ${Z3_INCLUDE_DIR})
else()
# Pull in a specific version of Z3 and link against it.
set(P4TOOLS_Z3_VERSION "4.13.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems odd that Z#_MAX_VERSION_EXCL above is 4.12, but you are explicitly pulling in 4.13.0 here. Do you expect one of those two things to change before this PR is ready to merge?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Z3 versions above 4.12 added malloc_usable_size which causes problems with P4C's garbage collector. I have not figured out a fix for BDWGC yet.

When we build from scratch we do not have this problem because we can patch the Z3 installation.

Copy link
Contributor

Choose a reason for hiding this comment

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

That should be a comment clarifying that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is some more work to be done first, need to figure out whether it is possible to patch bdwgc instead.

@fruffy fruffy force-pushed the fruffy/z3_source branch 3 times, most recently from f0758ff to 65a13ee Compare August 5, 2024 07:58
@fruffy fruffy force-pushed the fruffy/z3_source branch 4 times, most recently from 7c2aae3 to 3cd7652 Compare August 15, 2024 09:34
fruffy and others added 2 commits August 30, 2024 11:44
* Remove a stray print in the smith code. (#4891)

Signed-off-by: fruffy <[email protected]>

* Make isSystemFile part of the parser options.

Signed-off-by: fruffy <[email protected]>

* Review comments.

Signed-off-by: fruffy <[email protected]>

---------

Signed-off-by: fruffy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4tools Topics related to the P4Tools back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BDWGC and Z3 interact badly
3 participants