LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Compiling programs from source and dealing with dependencies on Slackware. (http://www.linuxquestions.org/questions/slackware-14/compiling-programs-from-source-and-dealing-with-dependencies-on-slackware-765914/)

Switch7 11-01-2009 01:45 AM

Compiling programs from source and dealing with dependencies on Slackware.
 
When I first moved to Linux from windows 2 months ago, I wrote out the equivalent of the softwares I'm going to need so I would never miss microsoft windows again. Slackware comes with almost everything I first wrote out which is:
Code:

awesome tiling windows manager (slackbuilds)
fluxbox
zsh
firefox
irssi
htop (slackbuilds)
midnight commander
mpd and ncmpcpp (slackbuilds)
mplayer (no vdpau though so I'll need to recompile it)
gqview
nmap
gtk-chtheme (slackbuilds)
xpdf
vim/nano
Programming tools
Virtualbox (slackbuilds)
iptables

However, I'm missing two softwares I needed so it's time to compile programs from source. This is a bit intimidating for a newbie/non-programmer(I'm working on this though) who has only been using linux/unix for 2 months but it'll be a very good experience to understand more about it.

The two softwares I'm missing is rtorrent and rxvt-unicode-256color. Although rxvt-unicode exists, it has no 256 color support and I read that the maintainer isn't planning on adding it because it's not officially supported. rtorrent exists for 12.2 on slackbuids but there hasn't been any update for 13.

Reading the LQwiki, here and another good tutorial here, it seems very simple. rtorrent only requires one dependency which is libtorrent.

I learned from my other thread that I need to build the dependency first which is libtorrent from the official website.

So all I do is download the libtorrent and follow the tutorial:
Quote:

You will want to download the source to the following directory: /usr/local/src
Code:

# cd /usr/local/src
# wget http://libtorrent.rakshasa.no/downlo...-0.12.5.tar.gz
# tar -zxvf libtorrent-0.12.5.tar.gz
# cd libtorrent
# Read the README
# ./configure
# make
# make test
# make install

Code:

# cd /usr/local/src
# wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.7.6.tar.gz
# tar -zxvf rtorrent-0.7.6.tar.gz
# cd rtorrent-0.7.6
# Read the README
# ./configure
# make
# make test
# make install

and I should have rtorrent working on slackware 13.

Fortunately, there's a slackbuild for the dependency called libafterimage for the urxvt so I'll just use sbopkg for this. After that:

For urxvt 256 color support,
Code:

# cd /usr/local/src
# wget http://dist.schmorp.de/rxvt-unicode/rxvt-unicode-9.06.tar.bz2
# tar -jxvf rxvt-unicode-9.06.tar.bz2
# cd rxvt-unicode-9.06
# Read the README
# patch -p1 < doc/urxvt-9.06-256color.patch  (Applying 256 color patch, it's included with the source)
# ./configure
# make
# make test
# make install

This should be the correct way according to the tutorial but I wanted to confirm if I am on the right track. I never done this before so I'm not sure if there's something I did wrong. I have no plans on uninstalling these so I shouldn't need to worry about dependency hell although I'm quite lost when I need to upgrade these programs. I thnk I just need to locate libtorrent and rtorrent and rm everything that has anything to do with it if a new version of libtorrent and rtorrent is available then follow the same way as above and change the wget to a new version.

saulgoode 11-01-2009 04:00 AM

Your approach should work fine and you are definitely on the right track; however, I would propose that instead of installing the software directly (via 'make install'), you should consider building a Slackware package and installing that. Installing with a SW package is generally not much more difficult, and it makes system maintenance easier in the long run (you will know what packages are installed, and can easily remove or upgrade the software).

Using libtorrent as an example, you can create a Slackware package from the source using the following steps (italic bold text is used to highlight the differences from your original approach):

Quote:

# cd /usr/local/src
# wget http://libtorrent.rakshasa.no/downlo...-0.12.5.tar.gz
# tar -zxvf libtorrent-0.12.5.tar.gz
# cd libtorrent
# Read the README
# ./configure
# make
# make test
# mkdir /tmp/libtorrent-0.12.5
# make install DESTDIR=/tmp/libtorrent-0.12.5
# cd /tmp/libtorrent-0.12.5
# makepkg /tmp/libtorrent-0.12.5-1.txz
# installpkg /tmp/libtorrent-0.12.5-1.txz

The Slackware package produced won't include a description of the package, nor will it include the documentation, README files, or copyright notices(!). But it will function fine and you will be able to remove or upgrade the package using standard Slackware package management utilities.

The above approach will work for the vast majority of Autotools-based source code compiling (i.e., the './configure && make && make install' stuff), but I would also recommend that you eventually learn more about writing your own slackbuild scripts and adding the Slack-desc description files (a good tutorial for this is available at slackbuilds.org).

Switch7 11-01-2009 04:32 AM

Quote:

Originally Posted by saulgoode (Post 3739810)
Your approach should work fine and you are definitely on the right track; however, I would propose that instead of installing the software directly (via 'make install'), you should consider building a Slackware package and installing that. Installing with a SW package is generally not much more difficult, and it makes system maintenance easier in the long run (you will know what packages are installed, and can easily remove or upgrade the software).

Using libtorrent as an example, you can create a Slackware package from the source using the following steps (italic bold text is used to highlight the differences from your original approach):



The Slackware package produced won't include a description of the package, nor will it include the documentation, README files, or copyright notices(!). But it will function fine and you will be able to remove or upgrade the package using standard Slackware package management utilities.

The above approach will work for the vast majority of Autotools-based source code compiling (i.e., the './configure && make && make install' stuff), but I would also recommend that you eventually learn more about writing your own slackbuild scripts and adding the Slack-desc description files (a good tutorial for this is available at slackbuilds.org).

Thank you! I had no idea that was possible and it's very convenient. I think it's worth the trade and I can just go to the official website if those files are needed.

So if I do

Code:

slackpkg remove libtorrent
slackpkg remove rtorrent

it'll completely wipe off everything and I don't have to worry about dependency because slackware package management utilities will take care of it.

I will work on the slackbuilds so I can help myself and be able to contribute back to the community one day and I hope I can make slackbuilds in the future for the missing softwares that are popular and contribute. After I get everything working and the system is stable, I'm planning on learning sh so I can write slackbuilds scripts.

Off topic but I can't seem to connect to slackwiki.org

Edit: I been reading another thread about compiling rtorrent and it seems that there's much more depedency I needed. This is strange since I always thought rtorrent had only one dependency.

hurry_hui 11-01-2009 05:07 AM

Hi,

To find out dependencies required by a package for Slackware, I always consult archlinux package, since it always lists 'clean' dependencies.

NB: Sorry, I think 'clean' is not really correct term here, I do not know how to say it correctly in English...:)

Switch7 11-01-2009 05:43 AM

Quote:

Originally Posted by hurry_hui (Post 3739840)
Hi,

To find out dependencies required by a package for Slackware, I always consult archlinux package, since it always lists 'clean' dependencies.

NB: Sorry, I think 'clean' is not really correct term here, I do not know how to say it correctly in English...:)

Code:

curl>=7.14.3
libtorrent=0.12.5
xmlrpc-c

Slackware 13 x86_64 already has curl 7.19.6 so I guess xmlrpc-c is needed. Thanks for the tip. Their documentation is really good and I been using arch these past days. I did a upgrade and I was unable to boot anymore so I wish it would be more stable but I guess that's what bleeding edge is supposed to be - taking some risks.

saulgoode 11-01-2009 05:50 AM

Quote:

Originally Posted by Switch7 (Post 3739827)
Thank you! I had no idea that was possible and it's very convenient. I think it's worth the trade and I can just go to the official website if those files are needed.

One of the things I've grown to appreciate about building my own Slackware packages is that it forces me to visit the websites of the upstream projects. Not only does this make me realize the sources providing this wonderful software, but there are often links to related projects, or unrelated projects by the same authors; not to mention the occasional serendipitous revelations of intriguing philosophy, humor, and art which would otherwise go completely undiscovered when using a "one-click install" package manager.

Quote:

Originally Posted by Switch7 (Post 3739827)
So if I do

Code:

slackpkg remove libtorrent
slackpkg remove rtorrent

it'll completely wipe off everything and I don't have to worry about dependency because slackware package management utilities will take care of it.

Well, none of the official Slackware package management tools will take care of dependencies -- if you removepkg rtorrent, this will NOT remove libtorrent (or libsigc++, or libcurl). You will want to decide for yourself whether to remove those packages.

In general, it does no harm to have an unused package installed on your system, other than the space taken up on your harddrive (which nowadays is of little concern). It has been my experience that in those rare instances when conflicts arise because of unused (or outdated) packages being installed, the package managers which purport to automate dependency handling do a fairly poor job of it; creating much greater problems than caused by having to manually manage dependencies.

Quote:

Originally Posted by Switch7 (Post 3739827)
Off topic but I can't seem to connect to slackwiki.org

It does seem to be down at the moment.

Quote:

Originally Posted by Switch7 (Post 3739827)
Edit: I been reading another thread about compiling rtorrent and it seems that there's much more depedency I needed. This is strange since I always thought rtorrent had only one dependency.

In addition to libtorrent, rtorrent depends on libcurl (included in a default SW installation) and libsigc++ (available on slackbuilds.org). Other distros will often split up the software provided by an upstream project into several smaller packages (providing separate packages for applications, documentation, headers, and libraries), which means that for those distros there are a greater number of dependencies that need to be met. Slackware packages install the full set of software as provided by the upstream project and does not refactor things into lots of little packages. This not only reduces the amount of work required to handle dependencies, but makes it much easier for users -- such as yourself -- to create their own Slackware packages.

Daedra 11-01-2009 06:14 AM

You should also look into gnashley's src2pkg program, I prefer to use slackbuilds but if there isn't one available I use it. It's saved me many times. It basically automates the ./configure make make install process. Most times just running the default results in a perfect package.

src2pkg -VV Path-to-rtorrent.tar.gz

The resulting package will be in /tmp

Switch7 11-01-2009 06:15 AM

Quote:

Originally Posted by saulgoode (Post 3739862)
One of the things I've grown to appreciate about building my own Slackware packages is that it forces me to visit the websites of the upstream projects. Not only does this make me realize the sources providing this wonderful software, but there are often links to related projects, or unrelated projects by the same authors; not to mention the occasional serendipitous revelations of intriguing philosophy, humor, and art which would otherwise go completely undiscovered when using a "one-click install" package manager.

I noticed that right away as well and I been checking the site out more often. I found it interesting that the developer had the certain hobby or doing certain projects and etc.


Quote:

Originally Posted by saulgoode (Post 3739862)
Well, none of the official Slackware package management tools will take care of dependencies -- if you removepkg rtorrent, this will NOT remove libtorrent (or libsigc++, or libcurl). You will want to decide for yourself whether to remove those packages.

In general, it does no harm to have an unused package installed on your system, other than the space taken up on your harddrive (which nowadays is of little concern). It has been my experience that in those rare instances when conflicts arise because of unused (or outdated) packages being installed, the package managers which purport to automate dependency handling do a fairly poor job of it; creating much greater problems than caused by having to manually manage dependencies.

I see, I'll just take note for it. rTorrent and urxvt-256color is the only software missing from slackbuilds and official packages so it's easy to keep track of it and its dependency as well.

Quote:

Originally Posted by saulgoode (Post 3739862)
In addition to libtorrent, rtorrent depends on libcurl (included in a default SW installation) and libsigc++ (available on slackbuilds.org). Other distros will often split up the software provided by an upstream project into several smaller packages (providing separate packages for applications, documentation, headers, and libraries), which means that for those distros there are a greater number of dependencies that need to be met. Slackware packages install the full set of software as provided by the upstream project and does not refactor things into lots of little packages. This not only reduces the amount of work required to handle dependencies, but makes it much easier for users -- such as yourself -- to create their own Slackware packages.

I noticed the dependency is different from the arch. I'm not sure how the experienced Linux users can figure out the correct dependency for the certain distribution. I'm guessing doing ./configure or the README will tell me the needed dependency for slackware? I haven't actually done the compiling yet so I never seen the REAMME or ./configure yet.

And thank you once again for the detailed help.

sahko 11-01-2009 07:02 AM

Libtorrent requires some other c++ library though.
I don't see your problem TBH. All the applications you need are in SlackBuilds.org and the extra packages (dependencies) required by them are documented in the READMEs.

bgeddy 11-01-2009 10:29 AM

Well maybe it's just a personal thing but my initial comment is not to use /usr/local/src as a working directory. I use a dedicated directory off my home - /home/bgeddy/sources - to build packages. You could alternatively use someting in /tmp. The main reason is that using a /usr/local/src directory requires you to work as root for the download/build etc when this isn't neccesary.
It best to stay away from root privileges as much as possible for a safety net. It's only when you install stuff (or the final stages of a build) when you have to be root.
Everyone has their own preferences but staying away from root when possible is good advice. It's when you ignorantly issue an "rm -rf *" in the wrong place that you'll REALLY regret running as root ;)
As already mentioned it's advisable to build a Slackware package from source then installpkg that. You may do this either yourself or via src2pkg/Slackbuild/sbopkg/etc.This makes it much easier to manage packages.

