https://sourceware.org/bugzilla/show_bug.cgi?id=33103

            Bug ID: 33103
           Summary: elfutils fails in-tree build due to ./stack binary
                    #included via <stack>
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: general
          Assignee: unassigned at sourceware dot org
          Reporter: slyich at gmail dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

https://sourceware.org/pipermail/elfutils-devel/2024q3/007281.html has a bit of
prior discussion and even a has fix submitted
(https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=b426c4db31e7c80d4262abdd845d2ece0c9a841c).
Unfortunately the fix still fails in some scenarios: in-tree libc++ builds.

The simplest way to reproduce the build on `gcc` failure is to add `#include
<stack>` into `src/srcfiles.cxx`:

--- a/src/srcfiles.cxx
+++ b/src/srcfiles.cxx
@@ -40,6 +40,7 @@
 #include <cassert>
 #include <gelf.h>
 #include <memory>
+#include <stack> /* simulate transitive include on libc++ */

 #ifdef ENABLE_LIBDEBUGINFOD
 #include "debuginfod.h"

Now we can fail the build on `gcc`:

$ autoreconf -ifv && ./configure --enable-maintainer-mode && make && make check
...
Making all in src
  CXX      srcfiles.o
In file included from srcfiles.cxx:43:
./stack:1:1: error: stray '\177' in program
    1 | <U+007F>ELF<U+0002><U+0001><U+0001><U+0000><

This happens because src/Makefile still contains `-I .`:

    srcdir = .
    ...
    AM_CPPFLAGS = -iquote . -I$(srcdir) ...

As a workaround nixpkgs now uses out-of-tree builds as:

        mkdir build-tree
        cd build-tree
        ../configure ...

But it would be nice to fix the collision for in-tree builds.

For libc++ build failure `<stack>` is included transitively via <iostream>:

In file included from srcfiles.cxx:50:
In file included from
/nix/store/7mk6c0p1jvxm3vq2my5swi5jlidby1h7-libcxx-x86_64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/iostream:43:
In file included from
/nix/store/7mk6c0p1jvxm3vq2my5swi5jlidby1h7-libcxx-x86_64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/istream:1367:
In file included from
/nix/store/7mk6c0p1jvxm3vq2my5swi5jlidby1h7-libcxx-x86_64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/ostream:194:
In file included from
/nix/store/7mk6c0p1jvxm3vq2my5swi5jlidby1h7-libcxx-x86_64-unknown-linux-gnu-19.1.7-dev/include/c++/v1/format:246:
./stack:1:1: error: expected unqualified-id
    1 | <U+007F>ELF<U+0002><U+0001><U+0001>...

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

Reply via email to