Discussion:
_SOURCES files in sub-directories lead to make distdir failure
netfab
2018-01-24 10:38:17 UTC
Permalink
Hi,

I'm using automake-1.15.1 to build a project using recursive makefiles.

Into that project, there's a subdirectory to build a library using
libtool-2.4.6. The source code of this library is organized into
mylib/makefile.am
mylib/aaa.cpp
mylib/aaa.h
mylib/foo/bbb.cpp
mylib/foo/bbb.h
mylib/bar/ccc.cpp
mylib/bar/ccc.h
libmyLIB_la_SOURCES = \
aaa.cpp aaa.h \
foo/bbb.cpp foo/bbb.h \
bar/ccc.cpp bar/ccc.h
AM_INIT_AUTOMAKE([subdir-objects])
When building the whole project, it works fine.
make distcheck
make[5]: Entering directory '/path/to/project/build/src/lib/mylib'
 make[5]: *** No rule to make target 'foo/bbb.h ', needed by 'distdir'. Stop.
Any advice ? Thanks.
Nick Bowler
2018-01-24 14:09:13 UTC
Permalink
Hi,
Post by netfab
Into that project, there's a subdirectory to build a library using
libtool-2.4.6. The source code of this library is organized into
mylib/makefile.am
mylib/aaa.cpp
mylib/aaa.h
mylib/foo/bbb.cpp
mylib/foo/bbb.h
mylib/bar/ccc.cpp
mylib/bar/ccc.h
Looks fine so far.
Post by netfab
libmyLIB_la_SOURCES = \
aaa.cpp aaa.h \
foo/bbb.cpp foo/bbb.h \
bar/ccc.cpp bar/ccc.h
This looks fine too.
Post by netfab
AM_INIT_AUTOMAKE([subdir-objects])
Also fine.
Post by netfab
When building the whole project, it works fine.
make distcheck
make[5]: Entering directory '/path/to/project/build/src/lib/mylib'
make[5]: *** No rule to make target 'foo/bbb.h ', needed by 'distdir'. Stop.
Any advice ? Thanks.
The thing that distcheck is testing here is that the package can be
built with separate source and build directories. It appears that this
functionality is broken in your package, and distcheck is notifying you
of this fact.

Since you are hitting this problem now, you have probably only been
testing in-tree builds until this moment.

Unfortunately your provided snippets are not complete working code, and
I expect the error involves part of the code you have not shown us.

Cheers,
Nick
netfab
2018-01-24 15:26:42 UTC
Permalink
Post by Nick Bowler
Since you are hitting this problem now, you have probably only been
testing in-tree builds until this moment.
In fact, no. Since the beginning I'm using a separate build directory.
But I did not test distcheck since I've added these lib subdirectories
and subdir-objects feature.

Basically, from a self-written makefile, I'm doing this at each
Post by Nick Bowler
cd $(build_dir) && $(top_srcdir)/configure
Unfortunately your provided snippets are not complete working code,
and I expect the error involves part of the code you have not shown
us.
If you want to see the entire stuff, everything is available at :
https://framagit.org/netfab/GLogiK
Post by Nick Bowler
cd tools/ && make autoreconf_it configure_it distcheck_it
But you may need some dependencies installed to pass the configure
phase. The lib we are talking about is src/lib/dbus/.

Thanks.
Václav Haisman
2018-01-24 16:01:12 UTC
Permalink
Post by netfab
Post by Nick Bowler
Since you are hitting this problem now, you have probably only been
testing in-tree builds until this moment.
In fact, no. Since the beginning I'm using a separate build directory.
But I did not test distcheck since I've added these lib subdirectories
and subdir-objects feature.
Basically, from a self-written makefile, I'm doing this at each
Post by Nick Bowler
cd $(build_dir) && $(top_srcdir)/configure
Unfortunately your provided snippets are not complete working code,
and I expect the error involves part of the code you have not shown
us.
https://framagit.org/netfab/GLogiK
Post by Nick Bowler
cd tools/ && make autoreconf_it configure_it distcheck_it
But you may need some dependencies installed to pass the configure
phase. The lib we are talking about is src/lib/dbus/.
Thanks.
Looking at your Makefile.am, I would suggest to change it a bit and
avoid SUBDIRS entirely, if you can. See
https://github.com/log4cplus/log4cplus/blob/master/Makefile.am and
https://github.com/log4cplus/log4cplus/blob/master/src/Makefile.am as
examples of how to build libraries with sources in sub-directoris
without using SUBDIRS. It improves build parallelism.
--
VH
netfab
2018-01-24 16:04:43 UTC
Permalink
Post by Václav Haisman
Looking at your Makefile.am, I would suggest to change it a bit and
avoid SUBDIRS entirely, if you can. See
https://github.com/log4cplus/log4cplus/blob/master/Makefile.am and
https://github.com/log4cplus/log4cplus/blob/master/src/Makefile.am as
examples of how to build libraries with sources in sub-directoris
without using SUBDIRS. It improves build parallelism.
Thanks, I will look into it.
netfab
2018-01-24 19:28:17 UTC
Permalink
Post by netfab
Post by Václav Haisman
Looking at your Makefile.am,
[...]
without using SUBDIRS. It improves build parallelism.
Thanks, I will look into it.
Ok, killed SUBDIRS :

