Bug 243739 - math/openblas: port build only successful with option DYNAMIC_ARCH set
Summary: math/openblas: port build only successful with option DYNAMIC_ARCH set
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-30 19:06 UTC by Martin Birgmeier
Modified: 2020-02-03 00:00 UTC (History)
7 users (show)

See Also:
w.schwarzenfeld: maintainer-feedback? (phd_kimberlite)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2020-01-30 19:06:55 UTC
Scenario:
- ports tree at r524653
- building math/openblas using portmaster
- selecting default build options, which is none (interactive default)

Result:
- 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

Note:
- 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 Vladimir Druzenko freebsd_committer freebsd_triage 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*
/usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas_penrynp-r0.3.7.a
/usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas_penrynp-r0.3.7.so
/usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas.a
/usr/obj/usr/ports/math/openblas/work/stage/usr/local/lib/libopenblas.so

OPTIONS_FILE_UNSET+=AVX
OPTIONS_FILE_UNSET+=AVX2
OPTIONS_FILE_UNSET+=DYNAMIC_ARCH
OPTIONS_FILE_UNSET+=INTERFACE64
OPTIONS_FILE_UNSET+=OPENMP
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:

post-install:
.if !${PORT_OPTIONS:MDYNAMIC_ARCH}
        ${MV} ${STAGEDIR}${PREFIX}/lib/libopenblas_*-r${PORTVERSION}.a \
                 ${STAGEDIR}${PREFIX}/lib/libopenblasp-r${PORTVERSION}.a
        ${MV} ${STAGEDIR}${PREFIX}/lib/libopenblas_*-r${PORTVERSION}.so \
                 ${STAGEDIR}${PREFIX}/lib/libopenblasp-r${PORTVERSION}.so
        ${RM} ${STAGEDIR}${PREFIX}/lib/libopenblas.a
        ${RM} ${STAGEDIR}${PREFIX}/lib/libopenblas.so
        ${LN} -sf libopenblasp-r${PORTVERSION}.a \
                ${STAGEDIR}${PREFIX}/lib/libopenblas.a
        ${LN} -sf libopenblasp-r${PORTVERSION}.so \
                ${STAGEDIR}${PREFIX}/lib/libopenblas.so
.endif
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 freebsd_triage 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

Log:
  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

Changes:
  head/math/openblas/Makefile
  head/math/openblas/pkg-plist
Comment 9 Steve Wills freebsd_committer freebsd_triage 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