Date: Tue, 21 Jan 2020 23:40:33 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 243497] [patch] math/py-numpy build fails with OpenBlas Message-ID: <bug-243497-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D243497 Bug ID: 243497 Summary: [patch] math/py-numpy build fails with OpenBlas Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: python@FreeBSD.org Reporter: rsmith@xs4all.nl Flags: maintainer-feedback?(python@FreeBSD.org) Assignee: python@FreeBSD.org Attachment #210941 text/plain mime type: Created attachment 210941 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D210941&action= =3Dedit Updated files/patch-numpy-distutils-system_info.py 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 li= b. try: c.link_executable(obj, os.path.join(tmpdir, "a.out"), libraries=3D["cblas"], library_dirs=3Dinfo['library_dirs'], =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=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'], =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-243497-7788>