Date: Tue, 21 Jan 2020 23:40:33 +0000 From: bugzilla-noreply@freebsd.org To: python@FreeBSD.org Subject: maintainer-feedback requested: [Bug 243497] [patch] math/py-numpy build fails with OpenBlas Message-ID: <bug-243497-21822-uLQhfzrTFD@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-243497-21822@https.bugs.freebsd.org/bugzilla/> References: <bug-243497-21822@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-python mailing list <python@FreeBSD.org> for maintainer-feedback: Bug 243497: [patch] math/py-numpy build fails with OpenBlas https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D243497 --- Description --- TL;DR * Problem: Compiling py37-numpy-1.16.5_3,1 with OpenBlas fails in numpy/distutils/system_info.py with an uncaught distutils.errors.LinkError exception. * Solution: also catch distutils.errors.LinkError on line 1742 of numpy/distutils/system_info.py. This is the error (only the last part shown for clarity). File "/usr/ports/math/py-numpy/work-py37/numpy-1.16.5/numpy/distutils/system_inf= o.py ", line 1740, in has_cblas extra_postargs=3Dinfo.get('extra_link_args', [])) File "/usr/local/lib/python3.7/distutils/ccompiler.py", line 734, in link_executable debug, extra_preargs, extra_postargs, None, target_lang) File "/usr/local/lib/python3.7/distutils/unixccompiler.py", line 206, in link raise LinkError(msg) distutils.errors.LinkError: Command "cc /tmp/tmpm3gnb0ev/tmp/tmpm3gnb0ev/source.o -L/usr/local/lib -lblas -o /tmp/tmpm3gnb0ev/a.out" failed with exit status 1 *** Error code 1 Stop. make[1]: stopped in /usr/ports/math/py-numpy *** Error code 1 Stop. make: stopped in /usr/ports/math/py-numpy This is the relevant code: try: with open(src, 'wt') as f: f.write(s) try: # check we can compile (find headers) obj =3D c.compile([src], output_dir=3Dtmpdir, include_dirs=3Dself.get_include_dirs()) # check we can link (find library) # some systems have separate cblas and blas libs. First # check for cblas lib, and if not present check for blas lib. try: c.link_executable(obj, os.path.join(tmpdir, "a.out"), libraries=3D["cblas"], library_dirs=3Dinfo['library_dirs'], =09=09=09=09=20=20=20=20=20 extra_postargs=3Dinfo.get('extra_link_args', [])) res =3D "cblas" except distutils.ccompiler.LinkError: c.link_executable(obj, os.path.join(tmpdir, "a.out"), libraries=3D["blas"], library_dirs=3Dinfo['library_dirs'], =09=09=09=09=20=20=20=20=20 extra_postargs=3Dinfo.get('extra_link_args', [])) res =3D "blas" except distutils.ccompiler.CompileError: res =3D None finally: shutil.rmtree(tmpdir) return res If linking with =E2=80=9Ccblas=E2=80=9D fails, it tries again by linking wi= th =E2=80=9Cblas=E2=80=9D. However, the last =E2=80=9Cexcept=E2=80=9D only handles a compilation error= but not a linking error. When we change: except distutils.ccompiler.CompileError: to except (distutils.ccompiler.CompileError, distutils.ccompiler.LinkError): the problem is fixed.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-243497-21822-uLQhfzrTFD>