Help with cross-compiling

103 views
Skip to first unread message

Marcus Calhoun-Lopez

unread,
Mar 27, 2022, 1:31:52 PM3/27/22
to isl Development
Greetings.

I am trying to make a universal build of isl as part of the MacPorts project (https://github.com/macports/macports-ports/tree/master/devel/isl).
This essentially means being able to cross-compile isl.
When I tried, I received the error:
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--build'.
I had set both the `--build` and the `--host` flags.

However, everything worked fine once I changed `cross_compiling_build=no` to `cross_compiling_build=maybe` in m4/ax_prog_cc_for_build.m4
    (https://repo.or.cz/isl.git/blob/HEAD:/m4/ax_prog_cc_for_build.m4#l82)

Is this an isl-specific issue, or should I be talking to the autoconf folks?

I am not very knowledgable about the autoconf tools, so any help would be greatly appreciated.

Sven Verdoolaege

unread,
Mar 28, 2022, 12:26:55 PM3/28/22
to Marcus Calhoun-Lopez, isl Development
On Sun, Mar 27, 2022 at 09:21:17AM -0700, Marcus Calhoun-Lopez wrote:
> Greetings.
>
> I am trying to make a universal build of isl as part of the MacPorts
> project (https://github.com/macports/macports-ports/tree/master/devel/isl).
> This essentially means being able to cross-compile isl.
> When I tried, I received the error:
> configure: error: cannot run C compiled programs.
> If you meant to cross compile, use `--build'.
> I had set both the `--build` and the `--host` flags.
>
> However, everything worked fine once I changed `cross_compiling_build=no`
> to `cross_compiling_build=maybe` in m4/ax_prog_cc_for_build.m4
> (https://repo.or.cz/isl.git/blob/HEAD:/m4/ax_prog_cc_for_build.m4#l82)
>
> Is this an isl-specific issue, or should I be talking to the autoconf folks?

Which version of isl are you trying to compile?
Are you using a pre-built configure or did you build your own?
If the latter, which version of autoconf are you using?

There's a known issue with more recent versions of autoconf:
https://mail.gnu.org/archive/html/bug-autoconf/2021-06/msg00000.html

If it's something else, send you config.log file(s).

skimo

Marcus Calhoun-Lopez

unread,
Mar 29, 2022, 10:03:30 AM3/29/22
to isl Development
Thank you for your response.

I am trying to build isl 0.24.
I have tried both the pre-build configure and one build with GNU Autoconf 2.71.
I have attached the config.log.

In the configure script, the following code causes the error:
    if test "$cross_compiling_build" = maybe; then
        cross_compiling_build=yes
    else
        { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot run C compiled programs.                                                                                                                                                                                              
If you meant to cross compile, use \`--build'.                                                                                                                                                                                                
See \`config.log' for more details" "$LINENO" 5; }
    fi

The reason this code causes an error is because in m4/ax_prog_cc_for_build.m4, cross_compiling_build is set to no and never changed.
Changing the initialization to cross_compiling_build=maybe seems to allow a correct build.

-Marcus
config.log

Sven Verdoolaege

unread,
Mar 30, 2022, 3:19:46 PM3/30/22
to Marcus Calhoun-Lopez, isl Development
On Tue, Mar 29, 2022 at 06:48:36AM -0700, Marcus Calhoun-Lopez wrote:
> This file contains any messages produced by compilers while
> running configure, to aid debugging if configure makes a mistake.
>
> It was created by isl configure 0.24, which was
> generated by GNU Autoconf 2.71. Invocation command line was

There's a known issue with autoconf 2.71.
Try 2.69.

skimo

Marcus Calhoun-Lopez

unread,
Apr 2, 2022, 8:40:14 AM4/2/22
to isl Development
Thank you for the recommendation.
I am afraid the problem (and solution) persists for autoconf 2.69.

-Marcus

Sven Verdoolaege

unread,
Apr 2, 2022, 9:11:32 AM4/2/22
to Marcus Calhoun-Lopez, isl Development
On Sat, Apr 02, 2022 at 05:40:14AM -0700, Marcus Calhoun-Lopez wrote:
> Thank you for the recommendation.
> I am afraid the problem (and solution) persists for autoconf 2.69.

Send that config.log.
It's probably the one in interface that is most important.
Note that as explained in the documentation, you need
to set CXX_FOR_BUILD (extract_interface is a C++ application).
I don't think there is any use in setting CC_FOR_BUILD.

skimo

Marcus Calhoun-Lopez

unread,
Apr 2, 2022, 2:50:09 PM4/2/22
to isl Development
Thank you for the help.
The config.log for autoconf 2.71 is available in the message from March 29th.
Attached is the config.log for autoconf 2.69.
The error (and workaround) seems to be the same.
config.log

Sven Verdoolaege

unread,
Apr 2, 2022, 4:29:13 PM4/2/22
to Marcus Calhoun-Lopez, isl Development
On Sat, Apr 02, 2022 at 11:50:08AM -0700, Marcus Calhoun-Lopez wrote:
> Thank you for the help.
> The config.log for autoconf 2.71 is available in the message from March
> 29th.
> Attached is the config.log for autoconf 2.69.

And how exactly did you run configure?

It's not entirely clear from config.log,
but it looks like you specified "-arch arm64" as part
of CPPFLAGS_FOR_BUILD while your build system is x86_64-apple-darwin21.
Shouldn't you specify that for the host instead?

skimo

Marcus Calhoun-Lopez

unread,
Apr 5, 2022, 1:04:08 AM4/5/22
to isl Development
Thank you so much, I believe you are correct and the problem fixed.
The combination of *_FOR_BUILD environment variables was not producing a working binary, which is, of course, the entire point of them.
Thank you again.

Reply all
Reply to author
Forward
0 new messages