Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-07 Thread Gabriel Staples, ElectricRCAircraftGuy.com
Marc, yes, I see that too now. For anyone wondering where that is, here it
is:
https://github.com/ElectricRCAircraftGuy/Microchip_XC32_Compiler/blob/main/xc32-v4.35-src/pic32m-source/gmp-6.1.0/acinclude.m4#L125-L140

What I'm calling, by the way, inside build-xc32-v4.35m.sh, is this:
https://github.com/ElectricRCAircraftGuy/Microchip_XC32_Compiler/blob/main/build-xc32-v4.35m.sh#L175
:

${gcc_srcdir}/configure \
...

So, if `gcc_srcdir` is a relative path, `#include "$srcdir/gmp-h.in"` works
in MSYS2 UCRT64 gcc on Windows. If `gcc_srcdir` is an absolute path, it
does not.

Here is a new summary I put into my answer halfway down:
https://stackoverflow.com/a/77435216/4561887:

Quick summary:

Calling the gcc configure script with a relative path causes that relative
path to get inserted into the main gcc Makefile, and then passed to the gmp
configure script, where it is injected into an autogenerated conftest.c C
file as an include statement. So, using an absolute path to call the gcc
configure script puts an absolute path in the #include inside conftest.c,
and using a relative path to call the gcc configure script puts a relative
path into that #include statement. In the MSYS2 UCRT64 gcc compiler,
however, only relative paths are allowed, due to path conversion issues of
the C:\ (in a Windows-style path) or /c/ (in a Unix-style path on Windows)
part which pertains to the beginning of absolute paths.

- Gabriel Staples


On Tue, Nov 7, 2023 at 2:17 AM Marc Glisse  wrote:

