Use NTL upstream build system in Sage's spkg

37 views
Skip to first unread message

Jean-Pierre Flori

unread,
Aug 6, 2012, 12:34:48 PM8/6/12
to sage-...@googlegroups.com
Dear all,

In order to properly solve #11635 for NTL on Cygwin, and in order to sumplify the NTL spkg, we could use NTL own build system, rather than the one which was crafted before NTL had a portable one.
I've got no problems build static and shared libraries on Linux and Cygwin with the current one which uses (by default the system wide) libtool for compiling, linking and installing.
But the use of libtool is problematic because this is not a dependency for Sage.
Another solution would be to include the four files needed to generate libtool in the NTL spkg (most spkg for projects using autotools do that already) and generate it from spkg-intall before running configure.
The problem is I have no clue where I should get such files, or how to generate them using libtoolize, aclocal or I don't know what, or if it's even possible to do that for a non-autotool projects.

Best,
JP

Julien Puydt

unread,
Aug 6, 2012, 1:02:39 PM8/6/12
to sage-...@googlegroups.com
Le 06/08/2012 18:34, Jean-Pierre Flori a �crit :
> But the use of libtool is problematic because this is not a dependency
> for Sage.

Oh, isn't libtool like the rest of autotools : only necessary for people
developing upstream, but not for those who just want to compile the project?

Snark on #sagemath

Jean-Pierre Flori

unread,
Aug 6, 2012, 1:09:05 PM8/6/12
to sage-...@googlegroups.com

Oh, isn't libtool like the rest of autotools : only necessary for people
developing upstream, but not for those who just want to compile the project?

Snark on #sagemath
If I understood correctly, when you use autotools, then configure more or less generates a suitable libtool (using config.guess/ltmain.sh/aclocal.m4 and another file I forgot, which in turn are generate by autoconf/aclocal/libtoolize tools) for your host which is then used to compile/link/install.

Julien Puydt

unread,
Aug 6, 2012, 1:14:35 PM8/6/12
to sage-...@googlegroups.com
Le 06/08/2012 19:09, Jean-Pierre Flori a �crit :
> If I understood correctly, when you use autotools, then configure more
> or less generates a suitable libtool (using
> config.guess/ltmain.sh/aclocal.m4 and another file I forgot, which in
> turn are generate by autoconf/aclocal/libtoolize tools) for your host
> which is then used to compile/link/install.

As far as I understand this :
http://www.gnu.org/software/libtool/manual/libtool.html#Configuring

the correct libtool script is created by the configure script, tailored
for your system&compiler -- nothing from the system is used.

Are you that sure there is a problem here?

Snark on #sagemath

Jean-Pierre Flori

unread,
Aug 6, 2012, 1:19:42 PM8/6/12
to sage-...@googlegroups.com

As far as I understand this :
http://www.gnu.org/software/libtool/manual/libtool.html#Configuring

the correct libtool script is created by the configure script, tailored
for your system&compiler -- nothing from the system is used.

Are you that sure there is a problem here?

Snark on #sagemath
The problem here is that NTL does not use autotools, but only libtool.
In particular its configure script does not generate a suitable libtool, but it expects you to provide one (which should be functional on your system).
For example you can get one apt-getting libtool on common Debian like systems.
Of course I could not copy the system wide such libtool from one system and let it run somewhere else.

Julien Puydt

unread,
Aug 6, 2012, 2:32:22 PM8/6/12
to sage-...@googlegroups.com
Le 06/08/2012 19:19, Jean-Pierre Flori a �crit :
> As far as I understand this :
> http://www.gnu.org/software/libtool/manual/libtool.html#Configuring
> <http://www.gnu.org/software/libtool/manual/libtool.html#Configuring>
>
> the correct libtool script is created by the configure script, tailored
> for your system&compiler -- nothing from the system is used.
>
> Are you that sure there is a problem here?
>
> Snark on #sagemath
>
> The problem here is that NTL does not use autotools, but only libtool.

Ouch. Then indeed, they have one more build-time dep than necessary.

Do they have something against autotools or is it just that they don't
use them yet?

Snark on #sagemath

Jean-Pierre Flori

unread,
Aug 6, 2012, 3:58:49 PM8/6/12
to sage-...@googlegroups.com


