#17630: Further clean up of ATLAS (or equivalent BLAS) linking
--------------------------------------+------------------------
       Reporter:  jpflori             |        Owner:
           Type:  defect              |       Status:  new
       Priority:  major               |    Milestone:  sage-6.5
      Component:  packages: standard  |   Resolution:
       Keywords:                      |    Merged in:
        Authors:                      |    Reviewers:
Report Upstream:  N/A                 |  Work issues:
         Branch:                      |       Commit:
   Dependencies:                      |     Stopgaps:
--------------------------------------+------------------------

Comment (by fbissey):

 Yes definitely of interest. I think cvxopt 1.1.7 is better at handling
 things with environment variables so we shouldn't patch anymore, I should
 update the cvxopt ebuild for gentoo. From cvxopt setup.py
 {{{
 BLAS_NOUNDERSCORES =
 int(os.environ.get("CVXOPT_BLAS_NOUNDERSCORES",BLAS_NOUNDERSCORES)) ==
 True
 BLAS_LIB = os.environ.get("CVXOPT_BLAS_LIB",BLAS_LIB)
 LAPACK_LIB = os.environ.get("CVXOPT_LAPACK_LIB",LAPACK_LIB)
 BLAS_LIB_DIR = os.environ.get("CVXOPT_BLAS_LIB_DIR",BLAS_LIB_DIR)
 BLAS_EXTRA_LINK_ARGS =
 os.environ.get("CVXOPT_BLAS_EXTRA_LINK_ARGS",BLAS_EXTRA_LINK_ARGS)
 if type(BLAS_LIB) is str: BLAS_LIB = BLAS_LIB.strip().split(',')
 if type(LAPACK_LIB) is str: LAPACK_LIB = LAPACK_LIB.strip().split(',')
 if type(BLAS_EXTRA_LINK_ARGS) is str: BLAS_EXTRA_LINK_ARGS =
 BLAS_EXTRA_LINK_ARGS.strip().split(',')
 BUILD_GSL = int(os.environ.get("CVXOPT_BUILD_GSL",BUILD_GSL))
 GSL_LIB_DIR = os.environ.get("CVXOPT_GSL_LIB_DIR",GSL_LIB_DIR)
 GSL_INC_DIR = os.environ.get("CVXOPT_GSL_INC_DIR",GSL_INC_DIR)
 BUILD_FFTW = int(os.environ.get("CVXOPT_BUILD_FFTW",BUILD_FFTW))
 FFTW_LIB_DIR = os.environ.get("CVXOPT_FFTW_LIB_DIR",FFTW_LIB_DIR)
 FFTW_INC_DIR = os.environ.get("CVXOPT_FFTW_INC_DIR",FFTW_INC_DIR)
 BUILD_GLPK = int(os.environ.get("CVXOPT_BUILD_GLPK",BUILD_GLPK))
 GLPK_LIB_DIR = os.environ.get("CVXOPT_GLPK_LIB_DIR",GLPK_LIB_DIR)
 GLPK_INC_DIR = os.environ.get("CVXOPT_GLPK_INC_DIR",GLPK_INC_DIR)
 BUILD_DSDP = int(os.environ.get("CVXOPT_BUILD_DSDP",BUILD_DSDP))
 DSDP_LIB_DIR = os.environ.get("CVXOPT_DSDP_LIB_DIR",DSDP_LIB_DIR)
 DSDP_INC_DIR = os.environ.get("CVXOPT_DSDP_INC_DIR",DSDP_INC_DIR)
 }}}

 gsl makes its own cblas (but no fortran blas) and by default libgsl is not
 linked with any cblas, you are supposed to link with a cblas when you use
 the library.
 Setting blas/lapack in numpy/scipy makes me crazy half the time.
 Environment variable or setup.cfg can be used to change the default
 (currently looking for MKL, ATLAS, netlib and netlib source in that order
 if I am not mistaken).
 Making a setup.cfg from pkg-config is hard
 {{{
 pc_incdir() {
         $(tc-getPKG_CONFIG) --cflags-only-I $@ | \
                 sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e
 's|^:||'
 }

 pc_libdir() {
         $(tc-getPKG_CONFIG) --libs-only-L $@ | \
                 sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e
 's|^:||'
 }

 pc_libs() {
         $(tc-getPKG_CONFIG) --libs-only-l $@ | \
                 sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \
                 -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \
                 | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||'
 }

                 local libdir="${EPREFIX}"/usr/$(get_libdir) # local tree
                 # make sure _dotblas.so gets built
                 sed -i -e '/NO_ATLAS_INFO/,+1d' numpy/core/setup.py || die
                 cat >> site.cfg <<-EOF
                         [blas]
                         include_dirs = $(pc_incdir cblas)
                         library_dirs = $(pc_libdir cblas blas):${libdir}
                         blas_libs = $(pc_libs cblas blas)
                         [lapack]
                         library_dirs = $(pc_libdir lapack):${libdir}
                         lapack_libs = $(pc_libs lapack)
                 EOF
 }}}
  but with the python binding it should be easier.

--
Ticket URL: <http://trac.sagemath.org/ticket/17630#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to