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 02-26-2024, 07:51 AM   #1
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
"make" works. "make distcheck" doesn't.


I am converting some programs I wrote from gtk2 to gtk3, and making some other minor changes on the way.

The particular package that is giving me grief started out as a simple buttonbar to launch preselected programs and then acquired a couple of extra bits of desktop furniture: a mount tool (based on the one in Damn Small Linux) and a trashcan. There are two subdirectories under src: barbarella and accessories. I want to use the same header barbarella.h in both directories but distcheck doesn't allow that, neither with a copy nor with a link.

What do I do?
 
Old 02-26-2024, 08:26 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,638

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Quote:
Originally Posted by hazel View Post
I am converting some programs I wrote from gtk2 to gtk3, and making some other minor changes on the way.

The particular package that is giving me grief started out as a simple buttonbar to launch preselected programs and then acquired a couple of extra bits of desktop furniture: a mount tool (based on the one in Damn Small Linux) and a trashcan. There are two subdirectories under src: barbarella and accessories. I want to use the same header barbarella.h in both directories but distcheck doesn't allow that, neither with a copy nor with a link.

What do I do?
Well for one, provide the exact error message and a bit of context so we have a place to start?
 
1 members found this post helpful.
Old 02-26-2024, 08:30 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579

Original Poster
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Code:
make[3]: Entering directory '/home/data/programming/barbarella/barbarella-4.0.3/barbarella-4.0.3/_build/sub/src/accessories'
gcc -DHAVE_CONFIG_H -I. -I../../../../src/accessories -I../..  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DICON_DIR=\""/home/data/programming/barbarella/barbarella-4.0.3/barbarella-4.0.3/_inst/share/pixmaps"\"   -g -O2 -MT mounts.o -MD -MP -MF .deps/mounts.Tpo -c -o mounts.o ../../../../src/accessories/mounts.c
../../../../src/accessories/mounts.c:3:10: fatal error: barbarella.h: No such file or directory
    3 | #include "barbarella.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
This is the second stage of compilation. The first stage builds the barbarella bar and doesn't complain about anything. Then it tries to build the mount tool and chokes.
 
Old 02-26-2024, 08:37 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
I don't understand what did you do, but based on the error message you need a -I<location of barbarella.h> into that gcc command.
By the way you have a lot of duplicates in it.
 
Old 02-26-2024, 08:46 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579

Original Poster
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Quote:
Originally Posted by pan64 View Post
I don't understand what did you do, but based on the error message you need a -I<location of barbarella.h> into that gcc command.
That's a good starting point. Now where do I specify that in an autotools package? I'm aware that I could define a CFLAGS environmental variable containing -I but that wouldn't get into the built package, would it?

In configure.ac? Here's the contents of that file if you're interested:
Code:
AC_INIT([barbarella], [4.0.3], [hazel_russman@yahoo.co.uk])
AM_INIT_AUTOMAKE([-Wall, -Werror foreign])
AC_CONFIG_HEADERS([config.h])

AC_PROG_CC

dnl Checks for libraries.
PKG_CHECK_MODULES(DEPS, gtk+-3.0 >= 3.2 glib-2.0 >= 2.2)
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)

AC_CHECK_HEADERS([stdlib.h string.h unistd.h blkid/blkid.h])
AC_FUNC_REALLOC


AC_CONFIG_FILES([
 Makefile
 src/barbarella/Makefile
 src/accessories/Makefile
 doc/Makefile
])
AC_OUTPUT
Quote:
By the way you have a lot of duplicates in it.
I never noticed that. Where did they all come from? I must admit that autotools is a black box for me.

Last edited by hazel; 02-26-2024 at 09:47 AM. Reason: Additional suggestion re CFLAGS
 
Old 02-26-2024, 07:46 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
I think we need to see the Makefile.am files.
 
Old 02-26-2024, 11:54 PM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579

Original Poster
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Quote:
Originally Posted by ntubski View Post
I think we need to see the Makefile.am files.
The only active lines in the main one are:
Quote:
EXTRA_DIST = reconf configure
SUBDIRS = doc src/barbarella src/accessories
src/barbarella:
Quote:
icondir = $(datadir)/pixmaps
icon_DATA = barbarella.png
EXTRA_DIST = $(icon_DATA)

bin_PROGRAMS = barbarella

barbarella_SOURCES = configfile.c buttonbar.c barbarella.h
barbarella_LDADD = $(DEPS_LIBS) -lX11

AM_CPPFLAGS = $(DEPS_CFLAGS) \
-DICON_DIR=""$(datadir)/pixmaps""
And accessories
Code:
$ cat src/accessories/Makefile.am
##Process this file with automake to produce Makefile.in

icondir   = $(datadir)/pixmaps
icon_DATA = trash.png emptytrash.png
EXTRA_DIST   = $(icon_DATA)

bin_PROGRAMS = mount_tool trashcan
dist_bin_SCRIPTS = trash

mount_tool_SOURCES = mounts.c
trashcan_SOURCES = trashcan.c
mount_tool_LDADD = $(DEPS_LIBS) -lblkid -lX11
trashcan_LDADD = $(DEPS_LIBS) -lX11

