[Bug general/33103] elfutils fails in-tree build due to ./stack binary #included via

2025-06-25 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33103

--- Comment #3 from Mark Wielaard  ---
I don't understand why this is only a problem with srcdir == builddir.
But maybe we can extend the original solution to use -iquote for srcdir. And
only have -I for lib and the top builddir (for )?

Does the following work for you?

diff --git a/config/eu.am b/config/eu.am
index 5157a34ee552..1361044804f5 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -31,7 +31,7 @@
 ##

 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
-AM_CPPFLAGS = -iquote . -I$(srcdir) -I$(top_srcdir)/lib -I..
+AM_CPPFLAGS = -iquote. -iquote$(srcdir) -I$(top_srcdir)/lib
-I$(abs_top_builddir)

 # Drop the 'u' flag that automake adds by default. It is incompatible
 # with deterministic archives.
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 25d53d31c7c8..b77db1423fe0 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -32,8 +32,8 @@
 #include 
 #include 

-#include 
-#include 
+#include "libdw.h"
+#include "dwarf.h"
 #include "eu-search.h"

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug general/33103] elfutils fails in-tree build due to ./stack binary #included via

2025-06-25 Thread slyich at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=33103

--- Comment #4 from Sergei Trofimovich  ---
(In reply to Mark Wielaard from comment #3)
> I don't understand why this is only a problem with srcdir == builddir.

AFAIU the difference in in-tree/out-of-tree is the following:

in-tree:

- builder process is in src/
- src/ contains freshly built 'stack' binary
- clang is ran as 'clang++ -iquote . -I . srcfiles.cxx'
-  is looked up from '-I .' and finds ./stack ELF

out-of-tree:

- builder process is in build-tree/src/
- build-tree/src/ contains freshly built 'stack' binary
- clang is ran as 'clang++ -iquote . -I ../../src srcfiles.cxx'
-  is looked up from '-I ../../src' and does not find ./stack (as
it's in current ./stack build tree, source tree is clean)

> But maybe we can extend the original solution to use -iquote for srcdir. And
> only have -I for lib and the top builddir (for )?
> 
> Does the following work for you?
> 
> diff --git a/config/eu.am b/config/eu.am
> index 5157a34ee552..1361044804f5 100644
> --- a/config/eu.am
> +++ b/config/eu.am
> @@ -31,7 +31,7 @@
>  ##
>  
>  DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
> -AM_CPPFLAGS = -iquote . -I$(srcdir) -I$(top_srcdir)/lib -I..
> +AM_CPPFLAGS = -iquote. -iquote$(srcdir) -I$(top_srcdir)/lib
> -I$(abs_top_builddir)
>  
>  # Drop the 'u' flag that automake adds by default. It is incompatible
>  # with deterministic archives.
> diff --git a/libdw/libdwP.h b/libdw/libdwP.h
> index 25d53d31c7c8..b77db1423fe0 100644
> --- a/libdw/libdwP.h
> +++ b/libdw/libdwP.h
> @@ -32,8 +32,8 @@
>  #include 
>  #include 
>  
> -#include 
> -#include 
> +#include "libdw.h"
> +#include "dwarf.h"
>  #include "eu-search.h"

Yes, I confirm that fixes build failure for my in-tree clang setup.

-- 
You are receiving this mail because:
You are on the CC list for the bug.