Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindCBLAS.cmake: s/cblas/blas in pkg-config mode #1037

Closed

Conversation

ghisvail
Copy link
Contributor

@ghisvail ghisvail commented Oct 1, 2015

BLAS detection does not work on Debian / Ubuntu due to the libblas-dev package shipping a blas.pc alongside headers and libraries and not a cblas.pc. This patch solves the detection.

@pavanky
Copy link
Member

pavanky commented Oct 1, 2015

@ghisvail This was contributed by @marbre to work on Gentoo. Replacing cblas with blas may break builds on his package.

@marbre Can you check if simply using blas instead of cblas works on gentoo ? If so we could just accept the change. If not we should perhaps check for blas when cblas fails ?

@ghisvail
Copy link
Contributor Author

ghisvail commented Oct 1, 2015

It would not harm to check for both.

@marbre
Copy link
Contributor

marbre commented Oct 3, 2015

On Gentoo cblas and blas can be provided by different packages. For example the user can install blas-reference and cblas-reference. Another possibility is to install Atlas, which provides both. The user finally can choose which library to use with eselect {blas,cblas}.

Of cause, cblas requires a blas package installed, but not the other way around. Thus, checking for blas, it can not be guaranteed that cblas is available. Further cblas.pc and blas.pc pass back different Libs:

_cblas.pc_

prefix=/usr
libdir=${prefix}/lib64
includedir=${prefix}/include
Name: refcblas
Description: C wrapper interface to the F77 reference BLAS implementation
Version: 20110218
URL: http://www.netlib.org/blas/
Libs: -L${libdir} -lrefcblas
Private: -lm
Cflags: -I${includedir}/cblas
Requires: blas

_blas.pc_

prefix=/usr
libdir=/usr/lib64

Name: refblas
Description: Basic Linear Algebra Subprograms F77 reference implementations
Version: 
URL: http://www.netlib.org/refblas/
Libs: -L/usr/lib64 -lrefblas
Libs.private: -lm

I assume the cleanest way could be that Debian provides a blas.pc and a cblas.pc, with libblas-dev and libatlas-base-dev. But thats somehow a matter of taste.
If not, and if PKG_CHECK_MODULES(PC_CBLAS cblas) fails, the cblas can still be found with the other code in the FindCBLAS.cmake module, which I didn't touched. Thus, detecting cblas should also work on Debian without the patch, since I assume it worked before commit 644d074.

@pavanky
Copy link
Member

pavanky commented Oct 3, 2015

@marbre thanks for the feedback.

@ghisvail I am on vacation and have limited time for testing. Do you mind maintaining this patch in your fork until we have a more permanent fix ?

@ghisvail
Copy link
Contributor Author

@pavanky I am happy to hold on that patch. Afterall, it is distro specific.

On Gentoo cblas and blas can be provided by different packages.
Also the case on Arch apparently. Not the case on Debian and Fedora derivatives.

I assume the cleanest way could be that Debian provides a blas.pc and a cblas.pc.
Fair point, worth asking the Debian maintainers about this.

Since I don't want to break Gentoo's setup, I am now convinced that this patch should be kept downstream on Debian.

Feel free to close if you agree.

@ghisvail ghisvail closed this Nov 21, 2015
@ghisvail ghisvail deleted the bugfix/cmake-blas-detection branch November 21, 2015 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants