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

Trouble making CUDD bindings work on MacOS (zdd doesn't at all) #96

Open
clintolsen opened this issue Nov 30, 2024 · 3 comments
Open

Trouble making CUDD bindings work on MacOS (zdd doesn't at all) #96

clintolsen opened this issue Nov 30, 2024 · 3 comments

Comments

@clintolsen
Copy link

clintolsen commented Nov 30, 2024

I have CUDD installed as a port in /opt and it doesn't seem to have any build options that would break this.

Using the instructions in the README.md, none of that worked for me (DD_FETCH, DD_CUDD). I had to do this to actually get it to build:

CFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./python/bin/pip install dd --no-cache-dir --upgrade --verbose

This leaves me with something that can load dd.cudd however, none of the zdd stuff works:

Traceback (most recent call last):
  File "/Users/clint/Documents/dd/./test2", line 3, in <module>
    from dd.cudd_zdd import ZDD
ModuleNotFoundError: No module named 'dd.cudd_zdd'

I don't see any Zdd symbols in the resultant .so file, so I'm guessing this is not getting compiled.

@clintolsen clintolsen changed the title Trouble making CUDD bindings work on MacOS (ZDD doesn't at all) Trouble making CUDD bindings work on MacOS (zdd doesn't at all) Nov 30, 2024
@johnyf
Copy link
Member

johnyf commented Nov 30, 2024

Building the module dd.cudd_zdd requires also DD_CUDD_ZDD=1 (DD_CUDD=1 builds dd.cudd which is for BDDs). https://github.com/tulip-control/dd/blob/main/doc.md#environment-variables-that-activate-c-extensions

@johnyf
Copy link
Member

johnyf commented Nov 30, 2024

Now on branch ci_macos, both dd.cudd and dd.cudd_zdd are built and tested successfully on the image macos-14-arm64, which is macos-latest in GitHub Actions:

CUDD's configuration summary includes Build system : arm-apple-darwin23.6.0.

The change needed to compile dd.cudd and dd.cudd_zdd on this architecture was omitting -mtune=native (apparently native became apple-m1, which raised an error on this architecture):

diff --git a/download.py b/download.py
index 88f09871..d5e68cde 100644
--- a/download.py
+++ b/download.py
@@ -51,7 +51,7 @@ CUDD_CFLAGS = [
     '-std=c99',
     '-DBSD',
     '-DHAVE_IEEE_754',
-    '-mtune=native', '-pthread', '-fwrapv',
+    '-pthread', '-fwrapv',
     '-fno-strict-aliasing',
     '-Wall', '-W', '-O3']
 sizeof_long = ctypes.sizeof(ctypes.c_long)

This build is with DD_FETCH=1 DD_CUDD=1 DD_CUDD_ZDD=1.

@clintolsen
Copy link
Author

Thanks, setting DD_CUDD_ZDD=1 did work for me.

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

No branches or pull requests

2 participants