[PATCH] Makefile.am: add explicit `isl_version.lo` -> `gitversion.h`

5 views
Skip to first unread message

Sergei Trofimovich

unread,
Sep 7, 2025, 10:47:21 AMSep 7
to isl-dev...@googlegroups.com, Sven Verdoolaege, Sergei Trofimovich
Normally adding `gitversion.h` to `BUILT_SOURCES` would be enough
to make sure `gitversion.h` is created early enough. But `isl`
also has `interface/isl.py` in `BUILT_SOURCES`. That pulls in
`gitversion.h` via a long depdendency chain:

interface/isl.py -> interface/isldlname.py -> libisl.la
-> isl_version.lo -> gitversion.h

I noticed as an occasional build failure in `--shuffle` build mode:

$ make -j16 --shuffle
...
isl_version.c:2:10: fatal error: gitversion.h: No such file or directory
2 | #include "gitversion.h"
| ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:2017: isl_version.lo] Error 1 shuffle=459247208

The change adds an explicit dependency on object file that depends on
`gitversion.h`.

Before the change about 50% of builds failes in `--shuffle` mode.
After the change `isl` survived 20 rebuilds without failures.

Signed-off-by: Sergei Trofimovich <sly...@gmail.com>
---
Makefile.am | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 29371d95..c5a3918c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -726,6 +726,20 @@ pkgconfig_DATA = $(pkgconfig_libfile)
gitversion.h: @GIT_HEAD@
$(AM_V_GEN)echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@

