Siju George | 22 Sep 21:47 2007
Picon

Running Linux binaries on OpenBSD Howto - example Skype

On 9/21/07, Adam PAPAI <wooh <at> wooh.hu> wrote:
>
> Could you please write me the procedure a little bit detailed?
>
> You downloaded the skype binary, installed the redhat-* stuff, enabled
> linux_compat and you had to copy some files from where?
>

OK :-)
I did this on a 4.1/i386.
For other versions it would be similar however since we are going to
use the Skype Linux Binary we will need an x86 system. Linux emulation
is available only for x86 systems.

1) Enable Linux Emulation option in kernel

You will have a line

#kern.emul.linux=1               # enable running Linux binaries

in your "/etc/sysctl.conf" file. You need to uncomment it ( remove the
# in the begining ) and make it look like

kern.emul.linux=1               # enable running Linux binaries

 In the next step when you install the "fedora_base-4.0p2.tgz" pakage
it will automatically enable this option temporarily in the running
kernel but if the change has to last after a reboot you need to edit
this file :-)

2) Install "fedora_base-4.0p2.tgz" package.

#export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/
#pkg_add fedora_base-4.0p2.tgz

We do this to get most of the required Linux library files that the
Skype Linux Binary will need. Though their website says it is
statically linked we will soon find out that it is not the case :-(

At this point if you are more interested in details you can read

http://www.openbsd.org/cgi-bin/man.cgi?query=compat_linux&sektion=8
or
$man 8 compat_linux

3) Download the Skype Linux Binary.

====================================================
#cd /tmp
#ftp http://www.skype.com/go/getskype-linux-static
Trying 204.9.163.136...
Requesting http://www.skype.com/go/getskype-linux-static
Redirected to http://download.skype.com/linux/skype_static-1.4.0.99.tar.bz2
Trying 130.117.72.89...
Requesting http://download.skype.com/linux/skype_static-1.4.0.99.tar.bz2
  0% |                                                   |     0       --:-- ETA
====================================================

After the download is over on the OpenBSD System you are working on
you need to put the files in the appropriate places.

====================================================
#pwd
/tmp
#bunzip2 skype_static-1.4.0.99.tar.bz2
#tar -xvf skype_static-1.4.0.99.tar
#mv skype_static-1.4.0.99 skype
====================================================

If you want there is a README file inside the "skype" directory now.
It explains some things other things have to be guessed :-)
So continuing our setup

====================================================
#pwd
/tmp
#mv skype /emul/linux/usr/share
#cd /emul/linux/usr/share/skype
#mv skype /emul/linux/usr/bin
#mkdir /emul/linux/etc/skype
#mv skype.conf /emul/linux/etc/skype
====================================================

Now at this point if you start skype it will give an error.

====================================================
$ /emul/linux/usr/bin/skype
/emul/linux/usr/bin/skype: error while loading shared libraries:
libasound.so.2: cannot open shared object file: No such file or
directory
====================================================

So now investigating this problem we will find that

1) Skype Linux Binary is not fully statically linked as their website says
2) Even the "fedora_base-4.0p2.tgz" package we installed earlier does
not provide all the library files required to run skype.

====================================================
$ ldd /emul/linux/usr/bin/skype
/emul/linux/usr/bin/skype:
        libasound.so.2 => not found
        librt.so.1 => /lib/librt.so.1 (0x48874000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x5635f000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4ef0a000)
        libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x4f700000)
        libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x4960d000)
        libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x4b7ad000)
        libXfixes.so.3 => /usr/X11R6/lib/libXfixes.so.3 (0x4f1c4000)
        libXcursor.so.1 => /usr/X11R6/lib/libXcursor.so.1 (0x4cd49000)
        libXinerama.so.1 => /usr/X11R6/lib/libXinerama.so.1 (0x4c147000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4b546000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x4b22b000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4dee6000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x53161000)
        libdl.so.2 => /lib/libdl.so.2 (0x4f1b9000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x514e9000)
        libsigc-2.0.so.0 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x56a43000)
        libm.so.6 => /lib/libm.so.6 (0x5171b000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x50840000)
        libc.so.6 => /lib/libc.so.6 (0x55057000)
        /lib/ld-linux.so.2 (0x53a9e000)
        libz.so.1 => /usr/lib/libz.so.1 (0x51f77000)
        libexpat.so.0 => /usr/lib/libexpat.so.0 (0x52c4d000)
$ ldd /emul/linux/usr/bin/skype |grep not
        libasound.so.2 => not found
        libsigc-2.0.so.0 => not found
$
====================================================

So "libasound.so.2" and "libsigc-2.0.so.0" are not in the OpenBSD system.

We can get it from any recent Linux System.
I used my Debian Etch. Martynas Venckus also provided me with the files.
If you have no access to a Linux system I can send the files to you :-)

Now on the Linux System we check for these libraries.

====================================================
$ ssh root <at> 172.16.2.0
root <at> 172.16.2.0's password:
# cat /proc/version
Linux version 2.6.18-5-686 (Debian 2.6.18.dfsg.1-13etch2)
(dannf <at> debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian
4.1.1-21)) #1 SMP Thu Aug 30 02:19:07 UTC 2007

#locate libasound.so.2
/usr/lib/libasound.so.2
/usr/lib/libasound.so.2.0.0

# file /usr/lib/libasound.so.2
/usr/lib/libasound.so.2: symbolic link to `libasound.so.2.0.0'
#ls -l /usr/lib/libasound.so.2
lrwxrwxrwx 1 root root 18 2007-03-12 15:13 /usr/lib/libasound.so.2 ->
libasound.so.2.0.0

# locate libsigc-2.0.so.0
/usr/lib/libsigc-2.0.so.0
/usr/lib/libsigc-2.0.so.0.0.0

# file /usr/lib/libsigc-2.0.so.0
/usr/lib/libsigc-2.0.so.0: symbolic link to `libsigc-2.0.so.0.0.0'
# ls -l /usr/lib/libsigc-2.0.so.0
lrwxrwxrwx 1 root root 20 2006-11-02 11:45 /usr/lib/libsigc-2.0.so.0
-> libsigc-2.0.so.0.0.0
====================================================

so we find that "libasound.so.2" and "libsigc-2.0.so.0" are actualy
symbolic links to "libasound.so.2.0.0" and "libsigc-2.0.so.0.0.0"
respectively.

We then need to get the actual files "libasound.so.2.0.0" and
"libsigc-2.0.so.0.0.0" to our OpenBSD system.

So on the OpenBSD system you can use scp to fetch these files from the
Linux System to "/emul/linux/usr/lib" and create appropriate symbolic
links

====================================================
# cd /emul/linux/usr/lib
# scp root <at> 172.16.2.0:/usr/lib/libasound.so.2.0.0 .
root <at> 172.16.2.0's password:
libasound.so.2.0.0                             100%  766KB 765.6KB/s   00:00
# scp root <at> 172.16.2.0:/usr/lib/libsigc-2.0.so.0.0.0 .
root <at> 172.16.2.0's password:
libsigc-2.0.so.0.0.0                           100%   18KB  18.2KB/s   00:00
#ln -s libasound.so.2.0.0 libasound.so.2
#ln -s libsigc-2.0.so.0.0.0 libsigc-2.0.so.0
====================================================

Now Checking if everything is fine again on the OpenBSD system

====================================================

$ ldd /emul/linux/usr/bin/skype
/emul/linux/usr/bin/skype:
        libasound.so.2 => /usr/lib/libasound.so.2 (0x502c4000)
        librt.so.1 => /lib/librt.so.1 (0x537c0000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x53f81000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4c089000)
        libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x56bb5000)
        libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x4c7db000)
        libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x4fde0000)
        libXfixes.so.3 => /usr/X11R6/lib/libXfixes.so.3 (0x50a47000)
        libXcursor.so.1 => /usr/X11R6/lib/libXcursor.so.1 (0x518ac000)
        libXinerama.so.1 => /usr/X11R6/lib/libXinerama.so.1 (0x4caaf000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4c494000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x52b3c000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x521a1000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x49204000)
        libdl.so.2 => /lib/libdl.so.2 (0x56cdc000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x573c6000)
        libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x57c6f000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x4c5b6000)
        libm.so.6 => /lib/libm.so.6 (0x4b201000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4cfcb000)
        libc.so.6 => /lib/libc.so.6 (0x578f3000)
        /lib/ld-linux.so.2 (0x49fd7000)
        libz.so.1 => /usr/lib/libz.so.1 (0x4e6a1000)
        libexpat.so.0 => /usr/lib/libexpat.so.0 (0x50745000)
$
====================================================

Things are fine. There is no "not found" message for any :-)

Just start skype now. It should come up :-)))))))))))

#/emul/linux/usr/bin/skype

You can chat but if you try to make a call the skype window will give
you the error

"Call Failed: Problem with Audio Playback"

and in the terminal you will find

===================================================
$ /emul/linux/usr/bin/skype
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default
ALSA lib control.c:910:(snd_ctl_open_noupdate) Invalid CTL default
===================================================

Also if you quit skype and try to start it again it will give an error

"Another Skype instance may exist"

So just delete the .Skype in your home directory
$rm -rf ~/.Skype

and it should start again.

Thanks a lot again Martynas :-))))))))))

Kind Regards

Siju

Gmane