https://framagit.org/netfab/GLogiK/commit/c3a88a89b486aa45e9f6b462e11b4f2c96812709
Post by netfab
make[2]: Entering directory '/home/netfab/dev/projects/GLogiK/build'
 make[2]: *** No rule to make target 'src/lib/dbus/messages/GKDBusMessage.h ', needed by 'distdir'. Stop.
:/
Bob Friesenhahn
2018-01-24 20:13:30 UTC
Permalink
Post by netfab
https://framagit.org/netfab/GLogiK/commit/c3a88a89b486aa45e9f6b462e11b4f2c96812709
Post by netfab
make[2]: Entering directory '/home/netfab/dev/projects/GLogiK/build'
 make[2]: *** No rule to make target 'src/lib/dbus/messages/GKDBusMessage.h ', needed by 'distdir'. Stop.
Have you made sure that the distribution tarball is packaging up this
header file?

Bob
--
Bob Friesenhahn
***@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
netfab
2018-01-24 20:25:56 UTC
Permalink
Post by Bob Friesenhahn
Have you made sure that the distribution tarball is packaging up this
header file?
How do I check this ? I do not have any tarball.
Make distcheck should create the tarball, and unpack it to run the
build into separate directory.
Post by Bob Friesenhahn
maude_SOURCES
This variable, if it exists, lists all the source files that
are compiled to build the program. These files are added to
the distribution by default.
Do I misunderstand something ?


1. https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
Bob Friesenhahn
2018-01-24 22:58:21 UTC
Permalink
Post by netfab
Post by Bob Friesenhahn
Have you made sure that the distribution tarball is packaging up this
header file?
How do I check this ? I do not have any tarball.
Make distcheck should create the tarball, and unpack it to run the
build into separate directory.
Make distcheck will create a tarball (the 'make dist' part) before it
moves on to subsequent steps.

Bob
--
Bob Friesenhahn
***@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Václav Haisman
2018-01-24 15:16:16 UTC
Permalink
Post by netfab
Hi,
I'm using automake-1.15.1 to build a project using recursive makefiles.
Into that project, there's a subdirectory to build a library using
libtool-2.4.6. The source code of this library is organized into
mylib/makefile.am
mylib/aaa.cpp
mylib/aaa.h
mylib/foo/bbb.cpp
mylib/foo/bbb.h
mylib/bar/ccc.cpp
mylib/bar/ccc.h
libmyLIB_la_SOURCES = \
aaa.cpp aaa.h \
foo/bbb.cpp foo/bbb.h \
bar/ccc.cpp bar/ccc.h
What if you use %D%/aaa.cpp %D%/foo/bbb.cpp etc.?
Post by netfab
AM_INIT_AUTOMAKE([subdir-objects])
When building the whole project, it works fine.
make distcheck
make[5]: Entering directory '/path/to/project/build/src/lib/mylib'
make[5]: *** No rule to make target 'foo/bbb.h ', needed by 'distdir'. Stop.
Any advice ? Thanks.
--
VH
netfab
2018-01-24 15:37:37 UTC
Permalink
Post by Václav Haisman
libmyLIB_la_SOURCES = \
aaa.cpp aaa.h \
foo/bbb.cpp foo/bbb.h \
bar/ccc.cpp bar/ccc.h
What if you use %D%/aaa.cpp %D%/foo/bbb.cpp etc.?
What is %D% ?