Le lundi 6 août 2012 20:32:22 UTC+2, Snark a écrit :
Le 06/08/2012 19:19, Jean-Pierre Flori a �crit :
 I think NTL is considered finished except for bug fixes so we should not wait anything from Shoup's side.

Jeroen Demeyer

unread,
Aug 7, 2012, 2:43:47 AM8/7/12
to sage-...@googlegroups.com
On 2012-08-06 19:19, Jean-Pierre Flori wrote:
> The problem here is that NTL does not use autotools, but only libtool.
> In particular its configure script does not generate a suitable libtool,
> but it expects you to provide one (which should be functional on your
> system).
I consider that an upstream bug, then. They really should ship libtool
(and I see absolutely no reason why they don't).

Jeroen Demeyer

unread,
Aug 7, 2012, 2:47:46 AM8/7/12
to sage-...@googlegroups.com
On 2012-08-06 20:32, Julien Puydt wrote:
> Ouch. Then indeed, they have one more build-time dep than necessary.
I guess the correct thing to do for Sage would be to ship libtool inside
the spkg (this is what is usually done for autotools projects anyway).

Jean-Pierre Flori

unread,
Aug 7, 2012, 4:09:47 AM8/7/12
to sage-...@googlegroups.com
Exactly my point.
But I don't know how to generate the 4 files which are needed to generate libtool itself at configure time...
I tried to create a configure.in file containing only AC_PROG_LIBTOOL and running aclocal but got an error about _AC_LANG not being defined.
Running libtoolize in an empty folder did nothing.

Jean-Pierre Flori

unread,
Aug 7, 2012, 4:36:19 AM8/7/12
to sage-...@googlegroups.com
Adding AC_INIT and AC_OUTPUT seems to please aclocal

Jean-Pierre Flori

unread,
Aug 7, 2012, 4:37:53 AM8/7/12
to sage-...@googlegroups.com
It seems I've got something looking good.
I'll post an updated spkg in #11635 soon.

Jeroen Demeyer

unread,
Aug 7, 2012, 4:47:46 AM8/7/12
to sage-...@googlegroups.com
On 2012-08-07 10:09, Jean-Pierre Flori wrote:
>
>
> On Tuesday, August 7, 2012 8:47:46 AM UTC+2, Jeroen Demeyer wrote:
>
> On 2012-08-06 20:32, Julien Puydt wrote:
> > Ouch. Then indeed, they have one more build-time dep than necessary.
> I guess the correct thing to do for Sage would be to ship libtool
> inside
> the spkg (this is what is usually done for autotools projects anyway).
>
> Exactly my point.
> But I don't know how to generate the 4 files which are needed to
> generate libtool itself at configure time...
You could simply copy them from the system (in my installation, this is
/usr/share/libtool/config)

Jean-Pierre Flori

unread,
Aug 7, 2012, 4:52:44 AM8/7/12
to sage-...@googlegroups.com

You could simply copy them from the system (in my installation, this is
/usr/share/libtool/config)
I guess that's what the aclocal/autoconf comination did in the end, but now if it does not work, it will be easier to blame autotools :)

Jean-Pierre Flori

unread,
Aug 7, 2012, 5:42:41 AM8/7/12
to sage-...@googlegroups.com
Updated spkg uploaded at #11635, link is http://perso.telecom-paristech.fr/~flori/sage/ntl-5.5.2.p0.spkg

If someone could check if it's as functional as the previous one on Mac OSX and Solaris, and exotic Linuxes, without libtool installed (or with it, it explicitely points NTL to the generated libtool, so there's no reason it will look for a system wide one).
Ubuntu 12.04 and Cygwin seem ok.

Jean-Pierre Flori

unread,
Aug 7, 2012, 5:59:10 AM8/7/12
to sage-...@googlegroups.com
In fact on Cygwin I now get lots of undefined references to libstdc++ or somthing like that.

Volker Braun

unread,
Aug 7, 2012, 8:23:41 AM8/7/12
to sage-...@googlegroups.com
In the new atlas-3.10.0 spkg (http://trac.sagemath.org/10508) I faced the same problem, I needed libtool to build a shared library but atlas doesn't use autoconf and doesn't install libtool. It is possible to install libtool globally, but it is recommended that it is generated by autotools on the fly.

In the atlas spkg I solved this by adding a stub autotools project that creates libtool and then builds the shared libraries from the static libraries. 
Reply all
Reply to author
Forward
0 new messages