William Stein wrote:
> 2009/6/21 Dr. David Kirkby <david.kir...@onetel.net>:
>> In the patches directory of ntl-5.4.2.p7 there are two files which I'd
>> consider makefiles (i.e. make would understand them)
>>
>> -rw-r-----   1 kirkby   1093         443 Mar 24  2008 ntl_makefile
>> -rw-r--r--   1 kirkby   1093       17194 May 11  2008 mfile
>>
>> As you can see from the file sizes, there are significant differences
>> between the ones that gets uses (mfile) and the one I think is not used
>> at all (ntl_makefile)
>>
>> One difference is the way the shared library is created.
>>
>>
>> The simplist (ntl_makefile) one says:
>>
>> libntl.so: $(OBJ)
>>         $(CXX) -fPIC -shared -o libntl.so $(OBJ)
>>
>>
>> That looks a pretty logical syntax to me.
>>
>>
>> Now when one looks at the makefile that actually gets used, the bit for
>> compiling the shared library is a lot more complex. Some of that
>> complexity is obviously added so that the version number of the ntl is
>> put in the library. But other bits I think are unnecessary and results
>> in the name of the output file being specified twice (luckily the same
>> name!)
>>
>> What's more, it stops the shared library building if gcc 4.4.0 uses
>> Sun's linker, as it complains the output filename has been specified twice.
>>
>> This is what the new 'makefile' says:
>>
>> libntl.so: DIRNAME
>>         - rm -f $(OBJ) # clean, preserving tuning parameters
>>         make shobj
>>         $(LINK_CXX) -fPIC -shared -Wl,-soname,lib`cat DIRNAME`.so -o
>> lib`cat DIRNAME`.so $(OBJ) $(GMP_LIBDIR) $(GMP_LIB)
>>         ln -s lib`cat DIRNAME`.so libntl.so
>>
>>
>> I created a patch which simply removes the "-Wl,-soname,lib`cat
>> DIRNAME`.so" This allows ntl to build on Solaris irrespective of whether
>> gcc uses the GNU linker (part of binutils) or the Sun linker in
>> /usr/ccs/bin/ld.
>>
>> I suspect the GNU linker is more lax than the Sun one, so does not care
>> the fact the name is specified twice.
>>
>> Before creating a ticket, I thought I'd discuss this.
>>
>> Note I've only tested my change on Solaris. I've used two versions of
>> gcc - one built with the GNU assembler and linker on 't2', the other
>> built with the Sun linker and assembler on my own Sun (Blade 2000). The
>> revised .spkg works on either.
>>
>> I have NOT made it Solaris-specific, as I don;t believe the syntax is
>> correct. It's better to fix it on all platforms at once in that case.
>>
>> I could just sumbit my patch for review. But since there is a later
>> version of ntl available, I could update that at the same time, so
>> instead of having ntl-5.4.2.p7, I create ntl-5.5.1.
>>
>> I assume updating the version of ntl though would need a lot more
>> testing, than what is needed if removing less than a dozen lines from a
>> makefile.
>> Comments ??
> 
> True and wise.  I think this should happen in two steps.  Of course, I
> encourage you to do both steps in two trac tickets. :-)

Thinking about it more, perhaps that is not best use of my time. There 
are a lot of people here who know number theory better than me, so could 
not doubt test NTL more thoroughly.

In contrast, it's probably fair to say I know Solaris better than most.

I think it would be better if I integrated the fix that permits building 
with gcc under all circumstances, then  move on to the next Solaris issue,


On obvious thing to do, which I don't mind doing, is to let the 
developer of NTL know how easy it is to build a shared library. He might 
add shared-library support, which would avoid the need to patches in 
Sage. Perhaps the next release of NTL would have that.

> I did write ntl_makefile (the simple one that makes sense to you),
> since when I incorporated NTL into Sage it didn't even have support
> for dynamic libraries.  I'm guessing maybe support for building shared
> libraries got upstreamed incorrectly or something.  Based on the hg
> log, all work on the ntl spkg has been done by mabshoff and tabbott.

Up until 30 seconds or so, Sage was building atlast on my SPARC with gcc 
using the Sun linker and assembler, but has now bombed out, with a 
linker related error.

make[2]: Entering directory 
`/export/home/drkirkby/sage/sage-4.0.2/spkg/build/atlas-3.8.3.p3/ATLAS-build/lib'
rm -f libatlas.so liblapack.so
make libatlas.so liblapack.so libf77blas.so libcblas.so liblapack.so
make[3]: Entering directory 
`/export/home/drkirkby/sage/sage-4.0.2/spkg/build/atlas-3.8.3.p3/ATLAS-build/lib'
ld  -shared -soname libatlas.so -o libatlas.so \
         --whole-archive libatlas.a --no-whole-archive -lc -lm
ld: fatal: file libatlas.so: open failed: No such file or directory
make[3]: *** [libatlas.so] Error 1
make[3]: Leaving directory 
`/export/home/drkirkby/sage/sage-4.0.2/spkg/build/atlas-3.8.3.p3/ATLAS-build/lib'


I'll look at fixing that later, but are working in the garden and only 
came up to have a quick look at my emails.

Dave





--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to