I reviewed some comments which mentioned a problem with ntl and threads. I’m happy to fix that, but I don’t think I understand what the issue is. Can anyone explain?
Thanks.
--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/498a5033-c89e-48bf-a520-6dd7f6cac6b0%40googlegroups.com.
I reviewed some comments which mentioned a problem with ntl and threads. I’m happy to fix that, but I don’t think I understand what the issue is. Can anyone explain? Thanks.
Thanks. I guess what I'm asking for is a solution. From what you say here, and what is said in the links, the problem seems to be a bug in libtool, not NTL. So a solution would be, either:1) a patch other type of libtool workaround, or2) an alternative to libtool.I though the whole point of libtool was to take care of all this nonsense, and if it's not doing that, thenit seems kind of pointless.
Victor, as far as I understand the main configuration script of ntl
is the perl DoConfig script. It has nothing to do with libtool. libtool
is robust if you let it handle the configuration. It will not try to
fix a given one.
In a libtool configure.ac script you would just have a directive
AC_CHECK_LIB for pthread.
In short, I would suggest
3) Replace DoConfig by a configure.ac script
Vincent
Le 28/08/2019 à 15:15, Victor Shoup a écrit :
> Thanks. I guess what I'm asking for is a solution. From what you say here,
> and what is said in the links, the problem seems to be a bug in libtool,
> not NTL. So a solution would be, either:
> 1) a patch other type of libtool workaround, or
> 2) an alternative to libtool.
> I though the whole point of libtool was to take care of all this nonsense,
> and if it's not doing that, then
> it seems kind of pointless.
>
> On Tuesday, August 27, 2019 at 1:42:51 PM UTC-4, Antonio Rojas wrote:
>>
>>
>>
>> El martes, 27 de agosto de 2019, 16:25:12 (UTC+2), Victor Shoup escribió:
>>>
>>> I reviewed some comments which mentioned a problem with ntl and threads.
>>> I’m happy to fix that, but I don’t think I understand what the issue is.
>>> Can anyone explain? Thanks.
>>
>>
>> Hi Victor,
>> IIRC I reported this to you about a year ago. The problem is that you are
>> using libtool as a build command, which calls the compiler with the
>> -nostdlib flag, which in turn overrides the -pthread flag, so the binaries
>> end up not being linked to libpthread. See eg. [1][2] for more info.
>>
>> [1] https://bugzilla.redhat.com/show_bug.cgi?id=661333
>> [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
>>
>
--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/fa916b1e-c62c-d64d-485e-a84b736a4bff%40gmail.com.
Victor,
as you ship libtool, you can just patch it, essentially as in
https://lists.gnu.org/archive/html/libtool-patches/2013-11/msg00015.html
It needs to be moved to a slightly different place, but it works,
you'd get a properly linked libntl.so with the patch (attached), I
checked this on Linux at
least.
> Relying on patched bundled copies of dependencies is very much frowned upon by distros. It would be much preferable to make this work with unmodified libtool, which may be provided by the distribution.
Well, libtool is just a shell script, more or less. NTL isn't unique
in shipping its own version.
Does Arch use its own libtool when building NTL, or the bundled one?
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.
On Tue, Sep 3, 2019 at 1:05 AM Victor Shoup <sh...@cs.nyu.edu> wrote:
>
> OK. So this is really a bug in libtool.
it's a feature :-)
It's not hard to explicitly pass extra libraries to link to libtool,
and thus it's still like this.
> It seems to me that even if I used autotools for everything, the same problem would persist
> without a patch to ltmain.sh.
>
> Is that right?
>
no, if you use autotools, you'd just add a couple of macros to deal with
threads to configure.ac, and the rest will be done correctly,
as autotools are aware of this bug/feature of libtool and know
what to do.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq1Bie-zogVmyK4rKBoLycQF9cqnEibvNrJGaophUeoVkA%40mail.gmail.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/77278251-5ad4-42a2-a9f0-c0bf322fb972%40googlegroups.com.
On Tue, Sep 3, 2019 at 2:21 PM Victor Shoup <sh...@cs.nyu.edu> wrote:
>
> When I compile a program that uses NTL, I always pass -pthread to g++.
> Doesn't that automatically cause the necessary pthread-specific library to be linked in?
it does, if you don't use libtool to link (and typically one would
link an executable with
an explicit call to g++).
the problem is that libtool strips away the -pthread flag.
As long as you don't use it, there is no problem. See
https://www.gnu.org/software/libtool/manual/libtool.html#Stripped-link-flags
"13.1 Why does libtool strip link flags when creating a library?
When creating a shared library, but not when compiling or creating a
program, libtool drops some flags from the command line provided by
the user. This is done because flags unknown to libtool may interfere
with library creation or require additional support from libtool, and
because omitting flags is usually the conservative choice for a
successful build."
So, based on that comment, it seems that there is no problem if you link with g++rather than libtool. But who or what uses libtool to link?I would never have thought of doing that, as I thought libtool was a toolfor creating libraries, not linking programs
Again, when I build and install a shared NTL on a linux system, everything works fine.
So I'm not even sure what the problem is:
Please see comments/questions below...
On Wednesday, September 4, 2019 at 6:04:42 AM UTC-4, Dima Pasechnik wrote:On Tue, Sep 3, 2019 at 2:21 PM Victor Shoup <sh...@cs.nyu.edu> wrote:
>
> When I compile a program that uses NTL, I always pass -pthread to g++.
> Doesn't that automatically cause the necessary pthread-specific library to be linked in?
it does, if you don't use libtool to link (and typically one would
link an executable with
an explicit call to g++).So, based on that comment, it seems that there is no problem if you link with g++rather than libtool. But who or what uses libtool to link?I would never have thought of doing that, as I thought libtool was a toolfor creating libraries, not linking programs.
the problem is that libtool strips away the -pthread flag.
As long as you don't use it, there is no problem. See
https://www.gnu.org/software/libtool/manual/libtool.html#Stripped-link-flags
"13.1 Why does libtool strip link flags when creating a library?
When creating a shared library, but not when compiling or creating a
program, libtool drops some flags from the command line provided by
the user. This is done because flags unknown to libtool may interfere
with library creation or require additional support from libtool, and
because omitting flags is usually the conservative choice for a
successful build."
This is confusing. If you use libtool to link, then the above quote would suggest thatin that context, libtool should not strip away any linker flags.But you seem to be saying that it does.
So...I am still confused.Regarding the libtool that I am bundling with NTL:1) is it stripping some flags during compilation that should not be stripped?2) is it stripping some flags during linking that should not be stripped?
Again, when I build and install a shared NTL on a linux system, everything works fine.So I'm not even sure what the problem is:
I can build it and link to it in the build directory using libtool.I can install it using libtool somewhere else and later link to it using g++.What am I missing?!?
--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/15c39061-e49d-4c6b-951b-6763aaea5dd0%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/9fe439d2-c87c-44e1-aa06-f2b856ff6bec%40googlegroups.com.
We seem to be talking past each other.
It is also true that when I run ldd on libntl.so, I do not see anything related to pthread.From the comments I'm reading in https://trac.sagemath.org/ticket/28406, that seemsto be what is "wrong".
When I actually build a program, either in the build directory using NTL's makefile with libtool,or in another directory using a different makefile that uses g++, it works fine.
So my understanding is that whenever you compile a multi-threaded programyou should pass -pthread to gcc.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.