potassco/clingo-rs

clingo-rs versions 0.7.x unable to locate libclingo

EWurbel opened this issue · 2 comments

Hi,

I have some problems building & rust program with clingo-rs version 0.7.2 and 0.7.3.

Environment :

  • Debian linux 11.
  • Clingo is installed via anaconda in a dedicated environment (clingo 5.5.0, as the clingo-rs 0.7.x crates claim to rely on this version)
  • environment CLINGO_LIBRARY_PATH is initialized to the lib directory in the environment where libclingo.so.4.0 and the two symbolic links liblingo.so.4 and libclingo.so are present.
  • cargo build complains that, during linking, it cannot find the libclingo library.

I saw that clingo-rs is depending on clingo-sys version 0.7.1. Is it normal ?

I have no problem with the 0.6 version of clingo-rs.

Any clues ?

(sorry if creating an issue is a bit overkill for such a problem, but the mailing list sign-up process on sourceforge seems to be stucked : I never receive the confirmation email.)

Hi @EWurbel, the clingo crate 0.7.2 depends on clingo-sys 0.7.1 which are the bindings for clingo-5.5.0. Unfortunately, the dependencies where not correctly specified so it may pull in clingo-sys 0.7.2 which are the bindings for clingo 5.6.2.
The C API of clingo 5.5.0 and 5.6.2 are different so these are incompatible.
To remedy the issue, we released clingo 0.7.3 which is identical to 0.7.2 but has fixed the dependency to clingo-sys 0.7.1. 🤪
So, to be sure you should use clingo 0.7.3.

Anyway, your problem looks like a linker problem which happens because since 0.7 the default is dynamic linking.
So, you can either try the feature flag for static linking:

clingo = { version = "0.7.3", features = ["static-linking"] }

Or maybe you can try to set LD_LIBRARY_PATH ?

export LD_LIBRARY_PATH=/usr/share/miniconda/envs/test/lib

Thank you for your quick answer.

Yes this is a linking problem for sure. The message comes from /usr/bin/ld.

The problem is the same for me with 0.7.3. setting LD_LIBRARY_PATH is not an option, as the directory where libclingo resides contains a bunch of dynamic libs, so solely setting LD_LIBRARY_PATH cripples the system. And switching to the conda environment where libclingo resides does not solve the problem neither.

In the meantime I switched to static linking and everything went fine, but I hope I'll soon find a solution allowing the use of dynamic linking.

Thank you