Wednesday, July 9, 2014

Rdesktop on CentOS 7

I tried to install rdesktop rpm. But I didn't manage to find rpm for centos 7. Only rpm I could find was one from repoforge (http://pkgs.repoforge.org/rdesktop/). Unfortunatelly installation failed on missing dependency:

[root@centos-7 ~]# yum --nogpgcheck localinstall rdesktop-1.8.2-0.1.el6.rfx.x86_64.rpm 
Loaded plugins: fastestmirror
Examining rdesktop-1.8.2-0.1.el6.rfx.x86_64.rpm: rdesktop-1.8.2-0.1.el6.rfx.x86_64
Marking rdesktop-1.8.2-0.1.el6.rfx.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rdesktop.x86_64 0:1.8.2-0.1.el6.rfx will be installed
--> Processing Dependency: libao.so.2()(64bit) for package: rdesktop-1.8.2-0.1.el6.rfx.x86_64
Loading mirror speeds from cached hostfile
 * base: centos.ionic.net.pl
 * extras: centos.hitme.net.pl
 * updates: centos.hitme.net.pl
--> Finished Dependency Resolution
Error: Package: rdesktop-1.8.2-0.1.el6.rfx.x86_64 (/rdesktop-1.8.2-0.1.el6.rfx.x86_64)
           Requires: libao.so.2()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

After installing libao package (yum install libaio), problem still persists:

[root@centos-7 ~]# rpm -qa | grep libao
libao-1.1.0-8.el7.x86_64

[root@centos-7 ~]# ls -l /usr/lib64/libao*
lrwxrwxrwx. 1 root root    14 Jul  8 13:25 /usr/lib64/libao.so.4 -> libao.so.4.0.0
-rwxr-xr-x. 1 root root 37568 Jun 10 00:05 /usr/lib64/libao.so.4.0.0

I have libao.so.4 but rdesktop wants libao.so.2. Quick and dirty workaround is to install package with --nodeps option and create symlink to satisfy rdesktop binary:

[root@centos-7 ~]# rpm -i --nodeps rdesktop-1.8.2-0.1.el6.rfx.x86_64.rpm 
warning: rdesktop-1.8.2-0.1.el6.rfx.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY

List of libraries rdesktop binary is linked to. Notice libao.so.2 is not found:

[root@centos-7 ~]# ldd /usr/bin/rdesktop
        linux-vdso.so.1 =>  (0x00007fffd3668000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007fa0c4375000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fa0c3f90000)
        libXrandr.so.2 => /lib64/libXrandr.so.2 (0x00007fa0c3d85000)
        libpcsclite.so.1 => /lib64/libpcsclite.so.1 (0x00007fa0c3b7a000)
        libsamplerate.so.0 => /lib64/libsamplerate.so.0 (0x00007fa0c380e000)
        libasound.so.2 => /lib64/libasound.so.2 (0x00007fa0c3525000)
        libao.so.2 => not found
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa0c3309000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fa0c3104000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007fa0c2dc6000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fa0c2a05000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fa0c27ba000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fa0c24da000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fa0c22d6000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fa0c20a0000)
        libz.so.1 => /lib64/libz.so.1 (0x00007fa0c1e8a000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007fa0c1c78000)
        libXrender.so.1 => /lib64/libXrender.so.1 (0x00007fa0c1a6d000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fa0c1865000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fa0c1563000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa0c45e8000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fa0c1341000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fa0c1133000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fa0c0f2f000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fa0c0d14000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007fa0c0b10000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fa0c08ea000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fa0c0689000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fa0c0464000)

Create libao.so.2 as symlink for libao.so.4:

[root@centos-7 ~]# ln -s /usr/lib64/libao.so.4 /usr/lib64/libao.so.2
[root@centos-7 ~]# 
[root@centos-7 ~]# ls -l /usr/lib64/libao*
lrwxrwxrwx. 1 root root    21 Jul  8 13:33 /usr/lib64/libao.so.2 -> /usr/lib64/libao.so.4
lrwxrwxrwx. 1 root root    14 Jul  8 13:25 /usr/lib64/libao.so.4 -> libao.so.4.0.0
-rwxr-xr-x. 1 root root 37568 Jun 10 00:05 /usr/lib64/libao.so.4.0.0

Library dependency is satisfied now:

