rpmbuild fails on one machine, works on another.

Issues related to applications and software problems and general support
Post Reply
iwishitwouldwork
Posts: 80
Joined: 2014/02/08 14:56:39

rpmbuild fails on one machine, works on another.

Post by iwishitwouldwork » 2021/05/16 05:27:14

I have a trivial "null" package. The binary prints null, like hello, world and that's all.

On my fs machine, it fails.
On my ws machine, it works.
Both machines are up to date on patches.

I captured the output from both machines and did a diff.

Code: Select all

diff rot badrot 
1c1
< Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.z5Zspc
---
> Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.JaixiE 
13c13
< Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.UFJKtc
---
> Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.XrtBbG
120c120
< Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.8zE5T9
---
> Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.6ROaXG
137a138,139
> /usr/lib/rpm/check-buildroot: line 32: 2356569 Done                    find "$RPM_BUILD_ROOT" \! \( -name '*.pyo' -o -name '*.pyc' -o -name '*.elc' -o -name '.packlist' \) -type f -print0
>      2356570 Segmentation fault      (core dumped) | LANG=C xargs -0r -P$NCPUS -n16 grep -F "$RPM_BUILD_ROOT" >> $tmp
144,159c146,153
< + /usr/lib/rpm/brp-python-bytecompile '' 1
< + /usr/lib/rpm/brp-python-hardlink
< + PYTHON3=/usr/libexec/platform-python
< + /usr/lib/rpm/redhat/brp-mangle-shebangs
< Processing files: null-0.0.0-1.el8.x86_64
< Provides: null = 0.0.0-1.el8 null(x86-64) = 0.0.0-1.el8
< Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
< Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libgcc_s.so.1()(64bit) libm.so.6()(64bit) libstdc++.so.6()(64bit) rtld(GNU_HASH)
< Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/null-0.0.0-1.el8.x86_64
< Wrote: /root/rpmbuild/RPMS/x86_64/null-0.0.0-1.el8.x86_64.rpm
< Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.Qm8hYb
< + umask 022
< + cd /root/rpmbuild/BUILD
< + cd null-0.0.0
< + rm -rf /root/rpmbuild/BUILDROOT/null-0.0.0-1.el8.x86_64
< + exit 0
---
> /usr/lib/rpm/brp-strip-static-archive: line 18: 2356597 Done                    find "$RPM_BUILD_ROOT" -type f
>      2356598                       | grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"
>      2356599 Segmentation fault      (core dumped) | xargs -d '\n' -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed 's/:  */: /' | grep 'current ar archive' | sed -n -e 's/^\(.*\):[  ]*current ar archive/\1/p' | xargs -d '\n' -I\{\} $STRIP -g \{\}" ARG0
> error: Bad exit status from /var/tmp/rpm-tmp.6ROaXG (%install)
> 
> 
> RPM build errors:
>     Bad exit status from /var/tmp/rpm-tmp.6ROaXG (%install)

It looks like the problem occurs when it tries to run /usr/lib/rpm/check-buildroot .
That file is identical on the two machines.

I have tried to cd /var/tmp on the failing machine, I tried to execute the contents
of that file line by line.

Code: Select all

#!/bin/sh

  RPM_SOURCE_DIR="/root/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/root/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-
strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection"
  RPM_LD_FLAGS="-Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  RPM_BUILD_NCPUS="4"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS RPM_BUILD_NCPUS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="null"
  RPM_PACKAGE_VERSION="0.0.0"
  RPM_PACKAGE_RELEASE="1.el8"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/root/rpmbuild/BUILDROOT/null-0.0.0-1.el8.x86_64"
  export RPM_BUILD_ROOT
  
  PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
  CONFIG_SITE=${CONFIG_SITE:-NONE}
  export CONFIG_SITE
  PYTHON_DISALLOW_AMBIGUOUS_VERSION=warn
  export PYTHON_DISALLOW_AMBIGUOUS_VERSION
  
  set -x
  umask 022
  cd "/root/rpmbuild/BUILD"
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
    mkdir -p `dirname "$RPM_BUILD_ROOT"`
    mkdir "$RPM_BUILD_ROOT"

cd 'null-0.0.0'

rm -rf /root/rpmbuild/BUILDROOT/null-0.0.0-1.el8.x86_64
make install DESTDIR=/root/rpmbuild/BUILDROOT/null-0.0.0-1.el8.x86_64




    
    /usr/lib/rpm/check-buildroot
    
    /usr/lib/rpm/redhat/brp-ldconfig 
    /usr/lib/rpm/brp-compress 
    
    /usr/lib/rpm/brp-strip /usr/bin/strip 
    /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump 
     
    /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip 
    /usr/lib/rpm/brp-python-bytecompile "" 1 
    /usr/lib/rpm/brp-python-hardlink 
    PYTHON3="/usr/libexec/platform-python" /usr/lib/rpm/redhat/brp-mangle-shebangs     

And I'm stumped. The odd thing that I see is that check-buildroot references $NCPUS
but the script exports RPM_BUILD_NCPUS . I tried fixing that in case NCPUS was
undefined, but no joy.

localectl returns the same answer on both. If it's in the environment variables what could it
be? I don't set any RPM* variables on either machine. /root/rpmbuild has no stray files on
either machine.

sml
Posts: 259
Joined: 2020/01/17 09:01:44

Re: rpmbuild fails on one machine, works on another.

Post by sml » 2021/05/16 12:23:05

What's in your ~/.rpmmacros? Here is mine:

Code: Select all

%_topdir %(echo $HOME)/rpmbuild

%_smp_mflags %( \
    [ -z "$RPM_BUILD_NCPUS" ] \\\
        && RPM_BUILD_NCPUS="`/usr/bin/nproc 2>/dev/null || \\\
                             /usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
    if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then \\\
        echo "-j16"; \\\
    elif [ "$RPM_BUILD_NCPUS" -gt 3 ]; then \\\
        echo "-j$RPM_BUILD_NCPUS"; \\\
    else \\\
        echo "-j3"; \\\
    fi )

%__arch_install_post \
    [ "%{buildarch}" = "noarch" ] || QA_CHECK_RPATHS=1 ; \
    case "${QA_CHECK_RPATHS:-}" in [1yY]*) /usr/lib/rpm/check-rpaths ;; esac \
    /usr/lib/rpm/check-buildroot
iwishitwouldwork wrote:
2021/05/16 05:27:14
The odd thing that I see is that check-buildroot references $NCPUS, but the script exports RPM_BUILD_NCPUS.
NCPUS is defined inside /usr/lib/rpm/check-buildroot thusly:

Code: Select all

NCPUS=${RPM_BUILD_NCPUS:-1}

Post Reply

Return to “CentOS 8 - General Support”