GNU bug report logs - #71752
commit 57a889b72 breaks cross compilation of 32bit target on 64bit host

Previous Next

Package: guile;

Reported by: balducci <at> units.it

Date: Mon, 24 Jun 2024 17:25:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71752 in the body.
You can then email your comments to 71752 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#71752; Package guile. (Mon, 24 Jun 2024 17:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to balducci <at> units.it:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 24 Jun 2024 17:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: balducci <at> units.it
To: bug-guile <at> gnu.org
Subject: commit 57a889b72 breaks cross compilation of 32bit target on 64bit
 host
Date: Mon, 24 Jun 2024 19:24:20 +0200
Hello
commit 57a889b7282dab303c4cdc49cccbbe22f961bd1c:

    commit 57a889b7282dab303c4cdc49cccbbe22f961bd1c
    Author: Jonas Hahnfeld <hahnjo <at> hahnjo.de>
    Date:   Thu Feb 22 22:09:42 2024 +0100

        build: Fix cross-compilation in out-of-tree-builds

        gen-scmconfig.h is generated in libguile, not $(top_builddir).

        * libguile/Makefile.am: Add '-I.' when compiling gen-scmconfig.o.

        Signed-off-by: Ludovic Court<C3><A8>s <ludo <at> gnu.org>

was in response to the report quoted here:

https://lists.gnu.org/archive/html/bug-guile/2024-05/msg00006.html

(apologies for not replying inside the original mail thread: I was not
subscribed at the time)

But, paradoxically, for me it breaks cross compilation of 32 bit
target on a 64 bit native host.

After successful build/install of guile-3.0.10 for the native host
(64 bit), I run the cross build with:

  --build=x86_64-unknown-linux-gnu
  --host=i686-unknown-linux-gnu

and get:

    ----8<----
    make[2]: Entering directory '/home/balducci/tmp/install-us-d/guile-3.0.10.d/guile-3.0.10/libguile'
    \
    if [ "yes" = "yes" ]; then \
            gcc -m32 -DHAVE_CONFIG_H  -I.. \
               -I. -c -o gen-scmconfig.o gen-scmconfig.c; \
    else \
            gcc -m32 -DHAVE_CONFIG_H   -DBUILDING_LIBGUILE=1 -I.. -I.. -I../lib -I../lib -iquote.  -I../libguile/lightening -I/home/balducci/tmp/install-us-d/guile-3.0.10.d/guile-3.0.10  -Wall -Wmissing-prototypes -Wpointer-arith -fno-strict-aliasing -fwrapv -fvisibility=hidden -I/opt/stow.d/versions/gc-5458/usr/include -Wno-incompatible-pointer-types  -flto -c -o gen-scmconfig.o gen-scmconfig.c; \
    fi
    In file included from ../libguile/inline.h:28,
                     from ../libguile/gc.h:25,
                     from ./strings.h:25,
                     from /usr/include/string.h:462,
                     from gen-scmconfig.c:142:
    ../libguile/scm.h:30:10: fatal error: libguile/scmconfig.h: No such file or directory
       30 | #include "libguile/scmconfig.h"
          |          ^~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[2]: *** [Makefile:4478: gen-scmconfig.o] Error 1
    make[2]: Leaving directory '/home/balducci/tmp/install-us-d/guile-3.0.10.d/guile-3.0.10/libguile'
    ---->8----

The reason seems to be precisely the "-I." added by the above mentioned
commit.

If I delete the "-I." directive the cross build completes successfully.

Actually, in my case, the reason why the "-I." causes the failure is the
following.

libguile/gen-scmconfig.c includes the string.h system header:
   #include <string.h>

On my system (GNU/linux) the /usr/include/string.h system header (from
glibc) includes a strings.h system header (note the s in strings.h):
   #include <strings.h>

It happens that in libguile, where gen-scmconfig.c is compiled, there
is also a strings.h header of the guile distribution (so totally
different from the system's /usr/include/strings.h): thus, the added
"-I." directive makes my /usr/include/string.h system header include
*guile's strings.h*, instead of my system's /usr/include/strings.h and
this causes the compile failure, due to the (wrong) chain of included
headers downstream, which ends up trying to include
libguile/scmconfig.h, which, obviously, isn't there yet, since it is
supposed to be created precisely by the gen-scmconfig executable. As I
could clarify, the wrong inclusion chain caused by the "-I." directive
is:

 gen-scmconfig.c
 `-- /usr/include/string.h # THIS WANTS /usr/include/strings.h
     `-- ./strings.h       # BUT GETS THIS ONE, INSTEAD
         `-- ../libguile/gc.h
             `-- ../libguile/inline.h
                 `-- ../libguile/scm.h
                     `-- ../libguile/scmconfig.h # ISN'T THERE, YET => ERROR

According to the original post (which then triggered the above
mentioned commit) the "-I." directive was supposed to fix the
inclusion of gen-scmconfig.h, which is created in the same directory
(libguile) where gen-scmconfig.c is compiled.

BUT: gen-scmconfig.c includes gen-scmconfig.h as a *quoted*
header:
  #include "gen-scmconfig.h"
and, at least with gcc, which I use for building, quoted headers are
looked for in the same directory of the file being compiled without
the need for a "-I." directive (OTOH, the "-I." directive makes the current
directory searched for headers BEFORE the system directories, and this
causes the build failure in my case, as detailed above).

Turning the "-I." into "-iquote." or "-idirafter." (instead of
deleting it) works for me and maybe might work also for the original
poster, but I don't think is portable outside gcc...

Apologies for the long mail: I hope to have clarified the problem

thanks a lot for your valuable work

ciao
-gabriele




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 20 Oct 2024 19:30:02 GMT) Full text and rfc822 format available.

Notification sent to balducci <at> units.it:
bug acknowledged by developer. (Sun, 20 Oct 2024 19:30:02 GMT) Full text and rfc822 format available.

Message #10 received at 71752-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: balducci <at> units.it
Cc: 71752-done <at> debbugs.gnu.org
Subject: Re: bug#71752: commit 57a889b72 breaks cross compilation of 32bit
 target on 64bit host
Date: Sun, 20 Oct 2024 21:28:27 +0200
Hi,

balducci <at> units.it skribis:

> commit 57a889b7282dab303c4cdc49cccbbe22f961bd1c:
>
>     commit 57a889b7282dab303c4cdc49cccbbe22f961bd1c
>     Author: Jonas Hahnfeld <hahnjo <at> hahnjo.de>
>     Date:   Thu Feb 22 22:09:42 2024 +0100
>
>         build: Fix cross-compilation in out-of-tree-builds
>
>         gen-scmconfig.h is generated in libguile, not $(top_builddir).
>
>         * libguile/Makefile.am: Add '-I.' when compiling gen-scmconfig.o.
>
>         Signed-off-by: Ludovic Court<C3><A8>s <ludo <at> gnu.org>
>
> was in response to the report quoted here:
>
> https://lists.gnu.org/archive/html/bug-guile/2024-05/msg00006.html
>
> (apologies for not replying inside the original mail thread: I was not
> subscribed at the time)
>
> But, paradoxically, for me it breaks cross compilation of 32 bit
> target on a 64 bit native host.

Indeed.  I did not notice your bug report at the time but this was fixed
in c117f8edc471d3362043d88959d73c6a37e7e1e9, after 3.0.10 was released.

Thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 18 Nov 2024 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 238 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.