digraphs / Digraphs

The GAP package Digraphs
https://digraphs.github.io/Digraphs
Other
30 stars 46 forks source link

Potential rpath problem with libplanarity #592

Open fingolfin opened 1 year ago

fingolfin commented 1 year ago

I was sitting with @AndreasEnge to update the guix package for GAP, and we tested which packages work. We run into an error that looks a lot like the libsemigroups problem related to rpath handling.

Specifically, it built the bundled libplanarity but that then later was not found. Fixing this may be a matter of adding KEXT_LDFLAGS += -Wl,-rpath,$(PWD)/bin/lib to the build system. But there is of course a second part, setting rpath for an installed libplanarity, which I guess could also be adapted from Semigroups....

james-d-mitchell commented 1 year ago

~Thanks for the report @fingolfin, I'm a bit confused though. Is this a problem in the Semigroups package or the Digraphs package? With libplanarity or libsemigroups? There's a mixture of both in the issue at present.~

Wait I replied too fast, let me properly read your comment

fingolfin commented 1 year ago

so my analogy was that Digraphs+libplanarity is roughly comparable to Semigroups + libsemigroups, in terms of build system requirements and issues. Thus, the issue of missing rpath settings in the library respectively the kernel extension also exists here, and must be fixed just as it was fixed in Semigroups. This is not just hypothetical but was born out by an experiment by Andreas Enge.

I would offer to submit a patch but unfortunately cannot currently reproduce the issue :-/. Perhaps @andreasenge can and is willing to help.... Or perhaps we can find a Linux distro where it is easy to repro and then setup a virtualized one to make it reproducible in CI tests?

james-d-mitchell commented 1 year ago

Thanks @fingolfin, I understood this after reading your issue properly, I did not pay enough attention the first time :(

I'll be happy to accept a PR if one is forthcoming, I also can't reproduce this at present, so don't know exactly what will fix it.

AndreasEnge commented 9 months ago

Hello, and sorry for the delay!

When I compile gap with digraphs in Guix (currently it is disabled), then execute LoadPackage("digraphs"); I obtain the following: Error, LOAD_DYN: failed to load kernel module /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/pkg/d\ igraphs/bin/x86_64-unknown-linux-gnu-default64-kv8/digraphs.so, libplanarity.so.0: cannot open shared object \ file: No such file or directory in LOAD_DYN( filename ) at /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/lib/files.gd:592 called from <function "LoadDynamicModule">( ) called from read-eval loop at /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/pkg/digraphs/init.g:24 Error, was not in any namespace at /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/lib/variable.g:269 called from LEAVE_NAMESPACE( ); at /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/lib/package.gi:1325 called from ReadPackage( pkgname, "init.g" ); at /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/lib/package.gi:1686 called from <function "LoadPackage">( ) called from read-eval loop at stdin:2

Indeed ldd on digraphs.so shows that libplanarity.so.0 is not found. Probably because it is in a different subdirectory: /gnu/store/f7mza32nic84bzla026hidvsql9f0ig1-gap-4.12.2/share/gap/pkg/digraphs/bin/lib/libplanarity.so instead of a subdirectory of the bin/ directory, and this is not put into the rpath.

But my impression is that this will be the same for the semigroups package (which depends on digraphs, so that I cannot meaningfully test it): ldd on semigroups.so also does not find libsemigroups.so.

This may be an idosyncrasy of Guix, or maybe a more general problem.

Andreas