> On Tue, 7 Nov 2023, Niels Möller wrote:
>
> > (2) It makes no sense for any C code, in conftest.c or otherwise, to
> >ever attempt to include gmp-h.in. That's not a valid C header file,
> >since it lacks the substitutions that turns it into a valid gmp.h
> >header file.
>
> From acinclude.m4:
>
>
> dnl  GMP_INCLUDE_GMP_H
> dnl  -
> dnl  Expand to the right way to #include gmp-h.in.  This must be used
> dnl  instead of gmp.h, since that file isn't generated until the end of
> the
> dnl  configure.
> dnl
> dnl  Dummy value for GMP_LIMB_BITS is enough
> dnl  for all current configure-time uses of gmp.h.
>
> define(GMP_INCLUDE_GMP_H,
> [[#define __GMP_WITHIN_CONFIGURE 1   /* ignore template stuff */
> #define GMP_NAIL_BITS $GMP_NAIL_BITS
> #define GMP_LIMB_BITS 123
> $DEFN_LONG_LONG_LIMB
> #include "$srcdir/gmp-h.in"]
> ])
>
>
> --
> Marc Glisse
>
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-07 Thread Niels Möller
Marc Glisse  writes:

> From acinclude.m4:
>
>
> dnl  GMP_INCLUDE_GMP_H
> dnl  -
> dnl  Expand to the right way to #include gmp-h.in.  This must be used
> dnl  instead of gmp.h, since that file isn't generated until the end
> of the
> dnl  configure.
> dnl
> dnl  Dummy value for GMP_LIMB_BITS is enough
> dnl  for all current configure-time uses of gmp.h.
>
> define(GMP_INCLUDE_GMP_H,
> [[#define __GMP_WITHIN_CONFIGURE 1   /* ignore template stuff */
> #define GMP_NAIL_BITS $GMP_NAIL_BITS
> #define GMP_LIMB_BITS 123
> $DEFN_LONG_LONG_LIMB
> #include "$srcdir/gmp-h.in"]
> ])

Ah, I wasn't aware of that. Seems to be used for four tests, the
AC_CHECK_SIZEOF for mp_limb_t (that's the one failing in this bug
report), GMP_FUNC_ALLOCA, GMP_H_EXTERN_INLINE, and GMP_H_HAVE_FILE.

I wonder if it would be more robust to temporarily(?) add -I$srcdir to
CFLAGS?

I don't quite get how this part of the configure works, e.g., I'm
looking closer at

  AC_CHECK_SIZEOF(mp_limb_t, , GMP_INCLUDE_GMP_H)

which is used for define GMP_LIMB_BITS,

  AC_SUBST(GMP_LIMB_BITS, `expr 8 \* $ac_cv_sizeof_mp_limb_t`)

The definition of mp_limb_t in gmp-h.in depends on two preprocessor
symbols, __GMP_SHORT_LIMB (not defined by configure, so presumably set
by the user, like CFLAGS=-D__GMP_SHORT_LIMB?), and _LONG_LONG_LIMB.

But the latter depends on the substitution 

  @DEFN_LONG_LONG_LIMB@

which is skipped during the configure tests, but defined by configure
based on

  case $limb_chosen in
  longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1";;
  *)DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;;
  esac
  AC_SUBST(DEFN_LONG_LONG_LIMB)

So not clear to me if/how GMP_LIMB_BITS is set correctly in a long long
configuration?

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-07 Thread Marc Glisse

On Tue, 7 Nov 2023, Niels Möller wrote:


(2) It makes no sense for any C code, in conftest.c or otherwise, to
   ever attempt to include gmp-h.in. That's not a valid C header file,
   since it lacks the substitutions that turns it into a valid gmp.h
   header file.


From acinclude.m4:


dnl  GMP_INCLUDE_GMP_H
dnl  -
dnl  Expand to the right way to #include gmp-h.in.  This must be used
dnl  instead of gmp.h, since that file isn't generated until the end of 
the

dnl  configure.
dnl
dnl  Dummy value for GMP_LIMB_BITS is enough
dnl  for all current configure-time uses of gmp.h.

define(GMP_INCLUDE_GMP_H,
[[#define __GMP_WITHIN_CONFIGURE 1   /* ignore template stuff */
#define GMP_NAIL_BITS $GMP_NAIL_BITS
#define GMP_LIMB_BITS 123
$DEFN_LONG_LONG_LIMB
#include "$srcdir/gmp-h.in"]
])


--
Marc Glisse
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-07 Thread Gabriel Staples, ElectricRCAircraftGuy.com
"Stinking" and "stinker" are playful terms in American English--things
you'd call your little kids when they're being cute or funny. It's more of
a playful term. In this context it expresses excitement that I found the
bug. To a non-native American English speaker, I can see the confusion. I
was very calm when I wrote it.

I can see the confusion. I took the word out.

> Can you explain concisely in which way absolute include paths made gmp
configure break in your environment?

In the answer , please jump
halfway down, to the section titled "Explanation of the
${gcc_srcdir_RELATIVE}/configure relative path fix that works". I can
neither explain it more nor less simply than that.

At this point I'm no longer seeking help, but rather just sharing my
findings in case it helps someone else.

Sincerely,

Gabriel Staples



On Mon, Nov 6, 2023 at 11:51 PM Niels Möller  wrote:

> "Gabriel Staples, ElectricRCAircraftGuy.com"  writes:
>
> > Thanks, Niels. I had been looking in config.log and came across a failure
> > to include a file with an absolute path. I found the solution and wrote
> > about it here: https://stackoverflow.com/a/77435216/4561887
>
> I've had a quick look, but really too long for me to read carefully. And
> please avoid calling other peoples work ugly things like "stinky". If
> needed, please calm down before posting stuff.
>
> Can you explain concisely in which way absolute include paths made gmp
> configure break in your environment? It's not clear to me why gmp's
> configure would ever attempt to compile anything with an #include
> "/c/foo/bar.h" in it.
>
> To me, use of absolute paths on the #include line seems rather obscure,
> I'd expect relative paths, and compiler -I flags (often with absolute
> paths) pointing to location of relevant include directories.
>
> Regards,
> /Niels
>
> --
> Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
> Internet email is subject to wholesale government surveillance.
>
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-07 Thread Gabriel Staples, ElectricRCAircraftGuy.com
Thanks, Niels. I had been looking in config.log and came across a failure
to include a file with an absolute path. I found the solution and wrote
about it here: https://stackoverflow.com/a/77435216/4561887



On Fri, Nov 3, 2023 at 9:50 AM Niels Möller  wrote:

> When debugging configure issues, the first step is to check config.log.
> That should tell you in detail what configure tried to compile or run, and
> how it failed.
>
> Regards,
> /Niels
>
>
> "Gabriel Staples, ElectricRCAircraftGuy.com"  skrev:
> (3 november 2023 08:26:03 CET)
>
>> I could really use some help here. Many thanks in advance. I don't know if
>> this is a GMP problem exactly, but I've described it pretty thoroughly
>> here:
>>
>> GMP gets stuck in the configure process. Again, this may not be directly
>> due to GMP, but this is a community effort to compile the GCC Microchip
>> PIC32 compiler from source so we don't need to buy a license to program a
>> chip.
>>
>> `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t
>> doesn't seem to work` when compiling the Microchip XC32 compiler from
>> source  
>>
>> Sincerely,
>>
>> Gabriel Staples
>> --
>> gmp-bugs mailing list
>> gmp-bugs@gmplib.org
>> https://gmplib.org/mailman/listinfo/gmp-bugs
>>
>>
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-07 Thread Niels Möller
"Gabriel Staples, ElectricRCAircraftGuy.com"  writes:

> In the answer , please jump
> halfway down, to the section titled "Explanation of the
> ${gcc_srcdir_RELATIVE}/configure relative path fix that works". I can
> neither explain it more nor less simply than that.

So actual error from your config.log is

  configure:27432: gcc -c -g -O2 -D__USE_MINGW_ACCESS -DNO_ASM 
-I/c/Users/gabriel/GS/dev/Microchip_XC32_Compiler/xc32-v4.35-src/pic32m-build/opt/include
 -imacros host-defs.h conftest.c >&5
  conftest.c:80:10: fatal error: 
/c/Users/gabriel/GS/dev/Microchip_XC32_Compiler/xc32-v4.35-src/pic32m-source/gcc/gmp/gmp-h.in:
 No such file or directory
 80 | #include 
"/c/Users/gabriel/GS/dev/Microchip_XC32_Compiler/xc32-v4.35-src/pic32m-source/gcc/gmp/gmp-h.in"
|

^~~~
  compilation terminated.

And that is from running gmp's configure script, not the configure
script of one of the other components your building? That looks rather
strange to me:

(1) I'm not used to autoconf putting absolute file names in #include
lines in conftest.c. At least, I have never noticed it doing that.

(2) It makes no sense for any C code, in conftest.c or otherwise, to
ever attempt to include gmp-h.in. That's not a valid C header file,
since it lacks the substitutions that turns it into a valid gmp.h
header file.

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-06 Thread Niels Möller
"Gabriel Staples, ElectricRCAircraftGuy.com"  writes:

> Thanks, Niels. I had been looking in config.log and came across a failure
> to include a file with an absolute path. I found the solution and wrote
> about it here: https://stackoverflow.com/a/77435216/4561887

I've had a quick look, but really too long for me to read carefully. And
please avoid calling other peoples work ugly things like "stinky". If
needed, please calm down before posting stuff.

Can you explain concisely in which way absolute include paths made gmp
configure break in your environment? It's not clear to me why gmp's
configure would ever attempt to compile anything with an #include
"/c/foo/bar.h" in it.

To me, use of absolute paths on the #include line seems rather obscure,
I'd expect relative paths, and compiler -I flags (often with absolute
paths) pointing to location of relevant include directories.

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: `checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source

2023-11-03 Thread Niels Möller
When debugging configure issues, the first step is to check config.log. That 
should tell you in detail what configure tried to compile or run, and how it 
failed.

Regards,
/Niels

"Gabriel Staples, ElectricRCAircraftGuy.com"  skrev: (3 
november 2023 08:26:03 CET)
>I could really use some help here. Many thanks in advance. I don't know if
>this is a GMP problem exactly, but I've described it pretty thoroughly
>here:
>
>GMP gets stuck in the configure process. Again, this may not be directly
>due to GMP, but this is a community effort to compile the GCC Microchip
>PIC32 compiler from source so we don't need to buy a license to program a
>chip.
>
>`checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t
>doesn't seem to work` when compiling the Microchip XC32 compiler from
>source  
>
>Sincerely,
>
>Gabriel Staples
>___
>gmp-bugs mailing list
>gmp-bugs@gmplib.org
>https://gmplib.org/mailman/listinfo/gmp-bugs
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs