LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-05-2011, 03:50 PM   #1
mike lear
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Rep: Reputation: 0
gtkmm makefile


I have written and tested several gtkmm app files which I wish to package as a tar.gz distribution. However the Gnu auto-tools package fails to see
my gtkmm-2.4 libraries or headers. It sees the stdc++ libraries ok. I wonder
if anyone else has had this problem. When I run configure it fails to see
gtkmm.h. The output from my configure script give the following:
checking for iostream... yes
checking memory usability... yes
checking memory presence... yes
checking for memory... yes
checking gtkmm.h usability... no
checking gtkmm.h presence... no
checking for gtkmm.h... no
checking gtkmm/main.h usability... no
checking gtkmm/main.h presence... no
checking for gtkmm/main.h... no
I can build the files using pkg-config but this doesn't fix my configuration.ac file problem.
Thanks in advance
 
Old 04-08-2011, 04:42 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,396

Rep: Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814
How/where did you install gtkmm? What did you put in configure.ac to check for gktmm?

Quote:
I can build the files using pkg-config but this doesn't fix my configuration.ac file problem.
Have you considered using the pkg-config autoconf macros: The PKG_CHECK_MODULES Macro.
 
1 members found this post helpful.
Old 04-11-2011, 01:57 AM   #3
mike lear
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Regarding the installation of gtkmm I am using Fedora 14 and used the yum package installer to intall gtkmm-2.4 and gtkmm-3.0 with the development libraries for both versions. The yum installer also includes cairo ,pango ect all the dependencies. My
configure.ac file is depicted below.
dnl
AC_PREREQ([2.66])
AC_INIT([Vimake_Gui], [1-18], [mikeofthenight2003@yahoo.com])
AM_INIT_AUTOMAKE([1.11 no-define])
AC_CONFIG_SRCDIR([src/vghelp.cc])
AC_PREFIX_DEFAULT([$HOME])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_LANG_CPLUSPLUS
LDFLAGS=`pkg-config gtkmm-2.4 --libs`
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.4.0])
AC_CHECK_LIB(gtkmm-2.4, _init,,
AC_MSG_ERROR(Essential library libgtkmm-2.4 not found))
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)
CPPFLAGS=`pkg-config gtkmm-2.4 --cflags`
AC_CHECK_HEADERS([cstdlib])
AC_CHECK_HEADERS([string])
AC_CHECK_HEADERS([iostream])
AC_CHECK_HEADERS([memory])--
AC_CHECK_HEADERS([vector])
AC_CHECK_HEADERS([gtkmm.h])
AC_CHECK_HEADER([gtkmm/main.h],[AC_DEFINE([HAVE_GTKMM_H], [1],
[Define to 1 if you have <gtkmm/main.h>.])],[AC_MSG_ERROR([sorry, you need to have gtkmm-2.4 installed!])])
AC_HEADER_STDBOOL
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

I am using gtkmm-2.4 as the gtkmm-3.0 version that I have installed fails to build using pkg-config on two different pc's running Fedora 14.
It fails with the same fault on any files I try to build with gtkmm-3.0
command used:
g++ examplewindow.cc examplewindow.cc -o test_example `pkg-config gtkmm-3.0 --cflags --libs`
Error returned:
/usr/include/gtk-3.0/gtk/gtkapplication.h:57:3: error: ‘GApplication’ does not name a type

The comfigure.ac file works only because I have used the pkg-config commands.
Any advice would be appreciated.
 
Old 04-11-2011, 07:28 AM   #4
mike lear
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
The line in my previous posting read:
g++ examplewindow.cc examplewindow.cc -o test_example `pkg-config gtkmm-3.0 --cflags --libs`
It should have read
g++ examplewindow.cc exampledialog.cc main.cc -o test_example `pkg-config gtkmm-3.0 --cflags --libs`
I was quite sleepy when I posted the earlier question.
 
Old 04-11-2011, 09:26 PM   #5
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,396

Rep: Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814
Code:
LDFLAGS=`pkg-config gtkmm-2.4 --libs`
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.4.0])
AC_CHECK_LIB(gtkmm-2.4, _init,,
AC_MSG_ERROR(Essential library libgtkmm-2.4 not found))
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)
You don't need the direct call to pkg-config if you are using PKG_CHECK_MODULES, just use GTKMM_CFLAGS and GTKMM_LIBS in your makefile. The manual checks for gtkmm.h and libgtkmm are also redundant.
 
Old 04-12-2011, 02:25 AM   #6
mike lear
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
If I comment out the direct calls to pkg-config in the configure.ac
dnl LDFLAGS=`pkg-config gtkmm-2.4 --libs`
dnl CPPFLAGS=`pkg-config gtkmm-2.4 --cflags`

My Makedile.am already contains the following
AM_CXXFLAGS = $(GTKMM_CFLAGS)
vgabout_LDADD = $(GTKMM_LIBS)

Running .configure after a autoreconf -if
gives me the following output
....
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GTKMM... yes
checking for _init in -lgtkmm-2.4... yes
... // skipping parts of output not relevant
further down...
checking for vector... yes
checking gtkmm.h usability... no
checking gtkmm.h presence... no
checking for gtkmm.h... no
checking gtkmm/main.h usability... no
checking gtkmm/main.h presence... no
checking for gtkmm/main.h... no
configure: error: sorry, you need to have gtkmm-2.4 installed!

Configure now sees the pkg-config and GTKMM yet does not see gtkmm.h
If I uncomment the CXXFLAGS=pkg-config... then re-running the commands it then sees gtkmm.h but when I then run make it fails to see all of the GTKMM library paths and fails during the make with the following:
/usr/bin/ld: note: 'virtual thunk to Atk::Implementor::~Implementor()' is defined in DSO /usr/lib/libatkmm-1.6.so.1 so try adding it to the linker command line
Once I uncomment both direct calls to pkg-config in configure.ac it then configures and builds with no errors.
I am confused am I missing something ?
 
Old 04-12-2011, 06:53 AM   #7
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,396

Rep: Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814
If you want the test for gtkmm headers to work in configure then you have to set the CFLAGS in configure:
Code:
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.4.0])
CFLAGS="$GTKMM_CFLAGS $CFLAGS"
AC_CHECK_LIB(gtkmm-2.4, _init,,
AC_MSG_ERROR(Essential library libgtkmm-2.4 not found))
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)
...
AC_CHECK_HEADERS([gtkmm.h])
AC_CHECK_HEADER([gtkmm/main.h],[AC_DEFINE([HAVE_GTKMM_H], [1],
[Define to 1 if you have <gtkmm/main.h>.])],[AC_MSG_ERROR([sorry, you need to have gtkmm-2.4 installed!])])
But I would suggest removing the manual check for gtkmm headers: it's redundant because PKG_CHECK_MODULES will signal an error if gtkmm is not installed.


Quote:
My Makedile.am already contains the following
AM_CXXFLAGS = $(GTKMM_CFLAGS)
vgabout_LDADD = $(GTKMM_LIBS)
How come you are assigning to AM_CXXFLAGS but vgabout_LDADD?
Quote:
If I uncomment the CXXFLAGS=pkg-config... then re-running the commands it then sees gtkmm.h but when I then run make it fails to see all of the GTKMM library paths
You assigned to LDFLAGS in the direct call, but vgabout_LDADD for the PKG_CHECK_MODULES result, that may explain why it fails to find the libraries.
 
Old 04-13-2011, 05:36 AM   #8
mike lear
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
I will try the options you suggest I am at work at the present so won't have access to my programs until later.
It seems you have spotted a typeo I have missed over the last week. The word in Makefile.am should have read AM_LDADD and not
vgabout_LDADD. I think I missed it because I have been concentrating on the configure.ac file and not the Makefile, because I
managed to get it to work with the two direct commands to pkg-config I wrongly assumed the Makefile.am was correct and never really checked it.
Thanks I will give it a go later.
 
Old 04-13-2011, 11:52 AM   #9
mike lear
LQ Newbie
 
Registered: Feb 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Back home I tried out your suggestions and it now works fine with the following:
In Makefile.am:
AM_CXXFLAGS = $(GTKMM_CFLAGS)
LDADD = $(GTKMM_LIBS)

in configure.ac:
AC_INIT(./src/vgabout.cc)
AC_PREREQ(2.66)
AM_INIT_AUTOMAKE(vimakegui,1.0)
AM_CONFIG_HEADER(config.h)
AC_PROG_CXX
dnl AC_DEFINE(GTKMM)
AC_PREFIX_DEFAULT([$HOME])
PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.4.0])
CFLAGS="$GTKMM_CFLAGS $CFLAGS"
AC_CHECK_HEADERS([iostream])
AC_CHECK_HEADERS([memory])
AC_CHECK_HEADERS([vector])
AC_CHECK_HEADERS([gtkmm.h])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

Thanks very much for your assistance and patience. Mike Lear
 
  


Reply

Tags
autoconf, make, pkgconfig


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
make: Warning: Both `makefile' and `Makefile' exist ? malli42108 Solaris / OpenSolaris 5 10-24-2009 09:09 AM
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp narender.d Linux - Kernel 3 05-29-2009 06:26 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 12:23 PM


All times are GMT -5. The time now is 05:20 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