Bug 152771 - math/lapack 3.3.0 port lacks some routines
Summary: math/lapack 3.3.0 port lacks some routines
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Maho Nakata
Depends on:
Reported: 2010-12-02 10:00 UTC by Eijiro Shibusawa
Modified: 2010-12-25 04:20 UTC (History)
0 users

See Also:

file.diff (1.90 KB, patch)
2010-12-02 10:00 UTC, Eijiro Shibusawa
no flags Details | Diff
lapack.patch.diff (4.82 KB, patch)
2010-12-11 06:47 UTC, Eijiro Shibusawa
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eijiro Shibusawa 2010-12-02 10:00:22 UTC
The lapack shared library liblapack.so.4 (installed port version 3.3.0)
lacks following single precision routines.

The patchfile files/shared-patch-SRC+Makefile fixes gcc's "multiple definition" error,
however it also removes some objects that should be preserved.

Fix: Patch attached with submission follows:
How-To-Repeat: # cd /usr/ports/math/lapack
# make install clean

$ gcc45 -v
Using built-in specs.
Target: x86_64-portbld-freebsd8.1
Configured with: ./../gcc-4.5-20101125/configure --enable-lto=no --disable-nls --libdir=/usr/local/lib/gcc45 --libexecdir=/usr/local/libexec/gcc45 --program-suffix=45 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc45/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-system-zlib --disable-rpath --enable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc45 --build=x86_64-portbld-freebsd8.1
Thread model: posix
gcc version 4.5.2 20101125 (prerelease) (GCC)

$ nm -D /usr/local/lib/liblapack.so.4 | grep spotrs
                 U spotrs_
$ nm -D /usr/local/lib/liblapack.so.4 | grep sgetrs
                 U sgetrs_
$ nm -D /usr/local/lib/liblapack.so.4 | grep sgetrf
                 U sgetrf_
Comment 1 Pav Lucistnik freebsd_committer 2010-12-02 14:11:48 UTC
Responsible Changed
From-To: freebsd-ports-bugs->maho

Assign to maintainer
Comment 2 dfilter service freebsd_committer 2010-12-04 09:10:29 UTC
maho        2010-12-04 09:10:23 UTC

  FreeBSD ports repository

  Modified files:
    math/lapack          Makefile 
    math/lapack/files    shared-patch-SRC+Makefile 
  Build fix for science/mpqc, graphics/mypaint,
  graphics/cimg, math/suitesparse, math/biggles, astro/astrometry
  math/clp, science/mpb.
  Reported by: pav, erwin, Anton Shterenlikht, "Hartmann, O" [1],
  Submmited by: Eijiro Shibusawa <phd_kimberlite@yahoo.co.jp> [2]
  PR: 152771 [2], 152790 [1]
  Revision  Changes    Path
  1.54      +1 -0      ports/math/lapack/Makefile
  1.2       +19 -1     ports/math/lapack/files/shared-patch-SRC+Makefile
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Maho Nakata freebsd_committer 2010-12-06 01:05:36 UTC
State Changed
From-To: open->closed

committed, thanks!
Comment 4 Eijiro Shibusawa 2010-12-11 06:47:24 UTC
Dear Prof. Nakata, Maintainer of math/lapack,

Thank you very much for dealing with this PR.
Could you please reopen this PR?

The previous patch only partially solves problems,
and there are still remains of them (I'm really sorry!!!).
liblapack.a (installed from port version 3.3.0_1) has symbol duplication

$ nm /usr/local/lib/liblapack.a | grep " T " | grep spotrf_
0000000000000000 T spotrf_
0000000000000000 T spotrf_
$ nm /usr/local/lib/liblapack.a | grep " T " | grep cgetrf_
0000000000000000 T cgetrf_
0000000000000000 T cgetrf_
$ nm /usr/local/lib/liblapack.a | grep " T " | grep cgetrs_
0000000000000000 T cgetrs_
0000000000000000 T cgetrs_
$ nm /usr/local/lib/liblapack.a | grep " T " | grep cpotrf_
0000000000000000 T cpotrf_
0000000000000000 T cpotrf_
$ nm /usr/local/lib/liblapack.a | grep " T " | grep cpotrs_
0000000000000000 T cpotrs_
0000000000000000 T cpotrs_

I think that the symbol lack and the symbol duplication problems have
same cause.
It is some errors in the Makefile (provided from lapack 3.3.0),
and it should be fixed in "patch" target by patch-SRC+Makefile.
The patch shared-patch-SRC+Makefile is not necessary,
because if patch-SRC+Makefile includes the correction of the errors,
we does not need to patch the Makefile again in "post-patch" target.

The attached patch includes the above modifications,
but it does not bump new $PORTREVISION.
Thus please update it if you need.

I had tested liblapack.a built according to patched Makefile,
and I found it woks fine.
Please confirm,
# make regression-test

The both problems are attributable to the following fact:
* routine spotrf is defined in $DSLASRC and it also exists in $SLASRC;
* routines {cpotrs cgetrs cpotrf cgetrf}
are defined in $ZCLASRC and they also exist in $CLASRC.
If a macro containing {$DSLASRC $SLASRC $ZCLASRC $CLASRC} is defined,
like $ALLOBJ, then "multiple definition" of the five routines
{spotrf cpotrs cgetrs cpotrf cgetrf} is encountered.

[lack problem -- the PR]
By removing $DSLASRC and $ZCLASRC, like your patch (in 3.3.0 port),
we can fix "multiple definition" error and build shared library,
however routines {spotrs sgetrs sgetrf} exist in $DSLASRC ONLY.
Thus, library may lack the three symbols {spotrs sgetrs sgetrf},
except for the case where they are added to somewhere.

[duplication problem]
In contrast to the case of shared library, gcc does not report linker error,
however the "multiple definition" problem also affects build process of
static library.
Indeed liblapack.a has the routines duplicated.

Last week, I had submitted the patch (committed as 3.3.0_1 port)
adding {spotrs sgetrs sgetrf} to $SLASRC,
because I had not correctly recognized the cause of the problems.
For fixing both symbol lack/duplication problems
I think that each routine should be defined only once in $ALLOBJ,
while $DSLASRC and $ZCLASRC are preserved
(They are definitions for the routines using mixed-precision algorithm,
{dsgesv, dsposv, zcgesv, zcposv}[1]).
Therefore routines spotrf and {cpotrs cgetrs cpotrf cgetrf}
should be removed from $SLASRC and $CLASRC respectively.

[1] http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=1891

Thanks in advance, Shibusawa
Comment 5 Maho Nakata freebsd_committer 2010-12-25 02:02:58 UTC
State Changed
From-To: closed->open

The origial patch submitter submit a better patch. 
To apply, I reopened the PR. 
Comment 6 dfilter service freebsd_committer 2010-12-25 04:10:34 UTC
maho        2010-12-25 04:10:30 UTC

  FreeBSD ports repository

  Modified files:
    math/lapack          Makefile 
    math/lapack/files    patch-SRC+Makefile 
  Removed files:
    math/lapack/files    shared-patch-SRC+Makefile 
  Removing dupe from static lib as well.
  PR:             152771
  Submitted by:   Eijiro Shibusawa <phd_kimberlite@yahoo.co.jp>
  Revision  Changes    Path
  1.55      +1 -2      ports/math/lapack/Makefile
  1.2       +33 -6     ports/math/lapack/files/patch-SRC+Makefile
  1.3       +0 -38     ports/math/lapack/files/shared-patch-SRC+Makefile (dead)
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Maho Nakata freebsd_committer 2010-12-25 04:10:44 UTC
State Changed
From-To: open->closed

committed, thanks.