Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What I mean is, I intend to work a bit on an open source project which I already have installed through my system packages. What I'm wondering is if there is a suggested workflow for managing this situation, where I want to keep my system-installed packages but also compile and run the version I'm developing.

My question is general as I've wondered this before with other projects, but this particular instance drove me to ask this question.

The project I'm referring to is rtorrent. The project has a other dependencies of course, but in particular it has one by the same author: libtorrent. The point is that both of these things are newer than my system's packages, so I need to pull them both and build rtorrent against that libtorrent version.

So far I have compiled libtorrent, short of actually doing make install since that is where it would clash with my system packages I imagine. It ended up dumping the library files in src/.libs, but I think I will also need access to the header file(s) as well right?.

How should I go forward with building this git-cloned rtorrent? I've never done this before so please excuse the ignorance, but does it all revolve around the ./configure script? Should I simply use use LDFLAGS to add the library path with -L and CPPFLAGS to add the include path (for header(s)) with -I? Or should I re-./configure libtorrent with a --prefix common to libtorrent and rtorrent, and then make install libtorrent?

Thanks!

EDIT: ./configure --help shows these "influential environment variables"

libtorrent_CFLAGS
          C compiler flags for libtorrent, overriding pkg-config
libtorrent_LIBS
          linker flags for libtorrent, overriding pkg-config

What I'm curious about is, this gives me the impression that even if I were to set LDFLAGS and CPPFLAGS, ultimately it gets the information for libtorrent using pkg-config anyways, so I have to use those instead. Using those did result in a successful ./configure execution, along with a --prefix parameter I think I'm good to go.

share|improve this question
1  
You can start to figure this out with "./configure --help" A lot of times, that will give you the flags you can use to build the executables against non-standard libraries. Put the "./configure --with-whatever" command in a small shell script: you will be re-running it several times. Don't hesitate to delete the source (except for your small shell script) and start o ver from scratch. –  Bruce Ediger Mar 31 '13 at 22:04
    
@BruceEdiger Thanks! Indeed I checked that out but was pretty overwhelmed with all of the options, so I was wondering instead if there was a recommended method of doing this (i.e. which options I should take a look at at the very least) rather than trying some perhaps hackish way. –  Jorge Israel Peña Mar 31 '13 at 22:07
1  
You might want to give --prefix=$HOME to install into your home when building, and adjust the flags you mention to match (and perhaps others). And also create an alias to later call your development version. –  vonbrand Mar 31 '13 at 22:21
add comment

1 Answer

up vote 1 down vote accepted

There are two major ways to handle this at runtime, using rpath-linking, or loading your development shared objects via LD_LIBRARY_PATH or LD_PRELOAD.

At compile time, you have to insert the necessary -I / -L command line options (you already found a way for this).

Well, what works for me is to use rpath-linking and stick to pkgconfig, by patching the generated config files to emit the right paths. See this script for details.

share|improve this answer
    
Thanks pyroscope. Your ability to appear everywhere to answer any rtorrent-related question never ceases to amaze me. –  Jorge Israel Peña Mar 31 '13 at 23:11
    
Google helps. ;) –  pyroscope Mar 31 '13 at 23:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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