Installing Optional Libraries

From ReelBox Maniacs

Jump to: navigation, search


Sometimes it might be necessary to install some optional libraries on your ReelBox. It's quite an easy procedure. Follow the steps described below and your ReelBox will now that there's a new helper available to the system.

[edit] Places for Standard Libraries

The standard libraries are placed in the directorires /lib and /usr/lib on most Unix systems. So this is where the libraries delivered from RMM go. As the root filesystem (where /lib and /usr/lib reside) is a readonly cramfs (compressed ram filesystem, see ReelBox Software Image Layout), you can't put additional libraries there. This is where the /opt directory comes into play.

[edit] A Place for Optional Libraries

Addtional libraries go into /opt/lib. At boot time, the systems looks up this directory and if it exists, all libraries in this directory are added to those the systems knows of. This is done while running one of the boot scripts. ldconfig is fired up and reads its configuration file named /etc/ld.so.conf and creates a library cache file anmed /etc/ld.so.cache. If you look at /etc/ld.so.conf, there's a single line telling the system to look up /opt/lib for libraries.

File: /etc/ld.so.conf

/opt/lib

[edit] Installing an Additional Library

So if you want to add a library, put it into /opt/lib, set access rights correctly and reboot - or fire up a ldconfig like shown below. I'm using the IP address which is configured by default on your ReelBox and a library named libnewlib.so.1.2.3 in this example. All you need is a ftp and a telnet client. If you are working with Windows, rcc may be your tool of choice.

Code: transfering a libraries to the ReelBox

gentoo4reel# cd /where/ever/your/original/lib/is
gentoo4reel# ftp 192.168.0.175
Connected to 192.168.0.175.
220 bftpd 1.0.24 at 192.168.0.175 ready.
Name (192.168.0.175:root): root
500 Unknown command: "AUTH SSL"
SSL not available
331 Password please.
Password:
230 User logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /opt
250 OK
ftp> mkdir lib
451 Error: File exists.
ftp> cd lib
250 OK ftp> put libnewlib.so.1.2.3
local: libnewlib.so.1.2.3 remote: libnewlib.so.1.2.3
200 PORT 192.168.0.101:58833 OK
150 BINARY data connection established.
226 File transmission successful.
1097155 bytes sent in 0.871 secs (1.2e+03 Kbytes/sec)
ftp> quit
221 See you later...

Maybe your system complains about the lib directory already existing while trying to mkdir lib (like shown above). That's ok, ignore it. We create it here just make sure it is really there.

Code: Telnet to your ReelBox aus user root and install a library

192.168.0.175# cd /opt/lib
192.168.0.175# chmod 755 . libnewlib.so.1.2.3
192.168.0.175# ldconfig
192.168.0.175# ls -al
drwxr-xr-x 3 root root 312 Feb 1 23:16 .
drwxrwxrwx 6 root root 144 Feb 6 22:13 ..
lrwxrwxrwx 1 root root 16 Jan 29 18:22 libnewlib.so.1 -> libipkg.so.1.2.3
-rwxrwxr-x 1 root root 1097155 Jan 29 20:29 libnewlib.1.2.3

When setting the access rights with the help of chmod, make sure you assign rights to the current directory (the single dot) as well as to libnewlib.so.1.2.3.

As you can see from the ls -al command output, ldconfig created some softlinks to libnewlib.so.1.2.3 needed by the system. The library is now known by the Linux system and will be used, if any of the software on your ReelBox tries to call it.

As mentioned above, the ldconfig command is run at boot time automagically. So you don't have to care about anything, when you restart your ReelBox. The library will be available to the system until you delete it.