1

I am new in building rpm package.For Creating RPM for my binary I have following dependancies:

[tejas@target]$ ldd exe
    linux-vdso.so.1 =>  (0x00007fff85bff000)
    libQtWebKit.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtWebKit.so.4 (0x00007f868c4e8000)
    libphonon.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libphonon.so.4 (0x00007f868c288000)
    libQtScript.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtScript.so.4 (0x00007f868bdd3000)
    libQt3Support.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQt3Support.so.4 (0x00007f868b8b5000)
    libQtSql.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtSql.so.4 (0x00007f868b66f000)
    libQtXml.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtXml.so.4 (0x00007f868b426000)
    libQtGui.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtGui.so.4 (0x00007f868a6c7000)
    libQtNetwork.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtNetwork.so.4 (0x00007f868a369000)
    libQtCore.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtCore.so.4 (0x00007f8689e72000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003cd2200000)
    libqwt.so.6 => /usr/lib64/libqwt.so.6 (0x00007f8689b4e000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003cd8200000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003cd1a00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003cd7e00000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003cd1600000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003cd1e00000)
    libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x000000373ba00000)
    libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00000030aa000000)
    libgstapp-0.10.so.0 => /usr/lib64/libgstapp-0.10.so.0 (0x00000034f2e00000)
    libgstinterfaces-0.10.so.0 => /usr/lib64/libgstinterfaces-0.10.so.0 (0x00000034f0e00000)
    libgstpbutils-0.10.so.0 => /usr/lib64/libgstpbutils-0.10.so.0 (0x00000034f1a00000)
    libgstvideo-0.10.so.0 => /usr/lib64/libgstvideo-0.10.so.0 (0x00000034f2200000)
    libgstbase-0.10.so.0 => /usr/lib64/libgstbase-0.10.so.0 (0x00000034f1e00000)
    libgstreamer-0.10.so.0 => /usr/lib64/libgstreamer-0.10.so.0 (0x00000034f1600000)
    libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00000030b1200000)
    libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00000030a9800000)
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x0000003cdba00000)
    libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00000030b4400000)
    librt.so.1 => /lib64/librt.so.1 (0x0000003cd2a00000)
    libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00000030b0e00000)
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x0000003cd5e00000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003cd5a00000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x000000373b600000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x0000003e83600000)
    libQtDBus.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtDBus.so.4 (0x00007f86898c1000)
    libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003cd5600000)
    libz.so.1 => /lib64/libz.so.1 (0x0000003cd2600000)
    libSM.so.6 => /usr/lib64/libSM.so.6 (0x000000373d200000)
    libICE.so.6 => /usr/lib64/libICE.so.6 (0x0000003cdb200000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003cd1200000)
    libQtSvg.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtSvg.so.4 (0x00007f8689662000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003cd3600000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003cd2e00000)
    libexpat.so.1 => /lib64/libexpat.so.1 (0x0000003cd5200000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x0000003e82600000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x0000003e83200000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x0000003e81e00000)

So I have checked from which rpm I can get those libraries by rpm -qf <library path> command.
eg:

[tejas@target]$ rpm -qf /lib64/libpthread.so.0
glibc-2.12-1.80.el6_3.5.x86_64

I have also checked which minimum version should be available for that library. So, accordingly I made spec file including all those packges.

My .spec file is:

[tejas@target]$ cat /home/tejas/rpmbuild/SPECS/ModCMS-gdm.spec
Name:   ModCMS-gdm  
Version:1.0 
Release:1
Summary:gdm     

Group:  ModCMS  
License:WESEE   
URL:    http://wesee.org    
Source0:ModCMS-gdm-1.0.tar.gz   

Requires:dbus-libs >= 1.2.24
Requires:expat >= 2.0.1
Requires:fontconfig >= 2.8.0
Requires:freetype >= 2.3.11
Requires:glib2 >= 2.22.5
Requires:glibc >= 2.12
Requires:keyutils-libs >= 1.4
Requires:krb5-libs >= 1.8.2
Requires:libasyncns >= 0.8
Requires:libcom_err >= 1.41.12
Requires:libgcc >= 4.4.4
Requires:libICE >= 1.0.6
Requires:libpng >= 1.2.44
Requires:libqwt6 = 6.0.1
Requires:libselinux >= 2.0.94
Requires:libSM >= 1.1.0
Requires:libsndfile >= 1.0.20
Requires:libstdc++ >= 4.4.4
Requires:libuuid >= 2.17.2
Requires:libXau >= 1.0.5
Requires:libxcb >= 1.5
Requires:libXcursor >= 1.1.10
Requires:libXext >= 1.1
Requires:libXfixes >= 4.0.4
Requires:libXi >= 1.3
Requires:libXinerama >= 1.1
Requires:libXrandr >= 1.3.0
Requires:libXrender >= 0.9.5
Requires:libXtst >= 1.0.99.2
Requires:openssl >= 1.0.1e
Requires:pulseaudio-libs >= 0.9.21
Requires:qt48 >= 4.8.5
Requires:qt48-x11 >= 4.8.5
Requires:qtwebkit >= 2.0
Requires:sqlite >= 3.6.20
Requires:tcp_wrappers-libs >= 7.6
Requires:zlib >= 1.2.3


%description
This is Just to test various files allocation through rpm build

%prep
%setup -q

%install
mkdir -p "$RPM_BUILD_ROOT/root/ModCMS"
cp -r GDM.tar.gz "$RPM_BUILD_ROOT/root/ModCMS/"

%files
/root/ModCMS/GDM.tar.gz

%clean
rm -rf $RPM_BUILD_ROOT

%post
cd /root/ModCMS/
tar xzf GDM.tar.gz

Now my questions are :

  • How do I mansion dependency libraries directly instead of rpm?
  • Is it necessary to include all those dependencies in Required field?
  • How do I minimize them?

I have searched, but couldn't find specific solution.

  • 1
    rpm should do it automatically based on ldd output. See rpm.org/wiki/PackagerDocs/Dependencies#AutomaticDependencies – Mikel Apr 3 '14 at 5:18
  • but my RPM package contains compressed zip files which also contains my binary, I just need to extract that zip file in particular location. – TPS Apr 3 '14 at 5:27
  • Why do they need to be inside a zip file? Things will be easier without it. – Mikel Apr 3 '14 at 15:02
  • because there are more than 800 files which ,I guess!, I need to specify in .spec files %files field. – TPS Apr 3 '14 at 17:22
  • 1
    %files takes an -f filename option. Or you could generate the %files block based on unzip -l or tar -t output. – Mikel Apr 3 '14 at 18:26
2

It depends.

If you are building for a specific distribution, depending on other rpms is ok.

If building for different distributions, rather use library/file names, as the rpm-names where that lib is contained might differ.

  • no I need to build for my current distribution only. – TPS Apr 3 '14 at 17:25
  • @Tejas so go for rpms. That way your spec should survive all minor and some major release updates. – Nils Apr 5 '14 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.