Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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
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.
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.
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.
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 ?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.