openSUSE / obs-build

OBS build script, can be used with OBS or stand alone
GNU General Public License v2.0
130 stars 181 forks source link

Failure to build -x86_64-v3 hwcaps package when shared lib is an update-alternatives link #1001

Closed badshah400 closed 1 month ago

badshah400 commented 2 months ago

This came up when trying to enable -v3 hwcaps enhanced libs for lapack. As it turns out, lapack uses update-alternatives to create a symlink /usr/lib64/libblas.so.3 pointing to the real library /usr/lib64/blas/libblas.so.3 via update-alternatives called during post. The file /usr/lib64/libblas.so.3 does not exist a build-time, but created by update-alternatives during post install. It is also marked as %ghost in the package.

Apparently %{?suse_build_hwcaps_libs} cannot handle this. It tries to copy the non-existent — at build time — /usr/lib64/libblas.so.3 and fails catastrophically after actually generating the hwaps libs. This is what I see in the log. Note the error: mv: cannot stat '.cfiles/usr/lib64/liblapack.so.3': No such file or directory which suggests it is trying to move a non-existent file which will be created during post install:

[  218s] RPMLINT report:
[  218s] ===============
[  220s] ============================ rpmlint session starts ============================
[  220s] rpmlint: 2.5.0
[  220s] configuration:
[  220s]     /opt/testing/lib64/python3.11/rpmlint/configdefaults.toml
[  220s]     /opt/testing/share/rpmlint/cron-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/dbus-services.toml
[  220s]     /opt/testing/share/rpmlint/device-files-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/licenses.toml
[  220s]     /opt/testing/share/rpmlint/opensuse.toml
[  220s]     /opt/testing/share/rpmlint/pam-modules.toml
[  220s]     /opt/testing/share/rpmlint/permissions-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/pie-executables.toml
[  220s]     /opt/testing/share/rpmlint/polkit-rules-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/scoring.toml
[  220s]     /opt/testing/share/rpmlint/security.toml
[  220s]     /opt/testing/share/rpmlint/sudoers-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/sysctl-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/systemd-tmpfiles.toml
[  220s]     /opt/testing/share/rpmlint/users-groups.toml
[  220s]     /opt/testing/share/rpmlint/world-writable-whitelist.toml
[  220s]     /opt/testing/share/rpmlint/zypper-plugins.toml
[  220s] rpmlintrc:
[  220s]     /home/abuild/rpmbuild/SOURCES/lapack.rpmlintrc
[  220s] checks: 41, packages: 21
[  220s] 
[  220s] libblas3.x86_64: I: package-supports-update-alternatives
[  220s] libcblas3.x86_64: I: package-supports-update-alternatives
[  220s] liblapack3.x86_64: I: package-supports-update-alternatives
[  220s] liblapacke3.x86_64: I: package-supports-update-alternatives
[  220s] libblas3.x86_64_v3: I: package-supports-update-alternatives
[  220s] libcblas3.x86_64_v3: I: package-supports-update-alternatives
[  220s] liblapack3.x86_64_v3: I: package-supports-update-alternatives
[  220s] liblapacke3.x86_64_v3: I: package-supports-update-alternatives
[  220s] Check time report (>1% & >0.1s):
[  220s]     Check                            Duration (in s)   Fraction (in %)  Checked files
[  220s]     ExtractRpm                                   0.3              30.3               
[  220s]     SignatureCheck                               0.2              19.6               
[  220s]     BinariesCheck                                0.2              19.2               
[  220s]     SharedLibraryPolicyCheck                     0.2              16.2               
[  220s]     TOTAL                                        1.0             100.0               
[  220s] 
[  220s]  21 packages and 0 specfiles checked; 0 errors, 0 warnings, 131 filtered, 0 badness; has taken 1.1 s 
[  220s] 
[  220s] ... cleaning ccache
[  220s] setting SOURCE_DATE_EPOCH_MTIME to 1714856125
[  220s] 1
[  220s] ... saving ccache archive
[  220s] ... creating baselibs
[  220s] setting SOURCE_DATE_EPOCH_MTIME to 1714856125
[  220s] no targets for arch x86_64, skipping lapack-devel
[  220s] no targets for arch x86_64, skipping liblapack3
[  220s] no targets for arch x86_64, skipping lapacke-devel
[  220s] no targets for arch x86_64, skipping libblas3
[  220s] no targets for arch x86_64, skipping liblapacke3
[  220s] no targets for arch x86_64, skipping libcblas3
[  220s] no targets for arch x86_64, skipping cblas-devel
[  220s] no targets for arch x86_64, skipping blas-devel
[  220s] liblapack3(x86_64:x86-64-v3): writing specfile...
[  220s] liblapack3(x86_64:x86-64-v3): running build...
[  220s] rpmbuild failed: 256
[  220s] re-running in verbose mode:
[  220s] using SOURCE_DATE_EPOCH with value 1714856124 as build time
[  220s] Executing(%prep): /usr/bin/bash -e /var/tmp/rpm-tmp.r51odx
[  220s] + umask 022
[  220s] + cd /home/abuild/rpmbuild/BUILD
[  220s] + RPM_EC=0
[  220s] ++ jobs -p
[  220s] + exit 0
[  220s] Executing(%build): /usr/bin/bash -e /var/tmp/rpm-tmp.dHOH58
[  220s] + umask 022
[  220s] + cd /home/abuild/rpmbuild/BUILD
[  220s] + /usr/bin/rm -rf /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] ++ dirname /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + /usr/bin/mkdir -p /home/abuild/rpmbuild/BUILDROOT
[  220s] + /usr/bin/mkdir /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + RPM_EC=0
[  220s] ++ jobs -p
[  220s] + exit 0
[  220s] Executing(%install): /usr/bin/bash -e /var/tmp/rpm-tmp.Aiq5Zt
[  220s] + umask 022
[  220s] + cd /home/abuild/rpmbuild/BUILD
[  220s] + /usr/bin/rm -rf /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + /usr/bin/mkdir -p /home/abuild/rpmbuild/BUILDROOT
[  220s] + /usr/bin/mkdir /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + rm -rf /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + mkdir /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + cd /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + mkdir -p .cfiles
[  220s] + pushd .cfiles
[  220s] ~/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/.cfiles ~/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  220s] + cat
[  220s] + rpm2cpio //home/abuild/rpmbuild/RPMS/x86_64_v3/liblapack3-3.12.0-94.1.x86_64_v3.rpm
[  220s] + cpio -i -d -v -E .filelist
[  220s] ./usr/lib64/lapack/liblapack.so.3
[  221s] ./usr/lib64/lapack/liblapack.so.3.12.0
[  221s] 15311 blocks
[  221s] + popd
[  221s] ~/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64
[  221s] + mkdir -p /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/usr/lib64/glibc-hwcaps/x86-64-v3/lapack
[  221s] + mv .cfiles/usr/lib64/lapack/liblapack.so.3 /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/usr/lib64/glibc-hwcaps/x86-64-v3/lapack/liblapack.so.3
[  221s] + mkdir -p /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/usr/lib64/glibc-hwcaps/x86-64-v3/lapack
[  221s] + mv .cfiles/usr/lib64/lapack/liblapack.so.3.12.0 /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/usr/lib64/glibc-hwcaps/x86-64-v3/lapack/liblapack.so.3.12.0
[  221s] + mkdir -p /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/usr/lib64/glibc-hwcaps/x86-64-v3
[  221s] + mv .cfiles/usr/lib64/liblapack.so.3 /home/abuild/rpmbuild/BUILDROOT/lapack-3.12.0-94.1.x86_64/usr/lib64/glibc-hwcaps/x86-64-v3/liblapack.so.3
[  221s] mv: cannot stat '.cfiles/usr/lib64/liblapack.so.3': No such file or directory
[  221s] error: Bad exit status from /var/tmp/rpm-tmp.Aiq5Zt (%install)
[  221s] 
[  221s] RPM build errors:
[  221s]     Bad exit status from /var/tmp/rpm-tmp.Aiq5Zt (%install)
[  221s] ### VM INTERACTION START ###
[  221s] [  217.139930][    T1] sysrq: Power Off
[  221s] [  217.141087][   T10] reboot: Power down
[  221s] ### VM INTERACTION END ###
[  221s] 
[  221s] i01-ch1d failed "build lapack.spec" at Mon May  6 11:51:16 UTC 2024.
[  221s] 

FWIW, here is the baselibs.conf:

…

liblapack3
  -/usr/lib(64)?/liblapack.so.3
  requires "update-alternatives"
  postin "ln -sf /etc/alternatives/liblapack.so.3_<targettype> /usr/%_lib/liblapack.so.3"
  postin "/usr/sbin/update-alternatives --force --install /usr/%_lib/liblapack.so.3 liblapack.so.3_<targettype> /usr/%_lib/lapack/liblapack.so.3  50"
  postun "/usr/sbin/update-alternatives --remove liblapack.so.3_<targettype> /usr/%_lib/lapack/liblapack.so.3"

…

And here is the full build log if it helps (from https://build.opensuse.org/package/show/home:badshah400:lapackv3/lapack): _log.gz

adrianschroeter commented 2 months ago

suse_build_hwcaps_libs is a definition of openSUSE:Factory, so I don't see what we should do here in the build script code?

badshah400 commented 2 months ago

OK, sorry, my mistake. I know this is a Factory macro but thought the main work is done by mkbaselibs. Guess I'll open a bugzilla issue. Thanks for the response.

badshah400 commented 1 month ago

Fixed, I think, by commit f7d979e64ee85209b36127747a92b93a415649de for mkbaselibs