+# Specify explicit dependency as BUILT_SOURCES have an interdependency
+# internally between `interface/isl.py` and `gitversion.h`:
+# interface/isl.py -> interface/isldlname.py -> libisl.la
+# -> isl_version.lo -> gitversion.h
+# Without the depenndency the build sometimes fails:
+# $ make -j16 --shuffle
+# ...
+# isl_version.c:2:10: fatal error: gitversion.h: No such file or directory
+# 2 | #include "gitversion.h"
+# | ^~~~~~~~~~~~~~
+# compilation terminated.
+# make: *** [Makefile:2017: isl_version.lo] Error 1 shuffle=459247208
+isl_version.lo: gitversion.h
+
install-data-local: $(srcdir)/libisl-gdb.py
@libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \
$(builddir)/libisl.la`; \
--
2.50.1

Sven Verdoolaege

unread,
Sep 7, 2025, 11:56:47 AMSep 7
to Sergei Trofimovich, isl-dev...@googlegroups.com
On Sat, Sep 06, 2025 at 11:45:08PM +0100, Sergei Trofimovich wrote:
> Normally adding `gitversion.h` to `BUILT_SOURCES` would be enough
> to make sure `gitversion.h` is created early enough. But `isl`
> also has `interface/isl.py` in `BUILT_SOURCES`. That pulls in
> `gitversion.h` via a long depdendency chain:
>
> interface/isl.py -> interface/isldlname.py -> libisl.la
> -> isl_version.lo -> gitversion.h
>
> I noticed as an occasional build failure in `--shuffle` build mode:
>
> $ make -j16 --shuffle
> ...
> isl_version.c:2:10: fatal error: gitversion.h: No such file or directory
> 2 | #include "gitversion.h"
> | ^~~~~~~~~~~~~~
> compilation terminated.
> make: *** [Makefile:2017: isl_version.lo] Error 1 shuffle=459247208
>

Thanks for the detailed report and the patch.

However, I'm wondering if perhaps I simply made a mistake
by adding interface/isl.py to BUILT_SOURCES.
There shouldn't be any need to do that.

Would the following patch fix the problem as well?

skimo

diff --git a/Makefile.am b/Makefile.am
index 29371d9503..cf31453eef 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -513,7 +513,7 @@ if HAVE_CXX11
BUILT_CPP_INTERFACES = $(CPP_INTERFACES)
endif
endif
-BUILT_SOURCES = gitversion.h $(BUILT_CPP_INTERFACES) interface/isl.py
+BUILT_SOURCES = gitversion.h $(BUILT_CPP_INTERFACES)
CLEANFILES = \
gitversion.h \
interface/isldlname.py \
@@ -726,6 +726,8 @@ pkgconfig_DATA = $(pkgconfig_libfile)
gitversion.h: @GIT_HEAD@
$(AM_V_GEN)echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@

+all-local: interface/isl.py

Sergei Trofimovich

unread,
Sep 7, 2025, 4:57:32 PMSep 7
to Sven Verdoolaege, sven.ver...@gmail.com, isl-dev...@googlegroups.com
On Sun, 7 Sep 2025 17:56:40 +0200
Sven Verdoolaege <sven.ver...@telenet.be> wrote:

> On Sat, Sep 06, 2025 at 11:45:08PM +0100, Sergei Trofimovich wrote:
> > Normally adding `gitversion.h` to `BUILT_SOURCES` would be enough
> > to make sure `gitversion.h` is created early enough. But `isl`
> > also has `interface/isl.py` in `BUILT_SOURCES`. That pulls in
> > `gitversion.h` via a long depdendency chain:
> >
> > interface/isl.py -> interface/isldlname.py -> libisl.la
> > -> isl_version.lo -> gitversion.h
> >
> > I noticed as an occasional build failure in `--shuffle` build mode:
> >
> > $ make -j16 --shuffle
> > ...
> > isl_version.c:2:10: fatal error: gitversion.h: No such file or
> > directory 2 | #include "gitversion.h"
> > | ^~~~~~~~~~~~~~
> > compilation terminated.
> > make: *** [Makefile:2017: isl_version.lo] Error 1
> > shuffle=459247208
>
> Thanks for the detailed report and the patch.
>
> However, I'm wondering if perhaps I simply made a mistake
> by adding interface/isl.py to BUILT_SOURCES.
> There shouldn't be any need to do that.
>
> Would the following patch fix the problem as well?

Yup! Your change fixes the build failure for me as well: survived 25
consecutive clean builds/installs. No failures.

> skimo
>
> diff --git a/Makefile.am b/Makefile.am
> index 29371d9503..cf31453eef 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -513,7 +513,7 @@ if HAVE_CXX11
> BUILT_CPP_INTERFACES = $(CPP_INTERFACES)
> endif
> endif
> -BUILT_SOURCES = gitversion.h $(BUILT_CPP_INTERFACES) interface/isl.py
> +BUILT_SOURCES = gitversion.h $(BUILT_CPP_INTERFACES)
> CLEANFILES = \
> gitversion.h \
> interface/isldlname.py \
> @@ -726,6 +726,8 @@ pkgconfig_DATA = $(pkgconfig_libfile)
> gitversion.h: @GIT_HEAD@
> $(AM_V_GEN)echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"'
> > $@
> +all-local: interface/isl.py
> +
> install-data-local: $(srcdir)/libisl-gdb.py
> @libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/
> .*//;p;}" \ $(builddir)/libisl.la`; \


--

Sergei

Sven Verdoolaege

unread,
Sep 13, 2025, 3:41:35 PM (12 days ago) Sep 13
to Sergei Trofimovich, isl-dev...@googlegroups.com
On Sun, Sep 07, 2025 at 09:57:26PM +0100, Sergei Trofimovich wrote:
> On Sun, 7 Sep 2025 17:56:40 +0200
> Sven Verdoolaege <sven.ver...@telenet.be> wrote:
> > However, I'm wondering if perhaps I simply made a mistake
> > by adding interface/isl.py to BUILT_SOURCES.
> > There shouldn't be any need to do that.
> >
> > Would the following patch fix the problem as well?
>
> Yup! Your change fixes the build failure for me as well: survived 25
> consecutive clean builds/installs. No failures.

Thanks. Pushed out.

skimo
Reply all
Reply to author
Forward
0 new messages