arminbiere / cadical

CaDiCaL SAT Solver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support shared library in build system

rayegun opened this issue · comments

Hi!
I wanted to request the ability to build a shared library (.so, .dll etc) using the built in build system, alongside the static library and executables.

I can dig into the build system and try to add this, but if it's something you can do easily I'd much appreciate it! It'd be great if Kissat and Satch also supported this (hopefully for both the IPASIR and full C++ libraries. CryptoMiniSAT does this with a libcryptominisat and libcryptominisat_simple I believe).

I can port this from Kissat, where a similar feature, was added, but we are in the middle of "FMCAD'21" release and that has higher priority. So this will take at least one more release to put in.

Can you elaborate on your use case and application? In another enhancement thread I explained why I am hesitant to spent the work without knowing how it is is really used. Developers I know that work with CaDiCaL get away by picking up the source code directly and/or building their own scripts to link and include the CaDiCaL library (which might need specific configuration options such as '-fPIC' - see './configure -h' for more information).

Can you elaborate on your use case and application?

In our case, we wat to use CaDiCaL from a .NET-based SAT formulation library (https://github.com/deiruch/SATInterface) and deploy that on Linux (x64). .NET can load dynamic libraries.

Well, for example, I could call it from Python in my thesis:

import ctypes
cadical = ctypes.cdll.LoadLibrary("/usr/lib64/libcadical.so.1")
cadical.ccadical_release
<_FuncPtr object at 0x7fc32af44530>
cadical.ccadical_val
<_FuncPtr object at 0x7fc32af44600>
cadical
<CDLL '/usr/lib64/libcadical.so.1', handle 556c2d399d00 at 0x7fc32b0a9190>

Btw, could you also specify soname for shared library?

This looks cool. Do you have some simple python sample code?

Do you mean with "specify soname" do have an option for configure to give that name? I am not sure why you want that (unless we also add an install target).

In Kissat I have --shared as configuration option which would build libkissat.so.

Do you mean with "specify soname" do have an option for configure to give that name? I am not sure why you want that

Oh, of course, no:) I only ask you to specify soname for your library:) For example, like this:
https://src.fedoraproject.org/rpms/cadical/blob/rawhide/f/cadical-shared.patch#_36

In Kissat I have --shared as configuration option which would build libkissat.so.

Cool!

Do you mean with "specify soname" do have an option for configure to give that name? I am not sure why you want that

Oh, of course, no:) I only ask you to specify soname for your library:) For example, like this: https://src.fedoraproject.org/rpms/cadical/blob/rawhide/f/cadical-shared.patch#_36

-all: libcadical.a cadical mobical
+all: libcadical.so cadical mobical

But do not drop out the static library, please. cbmc uses it