Opened 5 years ago

Closed 5 years ago

#23797 closed defect (fixed)

Cygwin: openblas does not install correctly

Reported by: embray Owned by:
Priority: critical Milestone: sage-8.1
Component: porting: Cygwin Keywords: openblas
Cc: Merged in:
Authors: Erik Bray Reviewers: Jeroen Demeyer
Report Upstream: Fixed upstream, but not in a stable release. Work issues:
Branch: 6799ec0 (Commits, GitHub, GitLab) Commit: 6799ec06e61bd91cce0aab376efbe80221eafd01
Dependencies: Stopgaps:

Status badges

Description (last modified by embray)

For most of the time I've worked on Cygwin, I've been building with Cygwin's system BLAS (which I don't think is actually ATLAS, but using --with-blas=atlas and the appropriate SAGE_ATLAS_LIB picks it up and runs with it).

Recently I had to restart the Cygwin patchbot and forgot to configure it with these settings, so it built openblas (which seems to build successfully) but then grinds to a halt. I think I was already aware there were problems like this with openblas and just didn't deal with it since there was a good workaround. Still, it should be fixed.

The problem in scipy is that it simply fails to detect a BLAS library during its setup.py egg_info.

Similarly, gsl fails at configure time with:

[gsl-2.3] checking whether the C compiler works... no
[gsl-2.3] configure: error: in `/home/Admin/src/sagemath/sage/local/var/tmp/sage/build/gsl-2.3/src':
[gsl-2.3] configure: error: C compiler cannot create executables
[gsl-2.3] See `config.log' for more details
[gsl-2.3] Error configuring GSL.

where config.log shows:

configure:3480: checking whether the C compiler works
configure:3502: gcc -g -O2   -L/home/Admin/src/sagemath/sage/local/lib -Wl,-rpath,/home/Admin/src/sagemath/sage/local/lib  conftest.c -lopenblas -lm >&5
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lopenblas
collect2: error: ld returned 1 exit status
configure:3506: $? = 1
configure:3544: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "gsl"
| #define PACKAGE_TARNAME "gsl"
| #define PACKAGE_VERSION "2.3"
| #define PACKAGE_STRING "gsl 2.3"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "gsl"
| #define VERSION "2.3"
| #define RELEASED /**/
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3549: error: in `/home/Admin/src/sagemath/sage/local/var/tmp/sage/build/gsl-2.3/src':
configure:3551: error: C compiler cannot create executables

So it both cases it looks like it's trying to explicitly link -lopenblas.

It seems that under $SAGE_LOCAL/bin there is a libopenblas.dll, and there is no libopenblas.dll.a import lib under $SAGE_LOCAL/lib. There are a couple problems with this:

1) While current versions of gcc for Cygwin do not technically need a separate import lib (.dll.a), and can generate one directly from a .dll, the defaults (as explained [here https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/win32.html]) are such that on Cygwin there is a convention of prefixing library names with cyg instead of lib, and so for ld to find the right file for -lopenblas its name must be cygopenblas.dll.

2) Even if we had cygopenblas.dll, -L $SAGE_LOCAL/bin needs to be explicitly added to the linker flags to search in bin.

Instead I've been trying to keep the Cygwin build consistent about explicitly using import libs since that requires less fiddling. So I'll investigate what needs to be fixed for openblas to install properly on Cygwin.

Upstream pull request: https://github.com/xianyi/OpenBLAS/pull/1293

Change History (5)

comment:1 Changed 5 years ago by embray

Authors: Erik Bray
Branch: u/embray/cygwin/ticket-23797
Commit: 6799ec06e61bd91cce0aab376efbe80221eafd01
Keywords: openblas added
Priority: majorcritical
Report Upstream: N/ANot yet reported upstream; Will do shortly.
Status: newneeds_review

Adds a patch for this issue, which I will also submit upstream.


New commits:

6799ec0Patches openblas to install in a more canonical way on Cygwin:

comment:2 Changed 5 years ago by embray

Description: modified (diff)
Report Upstream: Not yet reported upstream; Will do shortly.Reported upstream. No feedback yet.

comment:3 Changed 5 years ago by embray

Report Upstream: Reported upstream. No feedback yet.Fixed upstream, but not in a stable release.

comment:4 Changed 5 years ago by jdemeyer

Reviewers: Jeroen Demeyer
Status: needs_reviewpositive_review

If this works for you...

comment:5 Changed 5 years ago by vbraun

Branch: u/embray/cygwin/ticket-237976799ec06e61bd91cce0aab376efbe80221eafd01
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.