AM_CPPFLAGS = $(DEPS_CPPFLAGS) -I@top_srcdir@\
              -DICON_DIR=\""$(datadir)/pixmaps"\"
I can see it now: The accessories subdir does contain a copy of barbarella.h but it isn't being picked up by automake.
 
Old 02-27-2024, 12:12 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by hazel View Post

I can see it now: The accessories subdir does contain a copy of barbarella.h but it isn't being picked up by automake.
It can be an ugly solution to copy it to another directory where it can be found. I still can't see how the gcc command was constructed.
 
Old 02-27-2024, 04:46 AM   #9
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Have you considered doing away with all that autotools complexity and just using a plain old makefile? If it's a small project then it probably isn't worth the pain of dealing with autotools.

Admittedly, I'm in the "cure is worse than the disease" camp when it comes to autotools, so I'm biased. I like "simple" and autotools is anything but.
 
Old 02-27-2024, 04:55 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579

Original Poster
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Forget it. I've completely screwed it up now. I'm going to start again with the last gtk2 version that definitely builds and I'll do the gtk3 conversion from there. I should be able to remember how I did it!?

PS: The edited gtk3 versions of the actual program code files were in geany, so I copied them over to a rescue directory. I can use those for reference.

Quote:
Originally Posted by GazL View Post
Have you considered doing away with all that autotools complexity and just using a plain old makefile? If it's a small project then it probably isn't worth the pain of dealing with autotools.
There's a few source files involved. I don't know enough about make to do it by hand.

Last edited by hazel; 02-27-2024 at 05:18 AM. Reason: Added paragraph
 
Old 02-27-2024, 07:28 AM   #11
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by hazel View Post
I can see it now: The accessories subdir does contain a copy of barbarella.h but it isn't being picked up by automake.
I think that's because you didn't add the copied file to any of the lists. But you should just be able to add -I@top_srcdir@/barbarella to AM_CPPFLAGS in accessories/Makefile.am instead of having an extra copy.

https://www.gnu.org/software/automak...e.html#Headers
Quote:
All header files must be listed somewhere; in a _SOURCES variable or in a _HEADERS variable. Missing ones will not appear in the distribution.
 
Old 02-27-2024, 10:41 AM   #12
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579

Original Poster
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
OK, now it works. My mistake was to try to have a single header for all three programs. Two of them are simple one-file programs, so they don't need a separate header.

"make distcheck" now works, so the initial query is solved.

The current version still loads some library headers multiple times and I don't know why, but it clearly isn't doing any harm.
Code:
gcc -DHAVE_CONFIG_H -I. -I../../../../src/accessories -I../..  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DICON_DIR=""/home/data/programming/barbarella/barbarella-4.0.3/barbarella-4.0.3/_inst/share/pixmaps""   -g -O2 -MT mounts.o -MD -MP -MF .deps/mounts.Tpo -c -o mounts.o ../../../../src/accessories/mounts.c

gcc -DHAVE_CONFIG_H -I. -I../../../../src/barbarella -I../..  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DICON_DIR=""/home/data/programming/barbarella/barbarella-4.0.3/barbarella-4.0.3/_inst/share/pixmaps""   -g -O2 -MT configfile.o -MD -MP -MF .deps/configfile.Tpo -c -o configfile.o ../../../../src/barbarella/configfile.c

Last edited by hazel; 02-27-2024 at 10:48 AM.
 
Old 02-27-2024, 10:47 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
That is not a problem. It is working, just not nice. The construction of gcc commands can be probably simplified, but not that important if otherwise working.
 
1 members found this post helpful.
Old 02-27-2024, 09:34 PM   #14
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by hazel View Post
The current version still loads some library headers multiple times and I don't know why, but it clearly isn't doing any harm.
I guess there is some overlap in the include file paths for gtk+-3.0 and glib-2.0. I don't think it would be worth the trouble to reduce the duplication, actually I would just go and enable silent-rules so you don't have to see the verbosity most of the time.

https://www.gnu.org/software/automak...es-Option.html
 
Old 02-28-2024, 12:01 AM   #15
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,579

Original Poster
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Quote:
Originally Posted by ntubski View Post
I guess there is some overlap in the include file paths for gtk+-3.0 and glib-2.0. I don't think it would be worth the trouble to reduce the duplication, actually I would just go and enable silent-rules so you don't have to see the verbosity most of the time.

https://www.gnu.org/software/automak...es-Option.html
Why bother? It doesn't do any harm, does it? I never even noticed it until pan64 mentioned it in #4.
 
  


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
Make distcheck breaks, seems not getting my po/POTFILES.in gtglus Linux - General 1 10-05-2009 05:32 AM
Mounting works, playing music works, reading tags doesn't Celettu Linux - Newbie 7 08-23-2006 12:27 PM
What should i do to make games works perfect ? What should i do to make games works p GameMaker Linux - Games 3 02-05-2006 02:04 PM
XAWTV works, videodog works, motion works but how to code my own? rylan76 Linux - Hardware 0 01-06-2006 06:30 AM
Echo /devPrinting doesn't work, echo /usb/lp0 works, Testpage works, Printing doesn't Hegemon Linux - General 3 08-15-2002 01:13 PM

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

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