Switch7 11-01-2009 05:13 PM

I made a big mistake on the rxvt-unicode 256 color. I did this instead:

Code:

# cd /usr/local/src
# wget http://dist.schmorp.de/rxvt-unicode/rxvt-unicode-9.06.tar.bz2
# tar -jxvf rxvt-unicode-9.06.tar.bz2
# cd rxvt-unicode-9.06
Read the README
# patch -p1 < doc/urxvt-8.2-256color.patch
# autoconf
# ./configure --enable-xterm-colors
# make
# mkdir /tmp/rxvt-unicode-9.06
# make install DESTDIR=/tmp/rxvt-unicode-9.06
# cd /tmp/rxvt-unicode-9.06
# makepkg /tmp/rxvt-unicode-9.06-1.txz
# installpkg /tmp/rxvt-unicode-9.06-1.txz

After makepkg, it prompted me if I wanted to reset all directory permissions to 755 but I picked [n]o.

Doing pkgtool, I found rxvt-unicode-9.06-1 located in there so I think this was my first success?

Just a screenshot of pkgtool and using urxvt:
http://i37.tinypic.com/sdil4x.png
http://i34.tinypic.com/2mrnd.jpg

And 256colors:
http://i37.tinypic.com/28vx20j.png

Switch7 11-02-2009 12:32 AM