I tried, but it does not seems to change anything.
Post by Václav Haisman
Even though repeating the same path prefix for each source file might
seem a useless repetition, it is a common mistake to try using a
variable to hold the prefix. Indeed automake does not expand
variables in _SOURCES definitions.
1. https://autotools.io/automake/nonrecursive.html
Václav Haisman
2018-01-24 15:40:03 UTC
Permalink
Post by netfab
Post by Václav Haisman
libmyLIB_la_SOURCES = \
aaa.cpp aaa.h \
foo/bbb.cpp foo/bbb.h \
bar/ccc.cpp bar/ccc.h
What if you use %D%/aaa.cpp %D%/foo/bbb.cpp etc.?
What is %D% ?
I tried, but it does not seems to change anything.
Post by Václav Haisman
Even though repeating the same path prefix for each source file might
seem a useless repetition, it is a common mistake to try using a
variable to hold the prefix. Indeed automake does not expand
variables in _SOURCES definitions.
1. https://autotools.io/automake/nonrecursive.html
See here: https://www.gnu.org/software/automake/manual/html_node/Include.html
It is a special thing.
--
VH
netfab
2018-01-25 11:37:07 UTC
Permalink
When running make distdir with debug flag, grepping and tailing the
$ LANG=C make -d distdir | grep Considering | tail -n 5
 Considering target file '/home/netfab/dev/projects/GLogiK/tools/../src/lib/dbus/arguments/GKDBusArgMacro.h'.
 Considering target file '/home/netfab/dev/projects/GLogiK/tools/../src/lib/dbus/arguments/GKDBusArgMacrosBank.cpp'.
 Considering target file '/home/netfab/dev/projects/GLogiK/tools/../src/lib/dbus/arguments/GKDBusArgMacrosBank.h'.
 Considering target file '/home/netfab/dev/projects/GLogiK/tools/../src/lib/dbus/messages/GKDBusMessage.cpp'.
 Considering target file 'src/lib/dbus/messages/GKDBusMessage.h '.
 make: *** No rule to make target'src/lib/dbus/messages/GKDBusMessage.h ', needed by 'distdir'. Stop.
I wonder why the last target path before the error is relative. It
should be absolute.
netfab
2018-01-25 12:56:33 UTC
Permalink
Post by netfab
When running make distdir with debug flag, grepping and tailing the
[...]
 Considering target file 'src/lib/dbus/messages/GKDBusMessage.h '.
 make: *** No rule to make target'src/lib/dbus/messages/GKDBusMessage.h ', needed by 'distdir'. Stop.
I wonder why the last target path before the error is relative. It
should be absolute.
I got it !

But I still don't understand it.

In my makefile.am file, in the _SOURCES variable, I have the list of
Post by netfab
%D%/messages/GKDBusMessage.cpp \
%D%/messages/GKDBusMessage.h \
%D%/messages/GKDBusReply.cpp \
%D%/messages/GKDBusReply.h \
I seems that the space character at the end of each .h line before
the \ is wrong. If I remove it, and insert a new space, git diff is
Post by netfab
$ git diff
diff --git a/src/lib/dbus/Makefile.am b/src/lib/dbus/Makefile.am
index fd06217..76fd1f3 100644
--- a/src/lib/dbus/Makefile.am
+++ b/src/lib/dbus/Makefile.am
@@ -30,9 +30,9 @@ libGLogiKDBus_la_SOURCES = \
%D%/arguments/GKDBusArgMacrosBank.cpp \
%D%/arguments/GKDBusArgMacrosBank.h \
%D%/messages/GKDBusMessage.cpp \
- %D%/messages/GKDBusMessage.h \
+ %D%/messages/GKDBusMessage.h \
%D%/messages/GKDBusReply.cpp \
- %D%/messages/GKDBusReply.h \
+ %D%/messages/GKDBusReply.h \
%D%/messages/GKDBusErrorReply.cpp \
%D%/messages/GKDBusErrorReply.h \
%D%/messages/GKDBusRemoteMethodCall.cpp \
Considering target file 'src/lib/dbus/messages/GKDBusMessage.h'.
--
No need to remake target 'src/lib/dbus/messages/GKDBusMessage.h';
using VPATH name
'/home/netfab/dev/projects/GLogiK/tools/../src/lib/dbus/messages/GKDBusMessage.h'.
That seems to happen with ten headers lines.

What I don't understand is that vim does not show me any difference
between those spaces, and I don't know where they come from.

distcheck is running fine now. Thanks all.

Loading...