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

Add libhomfly as optional package #18047

Closed
miguelmarco opened this issue Mar 24, 2015 · 70 comments
Closed

Add libhomfly as optional package #18047

miguelmarco opened this issue Mar 24, 2015 · 70 comments

Comments

@miguelmarco
Copy link
Contributor

I modified the homfly[1] program to be run as a library[2]. It computes the homfly polynomial of knots and links.
I would like to add it as standard package so we can use it in #17030 i understand that it has to become optonal before moving to standard, but i would like to speed up the process. Of course, i volunteer to maintain it.
[1] ​http://burtleburtle.net/bob/knot/homfly.html
[2] ​https://github.com/miguelmarco/libhomfly

Tarball: attachment: libhomfly-1.0.tar.gz

CC: @vbraun @kcrisman @amitjamadagni @sagetrac-fugelde @tscrim

Component: packages: optional

Keywords: days74

Author: Miguel Marco

Branch: cc13df1

Reviewer: Jeroen Demeyer, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/18047

@miguelmarco miguelmarco added this to the sage-6.6 milestone Mar 24, 2015
@miguelmarco

This comment has been minimized.

@miguelmarco miguelmarco changed the title help Add libhomfly as optional package Mar 24, 2015
@miguelmarco
Copy link
Contributor Author

Branch: u/mmarco/libhomfly

@kcrisman
Copy link
Member

Commit: 458d6bf

@kcrisman
Copy link
Member

New commits:

458d6bfInitial commit

@vbraun
Copy link
Member

vbraun commented Mar 24, 2015

comment:5

Nice. Pretty sure that doesn't work on OSX. Basically there is no way to build a shared libray without libtool in a portable manner. Also, I would be very opposed to make a library standard that doesn't do the standard autotools + libtool process.

@jdemeyer
Copy link

Replying to @miguelmarco:

I would like to add it as standard package so we can use it in #17030

You can use it in #17030 even if it's an optional package. Just make sure you provide a good error message in case the package is needed but not installed.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 27, 2015

Changed commit from 458d6bf to 14112a4

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

14112a4Moved to autotools-libtools

@miguelmarco
Copy link
Contributor Author

comment:8

Attachment: libhomfly-1.0.tar.2.gz

I moved the package to libtools. Also uploaded the new tarball (please ignore libhomflt-1.0.tar.2.gz)

@vbraun
Copy link
Member

vbraun commented Mar 27, 2015

comment:9

Looks good. Newer autoconf gives one warning, can you add AM_PROG_AR to fix it?

diff --git a/configure.ac b/configure.ac
index 6c5f369..103e585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,9 @@ AC_INIT([libhomfly], [1.0], [mmarco@unizar.es])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([foreign -Wall])
-LT_INIT
 AC_PROG_CC
+AM_PROG_AR
+LT_INIT
 AC_CONFIG_FILES([Makefile lib/Makefile])
 AC_OUTPUT

Also, I take it you have a testcase (a minimal C program to link to your library to see if it works?) That would be nice to add, can save you quite a bit of debugging headache later.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 27, 2015

Changed commit from 14112a4 to 2edefa1

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 27, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

2edefa1Added test

@miguelmarco
Copy link
Contributor Author

comment:11

Made the change and added a little test

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 28, 2015

Changed commit from 2edefa1 to f19093f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 28, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

f19093fFixed checksums

@vbraun
Copy link
Member

vbraun commented Mar 28, 2015

comment:13

The library uses Bohm GC, but the test program does not. Hence you shoudl link the library to libgc, and not the test program. In other words, programmers using your library shouldn't have to know what your private library dependencies are:

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5aa6416..b4341c4 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,3 +1,4 @@
 lib_LTLIBRARIES = libhomfly.la
 libhomfly_la_SOURCES = bound.c  control.c  dllink.c  knot.c  model.c  order.c  poly.c standard.h order.h bound.h  control.h  dllink.h knot.h model.h order.h poly.h standard.h
+libhomfly_la_LDFLAGS = -lgc
 include_HEADERS = homfly.h
diff --git a/test/Makefile.am b/test/Makefile.am
index 0394f0a..b564b7e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,5 +2,4 @@ bin_PROGRAMS = test_example
 test_example_SOURCES = test_example.c homfly.h
 test_example_LDADD = @top_builddir@/lib/libhomfly.la
 test_example_DEPENDENCIES = @top_builddir@/lib/libhomfly.la