I put thread as solved but took it back since I thought these would work. For the rtorrent, doing ./configure and I'm getting:

Quote:

No package 'libtorrent' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.
Doing a google search, I think I found the solution which is

Code:

# export PKG_CONFIG_PATH=/tmp/libtorrent-0.12.5
# ./configure

I already have libtorrent installed and did it as saulgoode mentioned. The above didn't work so I tried other things like:
Code:

bash-3.1$ echo $PATH=libtorrent
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/java/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin:.=libtorrent


Code:

# export PKG_CONFIG_PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/java/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin:.=libtorrent
# ./configure

But none of it seems to be working.

sahko 11-02-2009 01:12 AM

AFAIK urxvt doesnt have an --enable-xterm-colors configure option. If it does, it doesnt do what you use it for.
As for the rest i suggest you follow the slackbuilds.org documentation and use the scripts exactly as they are (and dont install in /usr/local)

saulgoode 11-02-2009 01:13 AM

Quote:

Originally Posted by Switch7 (Post 3740766)
Doing a google search, I think I found the solution which is

Code:

# export PKG_CONFIG_PATH=/tmp/libtorrent-0.12.5
# ./configure

I already have libtorrent installed and did it as saulgoode mentioned. The above didn't work ...

The configure script (for rtorrent) is looking for a file named "libtorrent.pc". This file was generated when you compiled the libtorrent package and there will be a copy of it in the original source directory (/usr/local/src/libtorrent), in the compiled (DESTDIR) tree (/tmp/libtorrent-0.12.5/usr/local/lib/pkgconfig), and -- after you install the package -- in /usr/local/lib/pkgconfig. It may be that the pkgconfig directory is in "lib64" for Slackware64, or it may be that this is the cause of the problem (I don't have a SW64 setup and am not sure whether libtorrent handles 64-bit properly). But basically you need to set PKG_CONFIG_PATH to a directory which contains the "libtorrent.pc" file.

Switch7 11-02-2009 01:47 AM

Quote:

Originally Posted by sahko (Post 3740798)
AFAIK urxvt doesnt have an --enable-xterm-colors configure option. If it does, it doesnt do what you use it for.
As for the rest i suggest you follow the slackbuilds.org documentation and use the scripts exactly as they are (and dont install in /usr/local)

I see. I'll redo urxvt later. I just followed the guide here but I'll do more search later. It looks like I don't need to add anything after ./configure since 256colors seems to be working.

I'll go ahead and read slackbuilds.org and try to follow it. I'm trying to access slackwiki.org since slackbuilds.org mentions to take a look there but it still seems to be down. One of the main reasons why I wanted to compile programs from source was because instead of having everything done automated, I wanted to take my time learning how to compile it from source so I don't have to resort to slackbuilds all the time. I been always running away and looking for alternatives if there's no automated tool that will do it for me automatically. One of my primary goal is to learn more about Linux and I have a feeling I might be missing out on something important if I keep avoiding on how to compile programs from source.

Quote:

Originally Posted by saulgoode (Post 3740800)
The configure script (for rtorrent) is looking for a file named "libtorrent.pc". This file was generated when you compiled the libtorrent package and there will be a copy of it in the original source directory (/usr/local/src/libtorrent), in the compiled (DESTDIR) tree (/tmp/libtorrent-0.12.5/usr/local/lib/pkgconfig), and -- after you install the package -- in /usr/local/lib/pkgconfig. It may be that the pkgconfig directory is in "lib64" for Slackware64, or it may be that this is the cause of the problem (I don't have a SW64 setup and am not sure whether libtorrent handles 64-bit properly). But basically you need to set PKG_CONFIG_PATH to a directory which contains the "libtorrent.pc" file.

Quote:

# export PKG_CONFIG_PATH=/usr/local/src/libtorrent-0.12.5/
# ./configure
Thank you, the above worked. I found libtorrent.pc and libtorrent.pc.in located in this directory.

Doing a make after gives tons of error:

Code:

bash-3.1# make
make  all-recursive
make[1]: Entering directory `/usr/local/src/rtorrent-0.7.6'
Making all in doc
make[2]: Entering directory `/usr/local/src/rtorrent-0.7.6/doc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/local/src/rtorrent-0.7.6/doc'
Making all in src
make[2]: Entering directory `/usr/local/src/rtorrent-0.7.6/src'
Making all in core
make[3]: Entering directory `/usr/local/src/rtorrent-0.7.6/src/core'
if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I. -I./.. -I../..    -O2 -Wall -g -DDEBUG -I/usr/local/include -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include  -MT curl_get.o -MD -MP -MF ".deps/curl_get.Tpo" -c -o curl_get.o curl_get.cc; \
        then mv -f ".deps/curl_get.Tpo" ".deps/curl_get.Po"; else rm -f ".deps/curl_get.Tpo"; exit 1; fi
if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I. -I./.. -I../..    -O2 -Wall -g -DDEBUG -I/usr/local/include -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include  -MT curl_stack.o -MD -MP -MF ".deps/curl_stack.Tpo" -c -o curl_stack.o curl_stack.cc; \
        then mv -f ".deps/curl_stack.Tpo" ".deps/curl_stack.Po"; else rm -f ".deps/curl_stack.Tpo"; exit 1; fi
if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I. -I./.. -I../..    -O2 -Wall -g -DDEBUG -I/usr/local/include -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include  -MT download.o -MD -MP -MF ".deps/download.Tpo" -c -o download.o download.cc; \
        then mv -f ".deps/download.Tpo" ".deps/download.Po"; else rm -f ".deps/download.Tpo"; exit 1; fi
download.cc: In constructor 'core::Download::Download(torrent::Download)':
download.cc:64: error: no matching function for call to 'torrent::TrackerList::TrackerList(torrent::TrackerList*)'
/usr/local/include/torrent/tracker_list.h:146: note: candidates are: torrent::TrackerList::TrackerList(const torrent::TrackerList&)
/usr/local/include/torrent/tracker_list.h:82: note:                torrent::TrackerList::TrackerList(torrent::TrackerManager*)
download.cc: In member function 'void core::Download::enable_udp_trackers(bool)':
download.cc:86: error: conversion from 'torrent::TrackerList*' to non-scalar type 'torrent::TrackerList' requested
download.cc:89: error: 'class torrent::TrackerList' has no member named 'get'
download.cc:91: error: 'class torrent::TrackerList' has no member named 'get'
download.cc:93: error: 'class torrent::TrackerList' has no member named 'get'
download.cc:89: warning: suggest explicit braces to avoid ambiguous 'else'
make[3]: *** [download.o] Error 1
make[3]: Leaving directory `/usr/local/src/rtorrent-0.7.6/src/core'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/rtorrent-0.7.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/rtorrent-0.7.6'
make: *** [all] Error 2



All times are GMT -5. The time now is 11:56 PM.