Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 454254

Summary: dev-python/cvxopt with dev-util/pkgconfig-0.28 - ?
Product: Gentoo Linux Reporter: François Bissey <frp.bissey>
Component: [OLD] LibraryAssignee: Gentoo Science Mathematics related packages <sci-mathematics>
Status: RESOLVED FIXED    
Severity: normal CC: burcin, jordi, strogdon, v_2e
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description François Bissey 2013-01-27 10:17:34 UTC
I got a report from Steve Trogdon that pkgconfig 0.28 broke the sage ebuild on Friday. Since then I found out that it also breaks cvxopt but not numpy and scipy.

All those are python based application that use BLAS/LAPACK. In those ebuild the libraries needed are extracted by parsing the output of pkg-config with sed. The problem is that pkg-config seems to add a whte space after the library name.

Here is the failure in cvxopt:

x86_64-pc-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--as-needed -O1 -march=native -pipe -ggdb build-2.7/temp.linux-x86_64-2.7/C/base.o build-2.7/temp.linux-x86_64-2.7/C/dense.o build-2.7/temp.linux-x86_64-2.7/C/sparse.o -L -L/usr/lib64 -lreflapack -lopenblas  -lpython2.7 -o build-2.7/lib.linux-x86_64-2.7/cvxopt/base.so
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lopenblas 
collect2: ld returned 1 exit status
error: command 'x86_64-pc-linux-gnu-gcc' failed with exit status 1

And this is caused by this line on setup.py:
# Default names of BLAS and LAPACK libraries
BLAS_LIB = ['openblas ']
LAPACK_LIB = ['reflapack','openblas ']
BLAS_EXTRA_LINK_ARGS = []

Notice the extra space. As it happens openblas.pc has a space after "-lopenblas" but this is not the cause of the problem. cblas-reference doesn't but cvxopt will fail the same way if it is eselected.

Numpy and scipy are unaffected, in their case we populate a "site.cfg" file which seems to protect them from the problem.

Steve suggested that the current sed recipe in cvxopt should be changed to the following:
sed \
                -e 's/^-l//' \
                -e "s/ -l/\',\'/g" \
                -e 's/.,.pthread//g' \
                -e "s/[ \t]*$//")\'

This is also slightly different from the recipe used in numpy which was recently updated by jlec (and putting the current sed recipe from numpy doesn't solve the problem in cvxopt).

A final point there are at least 3 ebuilds in the tree and 1 in an overlay that have to parse pkg-config to produce something palatable to python. Should we we have a unique parsing script somewhere?
Comment 1 Burcin Erocal 2013-01-27 12:22:29 UTC
Maybe we should report the issue to pkg-config developers.

It seems that pkg-config-28 is rather new [1]. The announcement contains this
note:

    I believe the pkg-config output should be entirely compatible with
    current usage since the test suite has been extended quite a bit and
    catches regressions much better than it used to. That said, please see
    the details of the changes in the NEWS below, try out the latest
    release, and let us know if you're having any issues with pkg-config.

[1] http://lists.freedesktop.org/archives/pkg-config/2013-January/000912.html
Comment 2 François Bissey 2013-01-27 21:30:56 UTC
Yes definitely. Although it would be even better if we had a tool to parse pkg-config for python setuptools/distribute and distutils.
Comment 3 Thomas Kahle (RETIRED) gentoo-dev 2013-02-11 10:22:03 UTC
Hi, scipy also fails for me (bug 456280).
Comment 4 François Bissey 2013-02-11 17:23:02 UTC
(In reply to comment #3)
> Hi, scipy also fails for me (bug 456280).

so going down to pkgconfig 0.27.1 solved your scipy problems?
Comment 5 Thomas Kahle (RETIRED) gentoo-dev 2013-02-11 19:42:46 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Hi, scipy also fails for me (bug 456280).
> 
> so going down to pkgconfig 0.27.1 solved your scipy problems?

yes.
Comment 6 François Bissey 2013-02-11 19:55:23 UTC
Sorry I had answered without seeing the other bug first.
Comment 7 Justin Lecher (RETIRED) gentoo-dev 2013-02-24 19:12:18 UTC
I found the problem, will commit a fix soonish
Comment 8 Justin Lecher (RETIRED) gentoo-dev 2013-02-25 20:36:07 UTC
 25 Feb 2013; Sébastien Fabbro <bicatali@gentoo.org> cvxopt-1.1.5-r1.ebuild:
  Previous was wrong commmit

  25 Feb 2013; Sébastien Fabbro <bicatali@gentoo.org> cvxopt-1.1.5-r1.ebuild:
  Removed extra spaces generated by pkg-config