Bug 243739

Summary: math/openblas: port build only successful with option DYNAMIC_ARCH set
Product: Ports & Packages Reporter: Martin Birgmeier <d8zNeCFG>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: phd_kimberlite, rhurlin, rsmith, swills, tatsuki_makino, vvd, w.schwarzenfeld
Priority: --- Flags: w.schwarzenfeld: maintainer-feedback? (phd_kimberlite)
Version: Latest   
Hardware: Any   
OS: Any   

Description Martin Birgmeier 2020-01-30 19:06:55 UTC
- ports tree at r524653
- building math/openblas using portmaster
- selecting default build options, which is none (interactive default)

- Instead of libopenblasp-r0.3.7.so a library libopenblasp-rnehalem0.3.7.so (or other architecture specific) library is built, breaking the install stage

- Building using automated package building etc. does not uncover this issue because in that case, DYNAMIC_ARCH is set by default.

Proposed fix:
- DYNAMIC_ARCH should not be an option but be set unconditionally.

-- Martin
Comment 1 rsmith 2020-01-30 20:23:35 UTC
As a confirmation; I have the same issue. (12.1-STABLE, amd64).
Comment 2 Walter Schwarzenfeld freebsd_triage 2020-01-30 21:09:51 UTC
===>   Registering installation for openblas-0.3.7_1,1
pkg-static: Unable to access file /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp@comment -r0.3.7.a:No such file or directory
pkg-static: Unable to access file /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.7.so:No such file or directory
*** Error code 74

ls -al /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas*
-rw-r--r--  1 root  wheel  28864528 30 Jan. 21:50 /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas_barcelonap-r0.3.7.a
-rwxr-xr-x  1 root  wheel  14670760 30 Jan. 22:07 /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas_barcelonap-r0.3.7.so
lrwxr-xr-x  1 root  wheel        31 30 Jan. 22:07 /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas.a -> libopenblas_barcelonap-r0.3.7.a
lrwxr-xr-x  1 root  wheel        32 30 Jan. 22:07 /usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas.so -> libopenblas_barcelonap-r0.3.7.so
Comment 3 Walter Schwarzenfeld freebsd_triage 2020-01-30 21:26:55 UTC
the line with @comment is not the original error (this was my error).
Comment 4 Tatsuki Makino 2020-01-31 05:28:17 UTC
${WRKSRC}/Makefile.prebuild builds getarch.
getarch outputs LIBCORE=*** to somewhere.
${WRKSRC}/Makefile.system picks up LIBCORE from somewhere and concat it to LIBNAME.

Should we disguise LIBCORE to a fixed value?
Comment 5 VVD 2020-01-31 09:43:27 UTC
Same here:
===>   Registering installation for openblas-0.3.7_1,1
pkg-static: Unable to access file /usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.7.a:No such file or directory
pkg-static: Unable to access file /usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblasp-r0.3.7.so:No such file or directory
*** Error code 74

# ls /usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas*

Comment 6 Walter Schwarzenfeld freebsd_triage 2020-01-31 10:02:01 UTC
(In reply to Tatsuki Makino from comment #4)
Or maybe, we can do something like this:

        ${MV} ${STAGEDIR}${PREFIX}/lib/libopenblas_*-r${PORTVERSION}.a \
        ${MV} ${STAGEDIR}${PREFIX}/lib/libopenblas_*-r${PORTVERSION}.so \
        ${RM} ${STAGEDIR}${PREFIX}/lib/libopenblas.a
        ${RM} ${STAGEDIR}${PREFIX}/lib/libopenblas.so
        ${LN} -sf libopenblasp-r${PORTVERSION}.a \
        ${LN} -sf libopenblasp-r${PORTVERSION}.so \
Comment 7 Martin Birgmeier 2020-01-31 10:40:46 UTC
For me it would be important to build a generic library because I am installing the packages on various architectures.

This is why I would prefer DYNAMIC_ARCH to be set unconditionally.

The alternative would be to build some kind of generic version which would work on "most" 64-bit processors. Specifically for me "most" is architectures since 2010. :-) But that would nullify any optimizations offered by later architectures.

-- Martin
Comment 8 commit-hook freebsd_committer 2020-01-31 14:58:22 UTC
A commit references this bug:

Author: swills
Date: Fri Jan 31 14:57:32 UTC 2020
New revision: 524713
URL: https://svnweb.freebsd.org/changeset/ports/524713

  math/openblas: fix plist with DYNAMIC_ARCH off

  This is further fallout from r523749 and r524642

  While here, fix order of PORTREVISION. There is no PORTREVISION bump
  because this a build fix.

  PR:		231371
  PR:		243739
  Reported by:	many

Comment 9 Steve Wills freebsd_committer 2020-01-31 14:59:09 UTC
I believe this is fixed, please let me know if there's still an issue.
Comment 10 Tatsuki Makino 2020-02-01 02:06:16 UTC
(In reply to Steve Wills from comment #9)
I think it is a perfect fix for all LIBCORE.
Thank you very much.
Comment 11 Tatsuki Makino 2020-02-03 00:00:46 UTC
The package is fine, but there is no library with a /^libopenblas.*\.so\.[[:digit:]]/ style file name.
It is scanned by libpkg (libpkg/elfhints.c) and ldconfig (sbin/ldconfig/ldconfig.c).
It causes errors like:
py37-numpy is missing a required shared library: libopenblas.so