bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71752: commit 57a889b72 breaks cross compilation of 32bit target on


From: balducci
Subject: bug#71752: 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@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@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 via email to

[Prev in Thread] Current Thread [Next in Thread]