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

Apron wrapper for PPLite 0.12. #105

Merged
merged 28 commits into from
May 29, 2024
Merged

Conversation

ezaffanella
Copy link
Contributor

PPLite version 0.12 no longer depends on gmpxx (the C++ interface of GMP).

Note: we also applied a minor renaming to newpolka matrix_* type and functions (adding prefix "pk_") so as to avoid a few name clashes with version 3 of the FLINT library, which is a required dependency of PPLite. Both newpolka and FLINT v.3 have functions named "matrix_clear" and "matrix_equal", thereby preventing static linking of Apron and PPLite when using the newer version of FLINT. Fix contributed by Michele Spotti.

@antoinemine
Copy link
Owner

Thanks for the PR!

I tried it although I still havePPLite 0.11 (not 0.12) and I get errors in pplite_user.hh:

In file included from pplite_user.cc:16:
pplite_user.hh: In function 'void pplite::apron::to_scalar(ap_scalar_t*, const pplite::Integer&)':
pplite_user.hh:50:5: error: 'const pplite::Integer' {aka 'const class pplite::FLINT_Integer'} has no member named 'get_mpz'
   50 |   i.get_mpz(mpq_numref(s->val.mpq));
      |     ^~~~~~~
pplite_user.hh: In function 'void pplite::apron::to_scalar(ap_scalar_t*, const pplite::Integer&, const pplite::Integer&)':
pplite_user.hh:59:5: error: 'const pplite::Integer' {aka 'const class pplite::FLINT_Integer'} has no member named 'get_mpz'
   59 |   n.get_mpz(mpq_numref(s->val.mpq));
      |     ^~~~~~~
pplite_user.hh:60:5: error: 'const pplite::Integer' {aka 'const class pplite::FLINT_Integer'} has no member named 'get_mpz'
   60 |   d.get_mpz(mpq_denref(s->val.mpq));
      |     ^~~~~~~
pplite_user.hh: In function 'void pplite::apron::to_scalar(ap_scalar_t*, const pplite::Rational&)':
pplite_user.hh:68:5: error: 'const pplite::Rational' {aka 'const class pplite::FLINT_Rational'} has no member named 'get_mpq'
   68 |   r.get_mpq(s->val.mpq);
      |     ^~~~~~~

Is this expected? Do you have a plan so that the binding works with both versions 0.11and 0.12, or would it be unadvisable?

@ezaffanella
Copy link
Contributor Author

It was expected, as the PPLite's interface has changed.
But you are right: we should detect the PPLite's version at configuration time and add a few (conditionally compiled) helpers to make it work for both 0.11 and 0.12. We will provide an updated PR.

@antoinemine
Copy link
Owner

Thanks, that'd be perfect! Alternatively, if it makes more sense to make it work only for 0.12, it's also OK, but the configure should nevertheless check the PPLite version and disable PPLite support if an earlier version is detected.

(Maybe) Define macro HAVE_PPLITE_0_11 at configuration time.
Added a couple of backward compatibility helpers.
@antoinemine
Copy link
Owner

Thanks!
In get_pplite_version, I think that you need to change $cxx into $cxx $cxxflags $deps (both time).

@antoinemine
Copy link
Owner

Sorry, another thing: I think that PPLITE_PREFIX should be pplite_prefix in get_pplite_version, as it is the output of checkprefix (which may contain PPLITE_PREFIX if specified, but might discover another working prefix even if PPLITE_PREFIX is empty).

@ezaffanella
Copy link
Contributor Author

Done, thank you.

@antoinemine
Copy link
Owner

Thank you very much! I think this is ready to be merged.

@antoinemine antoinemine merged commit 86c2279 into antoinemine:master May 29, 2024
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