6.0.0 GMP_PROG_EXEEXT_FOR_BUILD + IBM xlc on z/OS

Marc Glisse marc.glisse at inria.fr
Sat Apr 18 07:37:24 UTC 2015


On Fri, 17 Apr 2015, Daniel Richard G. wrote:

> I'm experimentally building GMP 6.0.0 in a z/OS environment
> (i370-ibm-openedition) using the IBM XL C compiler. Normal build,
> not a cross.
>
> Configuration fails with this:
>
>    [...]
>    checking how to run the C preprocessor... /u/username/bin/xlc-wrap -E
>    checking build system compiler /u/username/bin/xlc-wrap... yes
>    checking for build system preprocessor... /u/username/bin/xlc-wrap -E
>    checking for build system executable suffix... configure: error: Cannot determine executable suffix
>
> (Note that xlc-wrap is a simple wrapper script around xlc that adds a
> couple of arguments so that -I flags work correctly; it is not
> germane here.)
>
> The relevant bit from config.log:
>
>    configure:9689: checking for build system executable suffix
>    configure:9703: /u/username/bin/xlc-wrap conftest.c -o conftest.exe
>    FSUM3008 Specify a file with the correct suffix (.c, .i, .s, .o, .x, .p, .I, or .a), or a corresponding data set name, instead of -o./conftest.exe.
>    configure:9706: $? = 1
>    configure:9703: /u/username/bin/xlc-wrap conftest.c -o conftest,ff8
>    FSUM3008 Specify a file with the correct suffix (.c, .i, .s, .o, .x, .p, .I, or .a), or a corresponding data set name, instead of -o./conftest,ff8.
>    configure:9706: $? = 1
>    configure:9703: /u/username/bin/xlc-wrap conftest.c -o conftest
>    FSUM3008 Specify a file with the correct suffix (.c, .i, .s, .o, .x, .p, .I, or .a), or a corresponding data set name, instead of -o./conftest.
>    configure:9706: $? = 1
>    configure:9716: error: Cannot determine executable suffix
>
>
> What happens is that this compiler has the unusual restriction that the
> -o option has to precede any non-option arguments (i.e. the .c source
> file), otherwise it gets interpreted as a non-option argument. (This
> does not happen for -l flags, inconsistently enough.)
>
> Changing the order of arguments in the macro definition in acinclude.m4
> fixes the problem,

autoconf seems to pass -o first in linking tests (not in compile tests 
though, you might want to discuss that with them), so I believe that 
changing the order would be fine.

> although I wonder, doesn't Autoconf already have
> logic to determine EXEEXT even in cross-compiling situations?

I am not familiar with this part of the build system, but if I understand 
correctly, GMP needs 2 toolchains, one targetting the build system (to 
generate some tables for instance) and one targetting the host system. 
Using some parts of autoconf may require splitting things into 2 separate 
configure.

Now there may be a way to short-circuit some of the logic for native 
builds...

> One other note: The compiler invocation in this macro needs to be passed
> $CFLAGS and $CPPFLAGS (or possibly $CFLAGS_FOR_BUILD and
> $CPPFLAGS_FOR_BUILD). Unless you're running something like
> "$CC --help", it's generally bad form to run the compiler without the
> user flags, as those flags may contain something necessary for it to
> work correctly.

When the compiler needs some flags to run at all, it is generally 
recommended to add them to $CC directly instead of $CFLAGS. Adding the 
flags probably makes sense, but I'll leave that to someone who understands 
it better than me.

-- 
Marc Glisse


More information about the gmp-bugs mailing list