On Thu, 5 Sep 2019 at 05:07, Victor Shoup <sh...@cs.nyu.edu> wrote: > 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 tool > for creating libraries, not linking programs. >
Linking a program with g++ is easy, linking a shared library with g++ is hard. This is why libtool was invented in the 1st place, to help the latter. > >> 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 that > in that context, libtool should not strip away any linker flags. > But you seem to be saying that it does. > Sorry, I was not careful in my last message. indeed, you are right, libtool only drops flag while making a shared library, but not while making a program. > 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? > during linking a dynamic library libtools strips flags it does not know about. (and only in this case). With the patch I posted, it will “know” about the -pthread flag and do the right thing. > 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?!? > libtool handles linking dylibs and programs differently, it honours flags in the latter case, but not in the former case. Dima > -- > 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+unsubscr...@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 > <https://groups.google.com/d/msgid/sage-devel/15c39061-e49d-4c6b-951b-6763aaea5dd0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq1E8rFRZ1JxCTy27H-Zw7V2EUUawY%2BWBT%2BOAaWA8V-jGQ%40mail.gmail.com.