biotomas / ipasir

The Standard Interface for Incremental Satisfiability Solving
Other
47 stars 14 forks source link

Support for creating archives, that are compiled fully with the -fPIC flag #24

Closed dangerbleistift closed 2 years ago

dangerbleistift commented 2 years ago

Hi,

for a project of my university (Freiburg, Germany) we are using your ipasir interface.

Since we want to be able to dynamically change the solvers during runtime, we want to create shared object files the following way:

Extract the archives (*.a) created by your repository and recompiling the with gcc with the -shared flag, creating .so files.

For this to work, the archive and its content has to be compiled with the -fPIC flag.

I changed the makefiles of lingeling and picosat to compile the .a files with the -fPIC flag.

For minisat, there was not an easy solution, since the the adding of flags in the compilation process is not supported (or i did not find it), so i patched the compilation process in the makefile. I have seen, that the make process in the Makefile of the tar file allows the shared object compilation (lsh flag), but this was not viable for me, because adding the ipasir glue code to the .so file did not work after the compilation.

I am looking forward for feedback for this change. If is not intended by you to always compile all .a files with the fPIC flag, i could make another pull request, with a conditional parameter for optional fPIC build, so others dont have to dig deep into the code of each solver to find the stuff needed, like me :)

Have a nice day,

Johannes

biotomas commented 2 years ago

Hi Johannes,

thank you for your contribution, I merged your changes.

all the best Tomas