#775940 Configure: determine sizeof(int) without running host arch code during cross building

Package:
src:perl
Source:
perl
Submitter:
Helmut Grohne
Date:
2020-11-15 00:21:07 UTC
Severity:
normal
Tags:
#775940#5
Date:
2015-01-21 19:00:20 UTC
From:
To:
In bug #762638, it was suggested[1] that perl's Configure is indeed
source and is indeed considered preferred form for modification (even
though the header of that file claims otherwise). Maybe it is good to
put this issue to test:

A major issue with cross building perl is that it tries to run host arch
code during configure. In quite a few cases this is completely
unnecessary. Consider its check for sizeof(int) for instance. As we know
from autotools, sizeof values can be determined by bisecting using
compile-only tests. I am therefore attaching a patch that turns the
compile&run test for sizeof(int) into a compile-only test.

Practically this means that people who wish to cross build perl no
longer need to feed the value of intsize. Of course, this is just a drop
in the bucket as there still are longsize, shortsize and many more. What
I am seeking here is the preferred method to fix all of them. So rather
than submitting a large patch pile against a possibly autogenerated
file, I am submitting an incremental improvement to observe the
processes.

I hope this works out

Helmut

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762638#29
    "The way it's set up now, we encourage people to simply patch
    Configure." (Andy Dougherty)

#775940#10
Date:
2015-04-17 19:27:44 UTC
From:
To:
Thanks, and sorry for the delay. Trying this out, I see (on amd64)
  Checking to see how big your integers are...
  try.c: In function ‘main’:
  try.c:7:13: error: size of array ‘test’ is negative
    static int test[1 - 2 * (sizeof(int) >= 1)];
               ^
  try.c: In function ‘main’:
  try.c:7:13: error: size of array ‘test’ is negative
    static int test[1 - 2 * (sizeof(int) >= 2)];
               ^
  try.c: In function ‘main’:
  try.c:7:13: error: size of array ‘test’ is negative
    static int test[1 - 2 * (sizeof(int) >= 4)];
               ^
I assume that's the expected error for too small size probes, and
a finished implementation would just redirect those to /dev/null ?

I'll forward this upstream, but please note that they're currently
frozen for a 5.22 release in May.

#775940#15
Date:
2015-04-17 19:51:38 UTC
From:
To:
Control: forwarded -1 https://rt.perl.org/Ticket/Display.html?id=124326

Now filed as [perl #124326]. I've asked that you (Helmut) be added to
the ticket distribution list so that I'm not needed as a middleman.