2016-08-29 2 views
0

prédécesseurs. J'ai un problème pour créer RPM à partir de mon code source. Il est écrit en Qt5 avec Qt5.7.0. Mon système est Fedora 24. J'ai installé qt-opensource-linux-x64-5.7.0.run et construit mon code avec succès. Mais lors de la construction de RPM, j'ai une erreur dans l'étape d'installation.Construire RPM de Qt5 Application

Mon fichier RPM est le suivant.

 

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

    Group:   Applications/Productivity 
    License:  [email protected] 
    #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 

Mais lors de l'installation, j'obtiens les erreurs suivantes.

 

    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) 

Quelle est ma faute? S'il vous plaît aidez-moi. Merci pour votre temps.

Répondre

0

Fedora explique comment résoudre ce problème here.

Cela fonctionne habituellement pour moi, dans le fichier de spécification après l'appel à 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 
+0

Merci pour votre repsonse. En passant, j'ai eu cette erreur avec ça. Pouvez-vous me guider?

 + 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

+0

Si vous construisez à la main, après avoir exécuté 'configure', avez-vous' libtool'? –

+0

Comme vous pouvez le voir, c'est un programme qt. Je n'utilise pas configure. Juste utilisé qmake. Et installé libtool. – PhonPanom