[root@centos-7 ~]# ldd /usr/bin/rdesktop 
        linux-vdso.so.1 =>  (0x00007fff18a99000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007f789c3ed000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f789c008000)
        libXrandr.so.2 => /lib64/libXrandr.so.2 (0x00007f789bdfd000)
        libpcsclite.so.1 => /lib64/libpcsclite.so.1 (0x00007f789bbf2000)
        libsamplerate.so.0 => /lib64/libsamplerate.so.0 (0x00007f789b886000)
        libasound.so.2 => /lib64/libasound.so.2 (0x00007f789b59d000)
        libao.so.2 => /lib64/libao.so.2 (0x00007f789b394000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f789b178000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f789af73000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007f789ac35000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f789a874000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f789a629000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f789a349000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f789a145000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f7899f0f000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f7899cf9000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007f7899ae7000)
        libXrender.so.1 => /lib64/libXrender.so.1 (0x00007f78998dc000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f78996d4000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f78993d2000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f789c660000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f78991b0000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f7898fa2000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f7898d9e000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f7898b83000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007f789897f000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f7898759000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f78984f8000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f78982d3000)

Better solution is to rebuild rdesktop package. If you don't want to mess with rpmbuild, you can download my package. Otherwise setup rpm building tree (according to http://wiki.centos.org/HowTos/SetupRpmBuildEnvironment):

yum install rpm-build 

As non-root user (I chose vajko account) setup rpm building tree:

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
sudo yum install make gcc

Install source rpm package:

[vajko@centos-7 ~]$ rpm -i rdesktop-1.8.2-0.1.rfx.src.rpm 
warning: rdesktop-1.8.2-0.1.rfx.src.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
warning: user dag does not exist - using root
warning: group dag does not exist - using root
warning: user dag does not exist - using root
warning: group dag does not exist - using root

Rebuild package:

[vajko@centos-7 ~]$ rpmbuild -ba rpmbuild/SPECS/rdesktop.spec 
error: Failed build dependencies:
        libsamplerate-devel is needed by rdesktop-1.8.2-0.1.el7.centos.x86_64
        openssl-devel is needed by rdesktop-1.8.2-0.1.el7.centos.x86_64
        libXt-devel is needed by rdesktop-1.8.2-0.1.el7.centos.x86_64

Install dependencies and try to rebuild again:

[vajko@centos-7 ~]$ sudo yum install openssl-devel libXt-devel libsamplerate-devel
[vajko@centos-7 ~]$ rpmbuild -ba rpmbuild/SPECS/rdesktop.spec 
.
.
.
OUTPUT TRUNCATED
.
.
.
checking for x86_64-redhat-linux-gnu-pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for XRANDR... no
checking for PCSCLITE... no

SmartCard support requires PCSC, install the dependency
or disable the feature using --disable-smartcard.

error: Bad exit status from /var/tmp/rpm-tmp.s8HBzC (%build)


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

Rebuilding failed because spec file is missing smartcard package dependency. Missing package is pcsc-lite-devel:

[vajko@centos-7 ~]$ sudo yum install pcsc-lite-devel
[vajko@centos-7 ~]$ rpmbuild -ba rpmbuild/SPECS/rdesktop.spec 
.
.
.
OUTPUT TRUNCATED
.
.
.
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vajko/rpmbuild/BUILDROOT/rdesktop-1.8.2-0.1.el7.centos.x86_64
Wrote: /home/vajko/rpmbuild/SRPMS/rdesktop-1.8.2-0.1.el7.centos.src.rpm
Wrote: /home/vajko/rpmbuild/RPMS/x86_64/rdesktop-1.8.2-0.1.el7.centos.x86_64.rpm
Wrote: /home/vajko/rpmbuild/RPMS/x86_64/rdesktop-debuginfo-1.8.2-0.1.el7.centos.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.abuTrh
+ umask 022
+ cd /home/vajko/rpmbuild/BUILD
+ cd rdesktop-1.8.2
+ /usr/bin/rm -rf /home/vajko/rpmbuild/BUILDROOT/rdesktop-1.8.2-0.1.el7.centos.x86_64
+ exit 0

Package was built successfully. Remove installed devel packages if you don't need them for anything else:

yum remove pcsc-lite-devel openssl-devel libXt-devel libsamplerate-devel

Reinstall rpm package:

[vajko@centos-7 ~]$ sudo yum remove rdesktop
[vajko@centos-7 ~]$ sudo yum localinstall --nogpgcheck rpmbuild/RPMS/x86_64/rdesktop-1.8.2-0.1.el7.centos.x86_64.rpm

2 comments:

  1. great! well done, was looking for a solution to this.
    Many thx for your efforts to document this process!
    five

    ReplyDelete