-test_example_LDFLAGS = -lgc
 TESTS = test_example

Apart from that it looks good.

There are some global variables and all symbols are exported, so there is a reasonable chance that you'll run into global state or symbol name colissions when you link it into Sage. It would probably be better to hide all symbols that you are not going to use. Possibly later when you have a better idea of what you actually want to call from Sage.

@miguelmarco
Copy link
Contributor Author

comment:14

The cython interface is being done in #18057

@miguelmarco
Copy link
Contributor Author

comment:15

Uploaded new tarball

@miguelmarco
Copy link
Contributor Author

Changed keywords from none to days74

@miguelmarco
Copy link
Contributor Author

comment:18

The new tarball should expose only the homfly symbol, which is the one used by the cython interface.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 30, 2016

Changed commit from f19093f to 090c7fd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 30, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

be71e3eInitial commit
5b6fae2Moved to autotools-libtools
7bcf75aAdded test
d14ec25Fixed checksums
371e368Initial commit
249c987Moved to autotools-libtools
8eedce7Added test
ad156b3Fixed checksums
b550750Rebased, updated checksums and added type
090c7fdMerge branch 'u/mmarco/libhomfly' of git://trac.sagemath.org/sage into t/18047/libhomfly

@sagetrac-git sagetrac-git mannequin added the s: needs review label Jun 1, 2016
@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:47

You have forgotten the test/data.txt file in the tarball, which is needed to run the tests.

@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:48

Replying to @tscrim:

You have forgotten the test/data.txt file in the tarball, which is needed to run the tests.

Actually, this is my fault for not having the autotools including it.

@miguelmarco
Copy link
Contributor Author

comment:49

Ok, I will handle it. Give me a few minutes.

@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:50

I've already done it, see PR #4 on github.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2016

comment:51

Attachment: libhomfly-1.0.tar.gz

Branch pushed to git repo; I updated commit sha1. New commits:

cc13df1New checksums

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 1, 2016

Changed commit from c37cb34 to cc13df1

@miguelmarco
Copy link
Contributor Author

comment:52

It should be included now.


New commits:

cc13df1New checksums

@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:53

Thank you. sage -i -c libhomfly now passes. I feel that we should have a release tag on github and use the corresponding tarball for that here. I think it is as easy as adding a tag to the git repo, but I've not used that functionality yet.

@miguelmarco
Copy link
Contributor Author

comment:54

Does github automate the "autoreconf-configure-make dist" cycle?

@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:55

IDK. From what I understand, the release tab on github looks for a (annotated?) tag of the form v1.0. I will look into it today.

@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:56

See perhaps: https://help.github.com/articles/creating-releases/ but IDK about autocreation of tarballs.

@miguelmarco
Copy link
Contributor Author

comment:57

I created one tag and release, but it just gives a tarball with the content of the repo. So the actual tarball for distribution should be created by the full autotools cycle from there

@tscrim
Copy link
Collaborator

tscrim commented Jun 1, 2016

comment:58

Okay, so the created tarball will be just of the source code on github (but it will do that automatically). So we could either just do the hosting ourselves or have a spkg-src. Well for now, this works (as this might be the only release) and to add the tag.

Thank you for your work on this.

@vbraun
Copy link
Member

vbraun commented Jun 2, 2016

Changed branch from u/mmarco/libhomfly to cc13df1

@kcrisman
Copy link
Member

comment:60

When I do L.homfly_polynomial() I just get ImportError: No module named homfly - should that give me a message to do the optional package instead? (This is on 7.3.beta3 so it's "in" otherwise.)

@kcrisman
Copy link
Member

Changed commit from cc13df1 to none

@miguelmarco
Copy link
Contributor Author

comment:61

The functionality requires to have the optional package installed. Since these tickets are already closed, could you please open a new ticket for improving the error message?

@kcrisman
Copy link
Member

comment:62

That's exactly what I figured, but wanted to confirm. See #20838.

@jdemeyer
Copy link

comment:63

@vbraun: the tarball on the mirrors in not the one from this ticket (attachment: libhomfly-1.0.tar.gz). Can you please fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants