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

should libsemigroups be a convenience (static) library? #483

Open
RussWoodroofe opened this issue May 21, 2018 · 4 comments
Open

should libsemigroups be a convenience (static) library? #483

RussWoodroofe opened this issue May 21, 2018 · 4 comments
Assignees
Labels
feature-request Label for feature requests question A label for issues that are questions

Comments

@RussWoodroofe
Copy link

The C++ part of the semigroups package is built in 2 parts: a library (semigroups.so) that is loaded by GAP, and a library (libsemigroups.la) that is loaded by semigroups.so.

Currently, semigroups.so links to libsemigroups.la as a shared library. If I understand right, in a typical installation, it will only be used by GAP. Calling it as a shared library thus only adds (a small amount of) overhead. It also makes the semigroup package sensitive to location, at least on macOS. For example, renaming GAPDIR from gap-4.9.1 to gap-test will break the semigroups package. (Such renaming will also currently break libgmp.)

I suggest that it might make sense to include libsemigroups.la into semigroups.so as a static library, rather than shared. The change involved would only involve one line: in src/libsemigroups/Makefile.am, change
lib_LTLIBRARIES = libsemigroups.la
to
noinst_LTLIBRARIES = libsemigroups.la
This marks libsemigroups to libtool as a "convenience library", and libtool will then link it as static.

My own interest in this is in packaging GAP (including semigroups) for a drag-and-drop install in my Mac interface Gap.app: http://cocoagap.sourceforge.io/
I do have a workaround (running install_name_tool twice to fix library paths). But it seems to me that the change I've suggested is likely to make the semigroups package otherwise more robust.

But maybe there are very good reasons to link libsemigroups.la as a shared library?

@james-d-mitchell
Copy link
Collaborator

@RussWoodroofe thanks for the suggestion, I'll give it try and see what happens. There was no good reason to link libsemigroups.la that I recall.

@RussWoodroofe
Copy link
Author

Thanks so much for being receptive! I did lightly test the change on macOS 10.12. It at least linked correctly, and GAP would load the package.

@james-d-mitchell
Copy link
Collaborator

Looking into this a little further, I'm concerned that the change would be in libsemigroups rather than in the Semigroups package for GAP itself. In particular, libsemigroups is a separate project (although obviously related). It seems that it would be possible to change the automake setup for Semigroups to linking statically with libsemigroups but that this would involve duplicating part of the libsemigroups build system in Semigroups which rather defeats the point of having it as a subpackage in the first place.

Making the change you suggest seems to prevent make install from working as expected in libsemigroups, and this step is required by, for example, the python bindings for libsemigroups.

I'm not certain how/if to proceed, if you have any further comments, I'll be happy to consider them.

@RussWoodroofe
Copy link
Author

It looks like libtool generally doesn't like to mix static and dynamic libraries, which makes this harder than it should be.

One solution would be to include patched Automake files for libsemigroups with the GAP package (only). This looks to me like the most portable solution, but the patching would not be so robust (and increased robustness was a main reason for the proposed change).

Another solution would be to run the libsemigroups configure as configure --disable-shared --enable-static from the semigroups package configure. That is, have the semigroup package tell libsemigroup to build only a static library. This looks like a better solution to me. (I tested building and loading on macOS.)

@wilfwilson wilfwilson added feature-request Label for feature requests and removed feature-request-2 labels Mar 4, 2021
@james-d-mitchell james-d-mitchell added the question A label for issues that are questions label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Label for feature requests question A label for issues that are questions
Projects
None yet
Development

No branches or pull requests

3 participants