LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-06-2011, 04:58 AM   #1
klappnase
LQ Newbie
 
Registered: Oct 2003
Location: germany
Distribution: debian
Posts: 7

Rep: Reputation: 0
Unhappy How to compile against an alternate library version


Hi all,

I am trying to install a newer version of the mkvmerge tool on my Debian Etch based VDR machine, because the version installed by default misses a feature I need. This alternate mkvmerge (resp. mkvtoolnix) version requires a newer version of libmatroska than the default one however.
So I tried and downloaded the required libmatroska-0.8.1 sources from matroska.org, compiled them and then manually copied the libs into /opt/matroska/lib , the headers to /opt/matroska/include and manually set the symlink /opt/matroska/lib/libmatroska.so -> libmatroska.so.0 , because I wanted to avoid to mess up the originally installed libs.

As far as I have understood, I could then run the "alternate" mkvmerge through a tiny wrapper script like:

#!/bin/bash
export LD_LIBRARY_PATH=/opt/matroska/lib:$LD_LIBRARY_PATH
/opt/matroska/bin/mkvmerge $*
exit $?

However, mkvtoolnix fails to compile, because it cannot find the "alternate" header files in /opt/matroska/include. Apparently changing LD_LIBRARY_PATH does not help here.
Somewhere I read that I should do

export C_INCLUDE_PATH=/opt/matroska/include:C_INCLUDE_PATH

but this did not not have any effect either

I even tried a few other things that were suggested here and there, like setting the CPPFLAGS or LIBS environment variables, but nothing worked.

I guess there *must* be a way to manage this, but I am really lost now.
Any hints are much appreciated.

Thanks in advance

Michael
 
Old 12-06-2011, 07:11 AM   #2
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
./configure --help

?
 
Old 12-06-2011, 10:22 AM   #3
klappnase
LQ Newbie
 
Registered: Oct 2003
Location: germany
Distribution: debian
Posts: 7

Original Poster
Rep: Reputation: 0
Actually looking at ./configure --help was my first try, hoping to find something like --matroska-libs=... but there is no such option (see below). I tried to set --with-extra-includes=/opt/matroska/include and --with-extra-libs=/opt/matroska/lib , but this did not work either.

Regards

Michael


$ ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']

Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]

System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]

Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug compile with debug information (no)
--enable-profiling compile with profiling information (no)
--disable-posix-fadvise do not use posix_fadvise (auto)
--enable-lzo compile in support for LZO compression (auto)
--enable-bz2 compile in support for BZ2 compression (auto)
--enable-gui compile mkvinfo's GUI and mmg (yes)
--enable-wxwidgets compile the wxWidgets version of the GUIs (yes)
--enable-qt compile the Qt version of the GUIs (no)

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-words=endianness set endianness (big or little)
--with-extra-includes=DIR
Path to other include directories separated by ';'
--with-extra-libs=DIR Path to other library directories separated by ';'
--without-flac do not build with flac support
--with-wx-config=prog use prog instead of looking for wx-config
--with-moc=prog use prog instead of looking for moc
--with-uic=prog use prog instead of looking for uic
--with-boost=DIR specify the root directory for the mandatory Boost
library (default is autodetection)
--with-boost-libdir=LIB_DIR
Force given directory for boost libraries. Note that
this will overwrite library path detection, so use
this parameter only if default library detection
fails and you know exactly where your boost
libraries are located.
--with-boost-regex=special-lib
specify a certain version of the Boost regex library
for the linker e.g.
--with-boost-regex=boost_regex-gcc-mt-d-1_33_1

Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
 
Old 12-06-2011, 03:51 PM   #4
klappnase
LQ Newbie
 
Registered: Oct 2003
Location: germany
Distribution: debian
Posts: 7

Original Poster
Rep: Reputation: 0
Smile [solved]How to compile against an alternate library version

Hi again,

ok, finally the point to ./configure --help put me on the right track; after quite some more try-and-error experimenting I found that ./configure expects the includes in a "matroska" subdirectory, so moving them from /opt/matroska/include to /opt/matroska/include/matroska proved to be a big step ahead
When I managed to successfully run ./configure for the first time, I found that make stopped soon; it seemed ./configure had used the "default" libmatroska instead of the "new" one. After I temporarily removed that one I finally could make it work, by changing more environment variables. Most of these weren't necessary in the end, though.

Another test from a clean new terminal shows that what is actually needed to successfully compile mkvtoolnix is:

$ export LDFLAGS="-L/opt/matroska/lib $LDFLAGS"
$ export CPPFLAGS="-I/opt/matroska/include $CPPFLAGS"
$ ./configure --prefix=/opt/matroska --enable-gui=no
$ make
$ make install

After that I can use the newly installed /opt/matroska/bin/mkvmerge if I do

$ export LD_LIBRARY_PATH=/opt/matroska/lib:$LD_LIBRARY_PATH

before.

Regards

Michael
 
Old 12-07-2011, 12:11 PM   #5
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
Glad you could make it.
 
Old 12-07-2011, 02:44 PM   #6
klappnase
LQ Newbie
 
Registered: Oct 2003
Location: germany
Distribution: debian
Posts: 7

Original Poster
Rep: Reputation: 0
Cool

Even better, when reading http://tldp.org/HOWTO/Program-Librar...libraries.html about the -rpath compiler flag I finally found that if I change the first "export" statement from my previous post into

$ export LDFLAGS="-Wl,-rpath,/opt/matroska/lib -L/opt/matroska/lib $LDFLAGS"

and re-compile mkvtoolnix I now can use /opt/matroska/bin/mkvmerge just like a "regularly" installed program, without having to change LD_LIBRARY_PATH first
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing alternate version of gcc from source -- any tips? gratney Linux - Software 2 06-11-2008 10:18 AM
library version ust Linux - Software 1 01-07-2008 05:55 AM
library version sha_neb Linux - Software 3 08-01-2007 02:07 AM
library version?? kaz2100 Debian 1 11-11-2006 09:58 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration