0

predecessors. I have a trouble in building RPM from my source code. It is written in Qt5 with Qt5.7.0. My system is Fedora 24. I installed qt-opensource-linux-x64-5.7.0.run and built my code successfully. But while building RPM, I have error in install stage.

My RPM file is as following.


    Name:           KPIViewer
    Version:        1.0
    Release:        1%{?dist}
    Summary:        KPIViewer

    Group:          Applications/Productivity
    License:        super2lao@gmail.com
    #Source0:        %{name}-%{version}-%(release).tar.gz
    Source0:        %{name}-%{version}.tar.gz
    #BuildArch:      i386
    BuildRoot:      %{_tmppath}/%{name}-root
    Packager:       PhonPanom Sivilay 
    Url:            [http://www.kjbsoft.com]
    Vendor:         PhonPanom Sivilay
    Requires:       libtool

    %define QT_LIB /opt/Qt5.7.0/5.7/gcc_64/lib/

    %description
    KPI Viewer

    %prep
    %setup -q -n %{name}-%{version}

    %build
    # % configure
    qmake KPIViewer.pro
    make %{?_smp_mflags} BINDIR=%{_bindir}

    %install
    mkdir -p $RPM_BUILD_ROOT/usr/{bin,share}
    mkdir -p $RPM_BUILD_ROOT/usr/bin/%{name}
    mkdir -p $RPM_BUILD_ROOT/usr/bin/%{name}/platforms
    mkdir -p $RPM_BUILD_ROOT/usr/share/{applications,pixmaps}
    mkdir -p $RPM_BUILD_ROOT%{QT_LIB}
    install %{name} $RPM_BUILD_ROOT/usr/bin/%{name}
    #install %{name}.sh $RPM_BUILD_ROOT/usr/bin/%{name}
    #install %{QT_LIB}libQt5*.so.* $RPM_BUILD_ROOT/usr/bin/%{name}
    #install %{QT_LIB}libicu*.so.* $RPM_BUILD_ROOT/usr/bin/%{name}
    #install %{QT_LIB}libq* $RPM_BUILD_ROOT/usr/bin/%{name}/platforms
    install %{QT_LIB}libQt5*.so.* $RPM_BUILD_ROOT%{QT_LIB}
    install %{QT_LIB}libicu*.so.* $RPM_BUILD_ROOT%{QT_LIB}
    install %{QT_LIB}libq* $RPM_BUILD_ROOT%{QT_LIB}
    #install %{name}.desktop $RPM_BUILD_ROOT/usr/share/applications
    #install %{name}.png $RPM_BUILD_ROOT/usr/share/pixmaps

    %files
    % defattr(-,root,root)
    %{_bindir}/%{name}/%{name}
    %{_bindir}/%{name}/%{name}.sh
    %{_bindir}/%{name}/libicu*
    %{_bindir}/%{name}/libQt5*
    %{_bindir}/%{name}/platforms/libq*
    %{_datadir}/applications/%{name}.desktop
    %{_datadir}/pixmaps/%{name}.png

    %clean
    rm -rf $RPM_BUILD_ROOT
    rm -rf $RPM_BUILD_DIR

    %changelog
        * Mon Aug 29 2016 super2lao
        - Initial build

But in installation stage, I get the following errors.


    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/usr/bin/KPIViewer/KPIViewer
    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1
    xz: /tmp/tmp.JB9sU3EDbZ: No such file or directory
    objcopy: cannot open: /tmp/tmp.JB9sU3EDbZ.xz: No such file or directory
    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56
    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56
    xz: /tmp/tmp.WVrLRUiOv4: No such file or directory
    objcopy: cannot open: /tmp/tmp.WVrLRUiOv4.xz: No such file or directory
    *** WARNING: identical binaries are copied, not linked:
            /opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56
        and  /opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1
    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1
    *** WARNING: identical binaries are copied, not linked:
            /opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1
        and  /opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56
    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56
    extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1
    *** WARNING: identical binaries are copied, not linked:
            /opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1
        and  /opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56
    dwz: Too few files for multifile optimization
    /usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 7 CRC32s did match.
    + '[' '%{buildarch}' = noarch ']'
    + QA_CHECK_RPATHS=1
    + case "${QA_CHECK_RPATHS:-}" in
    + /usr/lib/rpm/check-rpaths
    *******************************************************************************
    *
    * WARNING: 'check-rpaths' detected a broken RPATH and will cause 'rpmbuild'
    *          to fail. To ignore these errors, you can set the '$QA_RPATHS'
    *          environment variable which is a bitmask allowing the values
    *          below. The current value of QA_RPATHS is 0x0000.
    *
    *    0x0001 ... standard RPATHs (e.g. /usr/lib); such RPATHs are a minor
    *               issue but are introducing redundant searchpaths without
    *               providing a benefit. They can also cause errors in multilib
    *               environments.
    *    0x0002 ... invalid RPATHs; these are RPATHs which are neither absolute
    *               nor relative filenames and can therefore be a SECURITY risk
    *    0x0004 ... insecure RPATHs; these are relative RPATHs which are a
    *               SECURITY risk
    *    0x0008 ... the special '$ORIGIN' RPATHs are appearing after other
    *               RPATHs; this is just a minor issue but usually unwanted
    *    0x0010 ... the RPATH is empty; there is no reason for such RPATHs
    *               and they cause unneeded work while loading libraries
    *    0x0020 ... an RPATH references '..' of an absolute path; this will break
    *               the functionality when the path before '..' is a symlink
    *          
    *
    * Examples:
    * - to ignore standard and empty RPATHs, execute 'rpmbuild' like
    *   $ QA_RPATHS=$(( 0x0001|0x0010 )) rpmbuild my-package.src.rpm
    * - to check existing files, set $RPM_BUILD_ROOT and execute check-rpaths like
    *   $ RPM_BUILD_ROOT= /usr/lib/rpm/check-rpaths
    *  
    *******************************************************************************
    ERROR   0002: file '/usr/bin/KPIViewer/KPIViewer' contains an invalid rpath '/opt/Qt5.7.0/5.7/gcc_64/lib' in [/opt/Qt5.7.0/5.7/gcc_64/lib]
    error: Bad exit status from /var/tmp/rpm-tmp.CbBYR1 (%install)


    RPM build errors:
        Bad exit status from /var/tmp/rpm-tmp.CbBYR1 (%install)

What is my fault? Please help me. Thank you for your time.

PhonPanom
  • 385
  • 5
  • 8

1 Answers1

0

Fedora explains how to fix it here.

This usually works for me, in the spec file after the call to configure:

%configure
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • Thank you for your repsonse. By the way, I got this error with this. Can you guide me?
    + sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
    sed: can't read libtool: No such file or directory
    error: Bad exit status from /var/tmp/rpm-tmp.Qa4Ds9 (%build)
    
    – PhonPanom Aug 30 '16 at 03:35
  • If building by hand, after running `configure`, do you have `libtool`? – Aaron D. Marasco Aug 30 '16 at 13:02
  • As you can see, this is qt program. I don't use configure. Just used qmake. And installed libtool. – PhonPanom Aug 30 '16 at 17:07
  • Then copy it locally before the `sed` calls? I don't know anything about `qmake` sorry. – Aaron D. Marasco Aug 31 '16 at 00:21