LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-22-2010, 06:04 AM   #1
mihk
LQ Newbie
 
Registered: Oct 2005
Distribution: debian
Posts: 17

Rep: Reputation: 0
working with autotools


Hi all,
I have started to work with c++ and autotools.
I mainly maintain an application and a shared library as a hobby.
Nothing professional yet, because I want to understand the best practice strongly recommended by advanced professional programmers.

I check out my sources into $HOME/repository and svn creates:
$HOME/repository/app/application/src
$HOME/repository/lib/libutil/src
where I get c++ sources/headers + configure.ac and Makefile.am

Now I need to understand what is considered as a good practice for debugging application, either A), B) or something else.

A) install application and its dependency with:
./configure --prefix=$HOME/local
./make
./make install
export LD_LIBRARY_PATH=$HOME/local/lib
and debug application from this setup [$HOME/local/bin]

or

B)
using AM_LDFLAGS=-rpath $HOME/repository/libutil/src/.libs in Makefile.am to load a dependency from a hardcoded path.
In this way I do only:
./configure
./make

and then I debug the application in the place it was built. [$HOME/repository/app/src/]
This is the current way I am doing it.
Please understand I:
-never distributed my application
-never installed it system wide.

Can a programmer with more experience tell me more about this ?
Thank you.
 
Old 03-22-2010, 02:25 PM   #2
CoderMan
Member
 
Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375
Blog Entries: 24

Rep: Reputation: 43
As far as the generic question of whether you should test your binary in the source directory or after install: it doesn't really matter, as long as you know the binary will work in both places, and it is probably more convenient to test it without having to run "make install" first every time.

Down the road, if your application starts using external resources (image files, music, etc.) you may end up having to run make install before testing, in order to get new or modified resources into the place where the program expects to find them. This is something you'll want to keep in the back of your mind as you program. There are various ways of handling that issue, but one way is to have the configure script hard code the data installation directory into the config.h file when it is run, in which case the program will have to be installed in order to run correctly.

As far as the AM_LDFLAGS=-rpath... part, I haven't every used that myself, but I found this link that mentions both positive and negative reactions:

http://www.sourceware.org/autobook/a...tobook_88.html
 
Old 03-22-2010, 03:02 PM   #3
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
For what it's worth:

In general, I like to keep any debugging/test versions of software as close as possible to the "real" versions, so I'd go with the first option. Not that it's a huge difference at this stage, though, but it might be later as CoderMan pointed out.

And if you want to minimize typing, you can always create a wrapper script that does the build, installation & sets up LD_LIBRARY_PATH for you - especially useful if you've got lots of dependencies, or if you put lots of configure options in and you want to make sure your library at least builds & runs some test programs correctly with various combinations of them.

So, like CoderMan said - not much difference now, but maybe there will be in the future

P.S. Don't forget that build systems need debugging, too - it's nice to know that everything gets installed in its right place as early as possible, so you don't have to cope with it when you've got a large project and lots of errors related to the install!

Last edited by JohnGraham; 03-22-2010 at 03:09 PM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need some help using autotools- autoconf etc. ih8censorship Programming 2 06-25-2008 01:50 PM
autotools sergio21 Programming 2 02-10-2007 09:15 AM
autotools sergio21 Programming 1 01-16-2007 01:53 AM
slack autotools sunman Slackware 2 11-05-2005 07:17 PM
autotools data help ChimpFace9000 Linux - Software 0 06-16-2003 01:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:17 PM.

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