Re: Problem building free.c with musl libc

2024-07-10 Thread Reuben Thomas
On Wed, 10 Jul 2024 at 02:58, Bruno Haible  wrote:

>
> Since you did not give a "How to reproduce" recipe, I am forced to do
> guesswork. Building the 'free' module on Alpine Linux works fine, for
> years already.
>

Do feel free to simply ask for more information! I do not want to spend
time unnecessarily getting more detailed reproduction information when a
problem is obvious to the maintainers, but of course I am happy to spend
that time when it's not obvious.

The next error
>
> ../config.h:1375:9: warning: "free" redefined
>  1375 | #define free GC_free
>   | ^~~~
>
> looks like the package is doing something weird w.r.t. Boehm GC.
>

Bingo, I assumed incorrectly that the reporter was building from git, where
I've removed the use of libgc, but it seems not.

Sorry for wasting your time, I should have read the full build log myself.

-- 
https://rrt.sc3d.org


RE: lib/fnmatch.c: mistakes `char32_t` rather than `wchar_t` on Windows

2024-07-10 Thread YX Hao
Hi Bruno and team,

I don't use it in any other places, but only wget.
Let's see the CI logs on GitHub. Requires login. I see you have an account.

It uses MSYS2 + Mingw-w64 on Windows.
Gnulib on commit d15237a2, but ` fnmatch.c` is the same as the latest.

You can see `fnmatch.c` adopted the `u32_` leading functions from
https://github.com/lifenjoiner/wget-for-windows/actions/runs/9866603799/job/27245614495#step:12:102
```
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
 ../lib/libgnu.a(fnmatch.o):fnmatch.c:(.text+0x240): undefined reference to 
`u32_strlen'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
 ../lib/libgnu.a(fnmatch.o):fnmatch.c:(.text+0x3fa): undefined reference to 
`u32_pcpy'
```

`_GL_SMALL_WCHAR_T` is defined to be 1 from `lib/uchar.in.h`.
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/uchar.in.h;h=166cbeccf8d5a0a667d4dddf49b778c89c14397d;hb=HEAD#l134
```
 132 /* Define if a 'char32_t' can hold more characters than a 'wchar_t'.  */
 133 #if @SMALL_WCHAR_T@/* 32-bit AIX, Cygwin, native 
Windows */
 134 # define _GL_SMALL_WCHAR_T 1
 135 #endif
```

And, we can confirm that `SMALL_WCHAR_T='1'` is in the `config.log` from
https://github.com/lifenjoiner/wget-for-windows/actions/runs/9866603799/artifacts/1684599456

Go upstream further:
In `m4/uchar_h.m4`
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=m4/uchar_h.m4;h=bb8801b164d66ba64eb65d58a5eb277196f2077b;hb=HEAD#l87
```
  85   dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'.
  86   gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES])
  87   if test $BITSIZEOF_WCHAR_T -lt 32; then
  88 SMALL_WCHAR_T=1
  89   else
  90 SMALL_WCHAR_T=0
  91   fi
  92   dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native 
Windows.
  93   AC_SUBST([SMALL_WCHAR_T])
```

Now, we can say:
1. `_GL_SMALL_WCHAR_T` means being/using `wchar_t`, not `wchar_t` is too small.
2. `wchar_t` should be used for Windows.
3. `!_GL_SMALL_WCHAR_T` is false for Windows, and is a mistake.


BTW:
There is another error that `c32*.c` files are newly included, but `uc_is_*` 
functions are not.
I haven't figured out how it happens, but very likely there is something wrong.
https://github.com/lifenjoiner/wget-for-windows/actions/runs/9866603799/job/27245614495#step:12:108
```
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
 ../lib/libgnu.a(libgnu_a-c32isalnum.o):c32isalnum.c:(.text+0x2c): undefined 
reference to `uc_is_alnum'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
 ../lib/libgnu.a(libgnu_a-c32isalpha.o):c32isalpha.c:(.text+0x2c): undefined 
reference to `uc_is_alpha'
```

Best Regards,
YX Hao





RE: lib/fnmatch.c: mistakes `char32_t` rather than `wchar_t` on Windows

2024-07-10 Thread YX Hao
Hi,

> `c32*.c` files are newly included, but `uc_is_*` functions are not
The 2nd error also has gone with a newer gnulib commit 92cdf62b,
which is merged from the head of wget, using a hack of:
```
sed -i "s/!_GL_SMALL_WCHAR_T/defined _GL_SMALL_WCHAR_T/" lib/fnmatch.c
```
https://github.com/lifenjoiner/wget-for-windows/actions/runs/9875390451

Best Regards,
YX Hao




Re: lib/fnmatch.c: mistakes `char32_t` rather than `wchar_t` on Windows

2024-07-10 Thread Bruno Haible
YX Hao wrote:
> C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
>  ../lib/libgnu.a(fnmatch.o):fnmatch.c:(.text+0x240): undefined reference to 
> `u32_strlen'
> C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
>  ../lib/libgnu.a(fnmatch.o):fnmatch.c:(.text+0x3fa): undefined reference to 
> `u32_pcpy'

The dependencies to these modules (unistr/u32-strlen and unistr/u32-pcpy)
are declared in modules/fnmatch, as well as the link requirements:

  Link:
  $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
  $(MBRTOWC_LIB)

Could it be that
  (a) the gnulib-tool invocation of wget uses --avoid to prevent inclusion
  of some modules?
or
  (b) the gnulib-tool invocation of wget uses the libunistring-optional
  modules, AND you have a libunistring installed in your build environment,
  AND the link command line of said program lacks $(LIBUNISTRING) or
  $(LTLIBUNISTRING) ?

> C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
>  ../lib/libgnu.a(libgnu_a-c32isalnum.o):c32isalnum.c:(.text+0x2c): undefined 
> reference to `uc_is_alnum'
> C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.1.0/../../../../i686-w64-mingw32/bin/ld.exe:
>  ../lib/libgnu.a(libgnu_a-c32isalpha.o):c32isalpha.c:(.text+0x2c): undefined 
> reference to `uc_is_alpha'

Likewise.

Bruno