We're updating the issue view to help you get more done. 

'GetUserDefaultLocaleName was not declared' and 'invalid conversion from size_t' errors for mingw-w64 builds on Windows

Description

Hi, everyone,

For ICU 59RC builds using mingw-w64 on Windows got error:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 sh-4.4$ (INSTALLDIR="$PWD/../../GCC64RH" && (./configure --prefix="$INSTALLDIR" --disable-debug --enable-release --enable-shared --disable-static >_configure.log && make >_make.log && make install >_install.log) 2>_stderr.log) sh-4.4$ make [snip] make[1]: Entering directory '/c/libICU-59RC/build/source/common' g++ -DHAVE_DLOPEN=0 -DU_HAVE_ATOMIC=1 -DU_HAVE_MMAP=0 -DU_HAVE_STRTOD_L=0 -I. "-DDEFAULT_ICU_PLUGINS=\"/c/libICU-59RC/build/source/../../GCC64RH/lib/icu\" " -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++11 -mthreads -c -DPIC -o putil.o putil.cpp In file included from putil.cpp:54:0: [snip] putil.cpp:1731:86: error: 'GetUserDefaultLocaleName' was not declared in this scope int length = GetUserDefaultLocaleName(windowsLocale, UPRV_LENGTHOF(windowsLocale)); ^ [snip] make[1]: *** [../config/mh-mingw64:114: putil.o] Error 1 make[1]: Leaving directory '/c/libICU-59RC/build/source/common' make: *** [Makefile:147: all-recursive] Error 2

To bypass it added key

1 -DWINVER=0x601

to build command, run build again and got next error:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 sh-4.4$ (INSTALLDIR="$PWD/../../GCC64RH" && (CFLAGS="-DWINVER=0x0601" CXXFLAGS="-DWINVER=0x0601" ./configure --prefix="$INSTALLDIR" --disable-debug --enable-release --enable-shared --disable-static >_configure.log && make >_make.log && make install >_install.log) 2>_stderr.log) sh-4.4$ make [snip] make[0]: Making `all' in `io' make[1]: Entering directory '/c/libICU-59RC/build/source/io' g++ -DHAVE_DLOPEN=0 -DU_HAVE_ATOMIC=1 -DU_HAVE_MMAP=0 -DU_HAVE_STRTOD_L=0 -I. -I../common -I../i18n -DU_ATTRIBUTE_DEPRECATED= -DU_IO_IMPLEMENTATION -DWINVER=0x0601 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -std=c++11 -mthreads -c -DPIC -o ufile.o ufile.cpp ufile.cpp: In function 'UFILE* u_fopen_u_59(const UChar*, const char*, const char*, const char*)': ufile.cpp:163:51: error: invalid conversion from 'const char*' to 'size_t {aka long long unsigned int}' [-fpermissive] mbstowcs_s(&retVal, wperm, perm, _TRUNCATE); ^ ufile.cpp:163:51: error: invalid conversion from 'size_t {aka long long unsigned int}' to 'const char*' [-fpermissive] ufile.cpp:163:51: error: too few arguments to function 'errno_t mbstowcs_s(size_t*, wchar_t*, size_t, const char*, size_t)' In file included from C:/ProgramData/Mingw64/x86_64-w64-mingw32/include/stdlib.h:694:0, from C:/ProgramData/Mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/cstdlib:75, from C:/ProgramData/Mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/stdlib.h:36, from ufile.cpp:36: C:/ProgramData/Mingw64/x86_64-w64-mingw32/include/sec_api/stdlib_s.h:23:27: note: declared here _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); ^~~~~~~~~~ make[1]: *** [../config/mh-mingw64:114: ufile.o] Error 1 make[1]: Leaving directory '/c/libICU-59RC/build/source/io' make: *** [Makefile:147: all-recursive] Error 2

Not reproduced for ICU 58.2 since it doesn't contain such code.

Environment:

  • Windows 10 x64,

  • mingw-w64 6.3.0,

  • MSYS2 20161025.

The 1st error relate to mingw-w64 and there is an appropriate ticket on mingw-w64 bug-tracker. Though since ICU Users will encounter this problem, it probably make sense to add

1 -DWINVER=0x601

key to variables

1 CFLAGS

and

1 CPPFLAGS

in file

1 ICU/source/config/mh-mingw64

(similar to MESA implementation).

As for 2nd error still looking a solution fix or bypass it.

Alexander

Status

Assignee

Jeff Genovy

Reporter

TracBot

Labels

Components

Fix versions

Priority

medium