LinuxQuestions.org
Review your favorite Linux distribution.
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 12-09-2012, 01:39 AM   #1
AuthorsGary
LQ Newbie
 
Registered: Dec 2012
Posts: 1

Rep: Reputation: Disabled
Cool Autotools - linking application and library and dependency issue


Hi Guys,

I'm trying to use autotools for the first time, and I'm quite new to it, I've read several tutorials about it and still I can't find myself, Autotools seems like everything I need (and will need in the future) but it is so complected

anyhow, here are my questions:

1. my project tree is quite simple:
1.1 one application composed of 2-3 files.
1.2 one static library (not shared object) that is based on other standards linux library (pthread for example).

I've tried to create a configure.ac and Makefile.am files, started with autoscan template to create the configure.ac file, it all goes well when using the
Code:
autoreconf -i
but when trying to compile with
Code:
make
the completion fails, I'm quite sure that there is something wrong with my Makefile.am

Code:
AUTOMAKE_OPTIONS = subdir-objects

bin_PROGRAMS = testapp
testapp_SOURCES = tests/testapp_threaded.c \
tests/common.h \
tests/worker.c
testapp_LDADD = workqueue.a

noinst_LIBRARIES = workqueue.a
workqueue_a_SOURCES = lib/workqueue.h \
lib/workqueue.h
workqueue_a_LDADD = pthread

2. is there another build system nearly as powerful as the autotools but more user friendly for linux world?

I must say that my intention here is to learn the process and not to solve a specific issue cause I'm sure I'm gonna need to handle such situations in the near future.

many thanks in advance

Last edited by AuthorsGary; 12-09-2012 at 02:32 AM. Reason: small change in the Makefile.am file I wrote incorrectly
 
Old 12-09-2012, 11:22 AM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,396

Rep: Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814
Quote:
Originally Posted by AuthorsGary View Post
it all goes well when using the
Code:
autoreconf -i
but when trying to compile with
Code:
make
the completion fails,
You didn't say what "fails" means, are there some error message, or what? I guess the problem is that you are missing a step, it goes like this:

Code:
autoreconf does configure.ac ---> configure & Makefile.am --> Makefile.in
./configure does Makefile.in ---> Makefile // NOTE: you missed this step
make uses Makefile to perform compilation.
Quote:
I'm quite sure that there is something wrong with my Makefile.am
Code:
...
noinst_LIBRARIES = workqueue.a
workqueue_a_SOURCES = lib/workqueue.h \
lib/workqueue.h
workqueue_a_LDADD = pthread
One of those hs should be a c, right? I also think pthread should linked to the final executable, not the helper library. Furthermore, you should also pass -pthread while compiling:
Quote:
man gcc
...
-pthread
Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker.

Quote:
2. is there another build system nearly as powerful as the autotools but more user friendly for linux world?
I think the most common system after autotools is CMake. If you aren't looking to be portable to other unixes, using plain GNU Make is probably enough.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Linking of static library with application feroz Linux - General 4 05-09-2012 07:35 AM
Library Dependency issue with PLR in Postgres 9.1 dcdon Linux - Software 1 05-03-2012 06:03 PM
first library with autotools / libtool hydraMax Programming 7 02-14-2012 10:32 AM
Linking, libraries and autotools? binarybob0001 Programming 0 05-10-2008 04:14 PM
Problems Installing/uninstalling MySQL On Fedora Fc4 (library dependency issue) donraja Linux - Software 2 05-26-2006 01:06 AM


All times are GMT -5. The time now is 04:50 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration