Closed mathias-freire closed 3 years ago
Did you do a clean rebuild from scratch, or build in the same directory where you've built it with gcc before?
In gettext-0.19.8.1/gettext-runtime/config.log you should see that configure did test for the newlocale function. In my test it doesn't exist, and thus all of these errors do go away.
However when I tried building without --disable-shared, I'm getting errors in building libasprintf.la, errors that stem from a known issue with libtool, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866. Packages that contain prebuilt libtool versions, that link to C++ libraries, need to have the bundled libtool files updated, otherwise it fails to pick up some files for compiler builtins.
I'm regularly building VLC, which contains a bundled copy of gettext (built with a specific set of flags, including --disable-shared), which builds fine with this toolchain.
Or put another way: Can you give exact instructions for how to reproduce this error?
I'm doing clean build. First, I used patches from mingw distro, no results. Second I tried to build vanilla gettext, and still got error. I am using mingw32 console (which has no gcc installed in) and using these arguments:
LDFLAGS="-Wl,//force" CC=$MHOST-clang CXX=$MHOST-clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib ./configure --prefix=$PREF --build=$MHOST --enable-static --enable-shared --disable-java --disable-native-java --disable-csharp --enable-threads=win32 --enable-relocatable --without-emacs --disable-openmp --without-cvs --without-git --with-included-libcroco --with-included-libunistring --with-included-libxml --with-included-glib --disable-acl --disable-curses
Using "force" flag, because I got multiple definition error many times ago. Btw, I'm using latest svn revision of clang and mingw.
In gettext-0.19.8.1\gettext-runtime\intl\libgnuintl.h header file, I added this line:
#define locale_t _locale_t
And locale_t errors disappeared. But now, I get new error:
`_LIBRARY -DINSTALLDIR=\"/d/minpref/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -I. -I. -I.. -O2 -I/d/minpref/include -fvisibility=hidden ./explodename.c -DDLL_EXPORT -DPIC -o .libs/explodename.o ./localealias.c:31:11: fatal error: 'stdio_ext.h' file not found
`
And this file is part of Posix and not in Mingw.
Ok, I get it. Everything roots from this: LDFLAGS="-Wl,//force"
But I couldn't find an argument that surpasses multiple definition errors for lld. Any advice?
use -z muldefs
Using "force" flag, because I got multiple definition error many times ago.
So this is the original culprit, as you noted yourself. Don't globally add such options that change behaviour so drastically.
If you have another case where something fails due to multiple definitions, where it shouldn't, please file a bug and I can try to have a look, so we can fix the root cause instead of triggering new errors elsewhere.
As for the rest of the libtool build, I'm looking into it, but running into other issues, I'll keep you posted. As part of VLC dependencies, I've been building gettext with this toolchain for quite some time though - I'm trying to see what's different when gettext is built as part of the VLC dependencies.
use -z muldefs
LLD (when targeting mingw/coff) doesn't support this flag. It could potentially be added (forwarding to the lld-link flag /force:multiple
) though.
LDFLAGS="-Wl,//force"
FWIW, this is a pretty creative way of passing lld-link style flags through the lld mingw frontend. There's an official way of doing that though, -Wl,-Xlink=-force
(lld-link accepts both slashes and dashes for options), or in this case, -Wl,-Xlink=-force:multiple
.
CC=$MHOST-clang CXX=$MHOST-clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib
FWIW also, this shouldn't be necessary (although my scripts did that), the toolchain contains all necessary wrappers in the form $HOST-$tool
, and there's also wrappers named $HOST-gcc
which actually does call clang. So in practice, just doing ./configure --host=$HOST
is enough. And for non-cross builds, there's also prefixless wrappers for all of the same tools.
Hmm im somewhat stumped, i can build gettext just fine with clang on windows ?!? :-S
If you still into errors i can upload packages with the clang compiled gettext for windows 32 and 64 bit. I also have the corresponding libiconv packages.
Atm the only source im having real trouble building is libffi. It does build when using 32 bit clang but i get an assembler error on the 64 bit package ( this is known but a fix has yet to come ). Unfortuantly this means i can forget about compiling python with clang for the moment.
I managed to build gettext as static, by using /force:multiple flag. But as shared, I get error again:
libtool: link: (cd .libs/libgettextlib.lax/libcroco_rpl.a && llvm-ar x "/d/ffbuild/gettext-0.19.8.1/gettext-tools/gnulib-lib/./.libs/libcroco_rpl.a")
libtool: link: (cd .libs/libgettextlib.lax/libglib_rpl.a && llvm-ar x "/d/ffbuild/gettext-0.19.8.1/gettext-tools/gnulib-lib/./.libs/libglib_rpl.a")
libtool: link: (cd .libs/libgettextlib.lax/libxml_rpl.a && llvm-ar x "/d/ffbuild/gettext-0.19.8.1/gettext-tools/gnulib-lib/./.libs/libxml_rpl.a")
libtool: link: x86_64-w64-mingw32-clang++ -shared -nostdlib D:/mingw-llvm/x86_64-w64-mingw32/lib/dllcrt2.o D:/mingw-llvm/x86_64-w64-mingw32/lib/crtbegin.o .libs\\libgettextlib.la.lnkscript -L/d/minpref/lib ../intl/.libs/libintl.dll.a /d/minpref/lib/libiconv.a -LD:/mingw-llvm/x86_64-w64-mingw32/lib -LD:/mingw-llvm/lib -LD:/mingw-llvm/x86_64-w64-mingw32/sys-root/mingw/lib -lc++ -lmingw32 D:/mingw-llvm/lib/clang/10.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 D:/mingw-llvm/lib/clang/10.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt -O2 -Wl,--export-all-symbols -Wl,//force:multiple -o .libs/libgettextlib-0-19-8-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgettextlib.dll.a
lld-link: error: .libs\libgettextlib.la.lnkscript: unknown file type
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [Makefile:2869: libgettextlib.la] Error 1
make[5]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-tools/gnulib-lib'
make[4]: *** [Makefile:2619: all] Error 2
make[4]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-tools/gnulib-lib'
make[3]: *** [Makefile:2028: all-recursive] Error 1
make[3]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-tools'
make[2]: *** [Makefile:1894: all] Error 2
make[2]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-tools'
make[1]: *** [Makefile:413: all-recursive] Error 1
make[1]: Leaving directory '/d/ffbuild/gettext-0.19.8.1'
make: *** [Makefile:369: all] Error 2
P.S.: I have issues so much when building stuff with autotools as shared.
Atm the only source im having real trouble building is libffi. It does build when using 32 bit clang but i get an assembler error on the 64 bit package ( this is known but a fix has yet to come ). Unfortuantly this means i can forget about compiling python with clang for the moment.
I can build libffi as static, but not as shared. Clang has issues with building shared libs using autotools.
aye its libtool acting up with unknown command --build-script something :-S.
As for gettext i can build both the shared and static version, but mine might be a newer version than the one you were trying to build ?.
gettext version 0.19.8.1
oups saw its the same version now Oo well then im at a loss. I did patch it with the same patchset used by Msys2 MinGW64 but idont really see anything clang related in these patches so i doubt that is what is causing mine to build.
error: .libs\libgettextlib.la.lnkscript: unknown file type ah its libtool same problem as the linker script error i was getting with libffi. Now i remember i used Msys2 's mingw64 libtool which had a patch to get around some clang problems, but you need to run libtoolize on the source after installing it and then do an autoreconf -fi or just use the autogen.sh script. That got it building.
i think its these two patches for libtool you need -> 0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch and 0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch
first one enables libtool to find clangs runtime libraries, second one turns of linker scripts and uses response files instead.
still need to do a libtoolize --fi and autoreconf -fi i think, cant remember if gettexts autogen.sh script runs libtoolize.
Hmm im somewhat stumped, i can build gettext just fine with clang on windows ?!? :-S
I was battling a number of different issues, mostly by first trying to do a shared build, and when disabling that, it failed on issues with iconv.h, and after that, other issues due to me not cleaning up properly between attempts. (I was building in a clean crossroot without any other third party libraries - and even if gettext's configure runs one million checks, it can't tell me I can't build if I don't have iconv.h...)
I managed to build gettext as static, by using /force:multiple flag
What do you need to include that flag for? Some private code of yours that require building with it, or some other project that runs into issues? If it's some public project that shouldn't require it, but requires it if using llvm-mingw, then please file a bug about it. One shouldn't need to carry that flag around.
lld-link: error: .libs\libgettextlib.la.lnkscript: unknown file type
Yes, this is one of the issues with libtool, that is fixed by patches carried in msys2 libtool packages. I've tried to summarize these issues in https://github.com/mstorsjo/llvm-mingw/blob/master/README.md#known-issues.
The status in my env is now that I can build it statically fine (assuming I've built and installed libiconv before).
Building shared libs works, but needs a few fixups:
Building on windows (I didn't test this as I'm primarily cross compiling) can run into the issue with libtool trying to use a linker script for passing file name lists. Should be fixed by the patched libtool in msys2.
Building gettext-runtime/libasprintf fails due to missing ___chkstk_ms
and similar stuff, also requires a libtool patch (also in msys2). However the existing patches for libtool didn't turn out to be enough. I had primarily been testing these libtool things by building vlc, but vlc turned out to have another libtool workaround that does lt_cv_deplibs_check_method=pass_all
(with a comment "override platform specific check for dependent libraries otherwise libtool linking of shared libraries will fail on anything other than pass_all.") : http://git.videolan.org/?p=vlc.git;a=blob;f=configure.ac;h=4aef56f06e3d16c8fe378055155126943d7ed69#l526 It turns out that libtool, after actually finding the path to libclang_rt.builtins-<arch>.a
still will skip linking to it, because it sees that it's a static library, and libtool seems to refuse to link static libraries while producing a shared library as output: http://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n5900
A libtool patch like this seems to fix that issue:
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index b55a6e57..c1eebf4c 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3487,17 +3487,7 @@ cygwin*)
;;
mingw* | pw32*)
- # Base MSYS/MinGW do not provide the 'file' command needed by
- # func_win32_libid shell function, so use a weaker test based on 'objdump',
- # unless we find 'file', for example because we are cross-compiling.
- if ( file / ) >/dev/null 2>&1; then
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
- else
- # Keep this pattern in sync with the one in func_win32_libid.
- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- fi
+ lt_cv_deplibs_check_method=pass_all
;;
cegcc*)
I'll try to refine this patch and maybe try to send it to msys2 after that, and potentially report the issue to libtool (even if the existing patch hasn't made any progress whatsoever there).
../woe32dll/c++term-styled-ostream.lo
fails. Apparently this file isn't built at all in static builds. The reason is that gettext uses gnulib, to potentially replace missing system functions if necessary. Gnulib does contain and provide the isnan functions/macros (even if gettext doesn't use/need them.) Gnulib does a check for isnan/isnanf/isnanl, but when checking for isnanf
, if the compiler defines __GNUC__
(as clang does), it will test for __builtin_isnanf
instead (http://git.savannah.gnu.org/cgit/gnulib.git/tree/m4/isnanf.m4#n104). Clang does provide __builtin_isnan
but not __builtin_isnanf
or __builtin_isnanl
. As gnulib concluded isnanf doesn't exist/work, it then goes on to try to replace it, but then fails due to missing noexcept declarations in C++. To fix this, I manually hacked gettext-tools/gnulib-lib/math.h
after running into the build error.I'll see if this goes away if I'd implement __builtin_isnanf
and __builtin_isnanl
in clang.
It should just use msys2's file.exe if not found.
Remembered i use a workaround in my mingw64 installation though -> create a shell script and name it file then yank this in it.
'#!/bin/sh
############################################################################### #
#
# ###############################################################################
while $(echo "$1" | grep --silent '^-') do shift done
case "$1" in .exe) echo "MS Windows PE32 Intel 80386 console executable not relocatable" ;; # note: libtool doesn't match the "MS Windows PE 32-bit Intel" .dll) echo "MS Windows PE32 Intel 80386 console DLL" ;; # note: libtool doesn't match the "MS Windows PE 32-bit Intel" .dll.a) echo "ar archive import library" ;; # <-- import library for relocatable library .a | .lib) echo "ar archive" ;; # <-- could be static library or import library for relocatable library; libtool will use objdump to find out ) echo "pass_all" ;; esac' for 32 bit. and
'#!/bin/sh
############################################################################### #
#
# ###############################################################################
while $(echo "$1" | grep --silent '^-') do shift done
case "$1" in .exe) echo "MS Windows PE32+ Intel x86-64 console executable not relocatable" ;; # note: libtool doesn't match the "MS Windows PE 64-bit Intel" .dll) echo "MS Windows PE32+ Intel x86-64 console DLL" ;; # note: libtool doesn't match the "MS Windows PE 32-bit Intel" .dll.a) echo "ar archive import library" ;; # <-- import library for relocatable library .a | .lib) echo "ar archive" ;; # <-- could be static library or import library for relocatable library; libtool will use objdump to find out ) echo "pass_all" ;; esac'
for 64 bit.
Might still be edge cases where you have to do the lt_cv_deplibs_check_method=pass_all trick.
What do you need to include that flag for? Some private code of yours that require building with it, or some other project that runs into issues? If it's some public project that shouldn't require it, but requires it if using llvm-mingw, then please file a bug about it. One shouldn't need to carry that flag around.
Gettext fails with llvm-mingw because of multiple definiton of some symbol in different libs. So I used it.
i think its these two patches for libtool you need -> 0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch and 0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch
first one enables libtool to find clangs runtime libraries, second one turns of linker scripts and uses response files instead.
still need to do a libtoolize --fi and autoreconf -fi i think, cant remember if gettexts autogen.sh script runs libtoolize.
I tried it and still got error.
Gettext fails with llvm-mingw because of multiple definiton of some symbol in different libs. So I used it.
It's impossible for any of us to help you with such vague statements. Please quote error messages and symbol names to make it possible to say anything about it.
It should just use msys2's file.exe if not found.
Can you clarify which part you're referring to here? Do you mean the case where I have to set lt_cv_deplibs_check_method=pass_all? What issue does your file shell script work around? It does not fix the issue I'm looking into.
Libtool keeps a list of dependencies that it needs to link for C++ targets, e.g. like this:
postdeps="-lc++ -lmingw32 C:/code/llvm-mingw/lib/clang/9.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 C:/code/llvm-mingw/lib/clang/9.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt"
Now before it actually uses these, it iterates over all of them and checks what they are: http://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n5711 For paths that point directly to a static library, http://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n5866, it tries to inspect them to see if it's an import library, or a normal static library. If it's valid, it adds it to the list of libraries actually used, http://git.savannah.gnu.org/cgit/libtool.git/tree/build-aux/ltmain.in#n5896, but for the case of libclang_rt.builtins-x86_64.a, it just prints the warning below ("I have the capability to make that library automatically link in when you link to this library. But I can only do this if you have a shared version of the library, which you do not appear to have because the file extensions .$libext of this argument makes me believe that it is just a static archive that I should not use here."). So therefore libtool just decides to skip using libclang_rt.builtins-x86_64.a.
Aye thats the part.
My file shell script just automates what you do with exporting lt_cv_deplibs_check_method=pass_all since windows libraries generally dont care if linked to static or shared versions ( certainly no such magic in msvc ). Just drop the corresponding file shell script in the bin folder and use the name -> file not file.sh, this should take care of having to export lt_cv_deplibs_check_method=pass_all.
file.exe can be built on mingw64 though but is generally not usable by libtool because msys2 converts the output of the mingw executables to windows paths which libtool does not understand.
@mathias, could you provide a list of symbols that it thinks are multiple defined ?, i do not get any of those problems so im a bit curious.
My file shell script just automates what you do with exporting lt_cv_deplibs_check_method=pass_all since windows libraries generally dont care if linked to static or shared versions ( certainly no such magic in msvc ). Just drop the corresponding file shell script in the bin folder and use the name -> file not file.sh, this should take care of having to export lt_cv_deplibs_check_method=pass_all.
I can see the intent of that, but it doesn't seem to achieve that for me.
As your replacement for "file" is given a .a path name (to libclang_rt.builtins-
Also, the catch-all part of file, printing "pass_all", is something I don't really understand either. As func_win32_libid calls "file", it won't end up using the "pass_all" value in win32_fileres to actually skip any check - it'll just make func_win32_libid print unknown, which doesn't match the given regex pattern of ^x86 archive import|^x86 DLL
Hmm odd that, it works here ?!?. Though you could also just place the lt_cv_deplibs_check_method=pass_all in a config.site placed in llvm-mingw/etc if compiling in Msys2 and you would get the same behaviour.
The file script was originally from mingw.org before many of the fixes to libtool that improved windows compatibility, and did not include the x86_64 path which i added.
Hmm odd that, it works here ?!?.
That's indeed weird.
FWIW, doing things locally in msys2 doesn't help much for me, as I primarily cross compile.
As a smaller testcase than the whole mess that is gettext, I've tested building another project of mine: https://github.com/mstorsjo/fdk-aac
Normally this project links as C (even though the code is C++), but to trigger this libtool issue, comment out lines 19-22 here: https://github.com/mstorsjo/fdk-aac/blob/master/Makefile.am#L19-L22 Then regenerate with ./autogen.sh
, and try building. Does that work for you, or do you end up with undefined references to __chkstk_ms
?
In any case, I've tried to take up this issue for discussion in the upstream bug tracker at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866, but unsure how much of a reply I'll get. If I don't get any reply in some time, I'll suggest a patch to msys2's libtool to just hardcode lt_cv_deplibs_check_method=pass_all
for mingw, as I'm not really sure what it's supposed to protect against.
Oh im doing most work in Msys2 besides building llvm-mingw itself in win10's ubuntu wsl. Only difference between my version of llvm-mingw is my version defaults the msvcrt runtime to msvcrt and not ucrt like yours. Not sure either why libtool was not defaulted to this over the years, but i suspect it has something todo with portability ( it even warns about this ). But tbh i newer had any problems on windows in regards to that since i newer seen a library on windows that actually linked directly to a module.
Im going to try your test case in the wsl to see if it also goes bonkers here. Might not be able to answer before tomorrow though as i need some sleep :)
Not sure either why libtool was not defaulted to this over the years, but i suspect it has something todo with portability ( it even warns about this )
Yes, I've seen that text, but it wasn't really clear to me what aspect of portability that is at risk by linking to a static library...
Im going to try your test case in the wsl to see if it also goes bonkers here.
Please try on msys2 with your file hack as well, as I'm interested to see if it really helps, as it seems to me it doesn't.
Well this is weird, the older llvm-mingw 8 builds gettext with no problem with my file hack but version 9 gives me this error ->
wtf :-S.
Looks like a recent change to the mingw-w64 crt is the problem since i also just ran into the lld-link: error: undefined symbol: ___chkstk_ms while building cppunit. The old version 8 build compiles this one just fine but with the latest build i get errors like the above.
For you asked, this is what I get:
libtool: link: x86_64-w64-mingw32-clang -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -o gettext.exe gettext-gettext.o gettext.res ../gnulib-lib/libgrt.a ../intl/.libs/libintl.a -L/d/minpref/lib /d/minpref/lib/libiconv.a
libtool: link: x86_64-w64-mingw32-clang -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -o envsubst.exe envsubst-envsubst.o gettext.res ../gnulib-lib/libgrt.a ../intl/.libs/libintl.a -L/d/minpref/lib /d/minpref/lib/libiconv.a
libtool: link: x86_64-w64-mingw32-clang -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -o ngettext.exe ngettext-ngettext.o gettext.res ../gnulib-lib/libgrt.a ../intl/.libs/libintl.a -L/d/minpref/lib /d/minpref/lib/libiconv.a
lld-link: error: duplicate symbol: canonicalize_file_name in libintl.a(canonicalize.o) and in libgrt.a(canonicalize-lgpl.o)
lld-link: error: duplicate symbol: canonicalize_file_name in libintl.a(canonicalize.o) and in libgrt.a(canonicalize-lgpl.o)
lld-link: error: duplicate symbol: canonicalize_file_name in libintl.a(canonicalize.o) and in libgrt.a(canonicalize-lgpl.o)
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [Makefile:1361: envsubst.exe] Error 1
make[4]: *** Bitmemiş işler için bekliyor....
make[4]: *** [Makefile:1365: gettext.exe] Error 1
make[4]: *** [Makefile:1369: ngettext.exe] Error 1
make[4]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-runtime/src'
make[3]: *** [Makefile:1365: all-recursive] Error 1
make[3]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-runtime'
make[2]: *** [Makefile:1270: all] Error 2
make[2]: Leaving directory '/d/ffbuild/gettext-0.19.8.1/gettext-runtime'
make[1]: *** [Makefile:413: all-recursive] Error 1
make[1]: Leaving directory '/d/ffbuild/gettext-0.19.8.1'
make: *** [Makefile:369: all] Error 2
I patched libtool with patches you mentioned, Libtoolized and autoreconf'ed gettext, used this arguments to build shared and I still got error:
CC=$MHOST-clang CXX=$MHOST-clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib ./configure --prefix=$PREF --build=$MHOST --enable-static --enable-shared --disable-java --disable-native-java --disable-csharp --enable-threads=win32 --enable-relocatable --without-emacs --disable-openmp --without-cvs --without-git --with-included-libcroco --with-included-libunistring --with-included-libxml --with-included-glib --disable-acl --disable-curses
And the error is (this is new, different from above):
x86_64-w64-mingw32-clang -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/d/minpref/lib/gettext\" -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -c -o msgmerge-msgl-fsearch.o `test -f 'msgl-fsearch.c' || echo './'`msgl-fsearch.c
x86_64-w64-mingw32-clang -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/d/minpref/lib/gettext\" -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -c -o msgmerge-lang-table.o `test -f 'lang-table.c' || echo './'`lang-table.c
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:55:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:84:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:138:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:133:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:55:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:84:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:145:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:143:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:55:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:84:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:152:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:144:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:55:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:84:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:166:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\wchar.h:1445:47: note: previous definition is here
__CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *_S,wchar_t _C,size_t _N) {
~~~~~~~~~ ^
x86_64-w64-mingw32-clang -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/d/minpref/lib/gettext\" -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -c -o msgmerge-plural-count.o `test -f 'plural-count.c' || echo './'`plural-count.c
x86_64-w64-mingw32-clang -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/d/minpref/lib/gettext\" -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -c -o msgunfmt-msgunfmt.o `test -f 'msgunfmt.c' || echo './'`msgunfmt.c
x86_64-w64-mingw32-clang -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/d/minpref/lib/gettext\" -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -c -o msgunfmt-read-mo.o `test -f 'read-mo.c' || echo './'`read-mo.c
x86_64-w64-mingw32-clang -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DUSEJEXE=0 -DGETTEXTJEXEDIR=\"/d/minpref/lib/gettext\" -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -O2 -I/d/minpref/include -c -o msgunfmt-read-java.o `test -f 'read-java.c' || echo './'`read-java.c
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:59:
In file included from ../libgrep\glthread/lock.h:619:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\windows.h:69:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\windef.h:8:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\minwindef.h:163:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\winnt.h:1554:
In file included from D:\mingw-llvm\lib\clang\10.0.0\include\x86intrin.h:15:
In file included from D:\mingw-llvm\lib\clang\10.0.0\include\immintrin.h:14:
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:67:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:129:43: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:159:43: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:189:43: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:216:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:239:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:260:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:287:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:310:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:331:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:352:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:373:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:394:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:416:41: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:439:41: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Well this is weird, the older llvm-mingw 8 builds gettext with no problem with my file hack but version 9 gives me this error ->
In file included from ../../../gettext-0.19.8.1/gettext-tools/gnulib-lib/../woe32dll/c++html-styled-ostream.cc:1: In file included from html-styled-ostream.oo.c:21: In file included from html-styled-ostream.oo.h:21: In file included from styled-ostream.oo.h:21: In file included from ostream.oo.h:24: In file included from ../../../gettext-0.19.8.1/gettext-tools/gnulib-lib/moo.h:217: In file included from .\stdlib.h:36: In file included from C:\Msys64\clang64\include\c++\v1\stdlib.h💯 In file included from .\math.h:27: In file included from C:\Msys64\clang64\include\c++\v1\math.h:311: In file included from C:\Msys64\clang64\include\c++\v1\type_traits:417: In file included from C:\Msys64\clang64\include\c++\v1\cstddef:37: ../intl\version:1:1: error: unknown type name 'GNU' GNU gettext library from gettext-0.19.8.1 ^ ../intl\version:1:12: error: expected ';' after top level declarator GNU gettext library from gettext-0.19.8.1 ^ In file included from ../../../gettext-0.19.8.1/gettext-tools/gnulib-lib/../woe32dll/c++html-styled-ostream.cc:1: In file included from html-styled-ostream.oo.c:38: In file included from ../../../gettext-0.19.8.1/gettext-tools/gnulib-lib/gettext.h:25: ../intl\libintl.h:126:21: error: redefinition of 'gettext' as different kind of symbol static inline char gettext (const char __msgid) ^ ../intl\version:1:5: note: previous definition is here GNU gettext library from gettext-0.19.8.1 ^ 3 errors generated. make[5]: *** [Makefile:3180: ../woe32dll/c++html-styled-ostream.lo] Error 1
wtf :-S.
Delete the file gettext-0.19.8.1\gettext-tools\intl\VERSION and continue
So here we are:
libtool: link: x86_64-w64-mingw32-clang++ -shared -nostdlib D:/mingw-llvm/x86_64-w64-mingw32/lib/dllcrt2.o D:/mingw-llvm/x86_64-w64-mingw32/lib/crtbegin.o .libs/xsize.o .libs/lib-asprintf.o .libs/autosprintf.o .libs/libasprintf.res.o -lc++ -LD:/mingw-llvm/x86_64-w64-mingw32/lib -LD:/mingw-llvm/lib -LD:/mingw-llvm/x86_64-w64-mingw32/sys-root/mingw/lib -lc++ -lmingw32 -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lmoldname -lmingwex -lmsvcrt -O2 -Wl,//force:multiple -o .libs/libasprintf-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libasprintf.dll.a
lld-link: error: undefined symbol: ___chkstk_ms
>>> referenced by .libs/lib-asprintf.o:(vasnprintf)
>>> referenced by libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):(_pei386_runtime_relocator)
>>> referenced by libmingwex.a(lib64_libmingwex_a-strtold.o):(__asctoe64)
>>> referenced by libc++.a(cxa_demangle.cpp.obj):(__cxa_demangle)
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
libtool: link: x86_64-w64-mingw32-clang -shared .libs/xsize.o .libs/lib-asprintf.o .libs/autosprintf.o .libs/libasprintf.res.o -lc++ -O2 -Wl,//force:multiple -o .libs/libasprintf-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libasprintf.dll.a
lld-link: error: undefined symbol: ___chkstk_ms
>>> referenced by .libs/clean-temp.o:(create_temp_dir)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_mono)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_mono)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_mono)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_mono)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_mono)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_sscli)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_sscli)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_sscli)
>>> referenced by .libs/csharpcomp.o:(compile_csharp_using_sscli)
>>> referenced 41 more times
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks for sharing the details of the issues!
lld-link: error: duplicate symbol: canonicalize_file_name in libintl.a(canonicalize.o) and in libgrt.a(canonicalize-lgpl.o)
Ok, this does sound like a genuine issue, but I don't see where it would stem from. I do find canonicalize_file_name in canonicalize-lgpl.o in libgrt.a, but there's no canonicalize.o anywhere in my gettext 0.19.8.1 build tree. Where does that come from in your build?
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:138:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:133:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
^
This one looks unrelated to gettext itself, it looks like some issue in your setup of libcxx. If you're seeing this issue, I believe you would get the same error if you'd just create a new empty .cpp file and add #include <wchar.h>
in it and try to compile it.
It seems to me (with current libcxx from a few days ago) that this only would happen if something defines _LIBCPP_PREFERRED_OVERLOAD
. If it isn't defined, libcxx's __config
should define it by default to __attribute__ ((__enable_if__(true, "")))
which makes the issue disappear.
D:\mingw-llvm\lib\clang\10.0.0\include\mmintrin.h:67:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
This error looks like you have a mismatch between the clang headers (in
lld-link: error: undefined symbol: ___chkstk_ms
>>> referenced by .libs/lib-asprintf.o:(vasnprintf)
These are the same issue as I've been discussing with @revelator and that I'm discussing upstream with libtool. For now, either edit libtool.m4 (in your systemwide libtool installation) or the generated configure scripts and add this change:
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index b55a6e57..c1eebf4c 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3487,17 +3487,7 @@ cygwin*)
;;
mingw* | pw32*)
- # Base MSYS/MinGW do not provide the 'file' command needed by
- # func_win32_libid shell function, so use a weaker test based on 'objdump',
- # unless we find 'file', for example because we are cross-compiling.
- if ( file / ) >/dev/null 2>&1; then
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
- else
- # Keep this pattern in sync with the one in func_win32_libid.
- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- fi
+ lt_cv_deplibs_check_method=pass_all
;;
cegcc*)
Or after configuring, edit the autogenerated libtool
scripts and change deplibs_check_method="file_magic ^x86 archive import|^x86 DLL"
into deplibs_check_method=pass_all
.
Delete the file gettext-0.19.8.1\gettext-tools\intl\VERSION and continue
Thanks :), was this ignored in previous builds since it suddenly creeps up in clang 9 ?.
I used the patch on gettext 0.20.1 and tried to build it with clang 9 rc2 and still got the error again:
x86_64-w64-mingw32-clang++ -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DEXEEXT=\".exe\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -D__STDC_LIMIT_MACROS -O2 -I/d/minpref/include -std=c++14 -c -o ../woe32dll/msgmerge-c++msgmerge.o `test -f '../woe32dll/c++msgmerge.cc' || echo './'`../woe32dll/c++msgmerge.cc
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:55:
In file included from ../gnulib-lib\xmalloca.h:21:
In file included from ../gnulib-lib/malloca.h:26:
../gnulib-lib/xalloc-oversized.h:57:10: warning: 'xalloc_oversized' macro redefined [-Wmacro-redefined]
# define xalloc_oversized(n, s) __xalloc_oversized (n, s)
^
../gnulib-lib\xalloc.h:149:10: note: previous definition is here
# define xalloc_oversized(n, s) \
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:59:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:87:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:138:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:133:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:59:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:87:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:145:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:143:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:59:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:87:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:152:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:144:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:59:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:87:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:159:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\string.h:146:34: note: previous declaration is here
_CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr);
^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:59:
In file included from ./po-charset.h:25:
In file included from ../gnulib-lib\iconv.h:27:
In file included from D:/minpref/include\iconv.h:110:
In file included from ../gnulib-lib\wchar.h:87:
D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h:166:16: error: functions that differ only in their return type cannot be overloaded
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
~~~~~~~~ ^
D:\mingw-llvm\x86_64-w64-mingw32\include\wchar.h:1445:47: note: previous definition is here
__CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *_S,wchar_t _C,size_t _N) {
~~~~~~~~~ ^
In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:63:
In file included from ../libgrep\glthread/lock.h:680:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\windows.h:69:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\windef.h:8:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\minwindef.h:163:
In file included from D:\mingw-llvm\x86_64-w64-mingw32\include\winnt.h:1554:
In file included from D:\mingw-llvm\lib\clang\9.0.0\include\x86intrin.h:15:
In file included from D:\mingw-llvm\lib\clang\9.0.0\include\immintrin.h:14:
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:67:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:129:43: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:159:43: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:189:43: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:216:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:239:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:260:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:287:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:310:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:331:44: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:352:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:373:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type '__v4hi' (aka 'short')
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:394:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~
D:\mingw-llvm\lib\clang\9.0.0\include\mmintrin.h:416:41: error: cannot initialize a parameter of type '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type '__v8qi' (aka 'char')
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make[5]: *** [Makefile:3694: ../woe32dll/msgmerge-c++msgmerge.o] Error 1
make[5]: Leaving directory '/d/ffbuild/gettext-0.20.1/gettext-tools/src'
make[4]: *** [Makefile:2731: all] Error 2
make[4]: Leaving directory '/d/ffbuild/gettext-0.20.1/gettext-tools/src'
make[3]: *** [Makefile:2172: all-recursive] Error 1
make[3]: Leaving directory '/d/ffbuild/gettext-0.20.1/gettext-tools'
make[2]: *** [Makefile:2040: all] Error 2
make[2]: Leaving directory '/d/ffbuild/gettext-0.20.1/gettext-tools'
make[1]: *** [Makefile:404: all-recursive] Error 1
make[1]: Leaving directory '/d/ffbuild/gettext-0.20.1'
make: *** [Makefile:360: all] Error 2
How am I supposed to fix this?
I am also seing this now, in several packages that built on the previous clang versions. Lots of C++ errors especially on overloaded class members. Im not sure if this is caused by some changes to the mingw-w64 runtimes or if it is clangs stdlib acting up.
Can you rerun the compilation command that fails, but remove the -c
and -o
options, and replace them with -E -dD -o preproc.i
and post that file? That'll hopefully contain a lot of explanations.
Can you rerun the compilation command that fails, but remove the
-c
and-o
options, and replace them with-E -dD -o preproc.i
and post that file? That'll hopefully contain a lot of explanations.
x86_64-w64-mingw32-clang++ -DLOCALEDIR=\"/d/minpref/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/d/minpref/share/locale\" -DUSEJAVA=0 -DGETTEXTJAR=\"/d/minpref/share/gettext/gettext.jar\" -DLIBDIR=\"/d/minpref/lib\" -DGETTEXTDATADIR=\"/d/minpref/share/gettext\" -DPROJECTSDIR=\"/d/minpref/share/gettext/projects\" -DEXEEXT=\".exe\" -DHAVE_CONFIG_H -I. -I.. -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/d/minpref/bin\" -D__STDC_LIMIT_MACROS -O2 -I/d/minpref/include -std=c++14 -E -dD -o preproc.i `test -f '../woe32dll/c++msgmerge.cc' || echo './'`../woe32dll/c++msgmerge.cc In file included from ../woe32dll/c++msgmerge.cc:1:
In file included from ../woe32dll/../src/msgmerge.c:55:
In file included from ../gnulib-lib\xmalloca.h:21:
In file included from ../gnulib-lib/malloca.h:26:
../gnulib-lib/xalloc-oversized.h:57:10: warning: 'xalloc_oversized' macro redefined [-Wmacro-redefined]
# define xalloc_oversized(n, s) __xalloc_oversized (n, s)
^
../gnulib-lib\xalloc.h:149:10: note: previous definition is here
# define xalloc_oversized(n, s) \
^
1 warning generated.
Post the generated file preproc.i
, not the output warnings
Can you share a copy of your D:\mingw-llvm\x86_64-w64-mingw32\include\c++\v1\wchar.h?
Nevermind, I don't need that file, I see what's going on.
Something in your build makes it add -std=c++14
on that command line. I don't know why just yet though.
When -std=c++14
is set (contrary to -std=gnu++14
), the preprocessor sets #define __STRICT_ANSI__ 1
. Now this triggers a rather weird condition in one of gettext's files:
http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/src/po-lex.h#n32
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
This #define __attribute__(Spec)
makes all attributes expand to nothing. This means that __attribute__ ((__enable_if__(true, "")))
ends up effectless, and typedef int __v2si __attribute__((__vector_size__(8)));
loses the vector attribute, breaking all the code that uses it in clang's internal headers.
Now why something sets -std=c++14
I don't know, I don't see that happening in gettext-0.19.8.1, maybe it's something new in the newer versions of gettext?
FWIW, I also tried gettext-0.20.1, and I don't get -std=c++14
with that either (when cross compiling), so I'm not quite sure what in your environments manage to inject it...
I set this flag before, so I unset it and everything went fine, except the test. Still got gettext installed. Thank you.
FYI this might help with the
___chkstk_ms
:CFLAGS=-mno-stack-arg-probe
I wouldn't recommend that. If you omit the stack probe, the code will crash at runtime if the stack hasn't been allocated that far yet. It's really there for a reason.
I see large projects using it, so should be fine:
No, it's not generally fine to use that option.
Try this test program, with and without that option. If compiled with -mno-stack-arg-probe
, it crashes.
#include <stddef.h>
#include <stdio.h>
#define STEP 30*1024
void recurse(int allocated, char *ptr) {
if (allocated > 700*1024)
return;
ptr[0] = 42;
char buf[STEP];
printf("allocated %d KB\n", (allocated + (int)sizeof(buf))/1024);
fflush(stdout);
recurse(allocated + (int)sizeof(buf), buf);
ptr[1] = 43;
}
int main(int argc, char **argv) {
char buf[2];
recurse(0, buf);
return 0;
}
On Windows, the stack is allocated one 4 KB page at a time. If a function allocates more than 4 KB on the stack, the compiler injects a call to ___chkstk_ms
or alloca
or __chkstk
(different name per architecture), to touch the stack in 4 KB increments, to make sure it's all allocated. If a function doesn't do this and just allocates more stack than this, and nothing in the thread has used that much of the stack so far, it will crash. See https://geidav.wordpress.com/tag/stack-probing/ for a more elaborate and visual explanation.
If the codebase never allocates more than 4 KB on the stack in each function, no such calls to that function is generates, so the option has no effect. If the codebase does allocate more than 4 KB on the stack in one function and the calls to __chkstk
are disabled, it will only work if an earlier called function has touched the stack that far to make sure it really is allocated. That is, it will only work by chance or in very specific call patterns (and be prone to break randomly).
Now in Windows 10, the allocation step size seems to have been increased from 4 KB to around 24 KB. This means that apps that allocate between 4 and 24 KB on the stack in a function, compiled with -mno-stack-arg-probe
, can actually seem to work on Windows 10, but still would fail on older versions (not sure exactly in which version it changed), and still would potentially break if one function happened to use more than 24 KB.
So in short, it's not generally safe to use that option. If you use it, you should know exactly why it's guaranteed not to be needed in your codebase. It's not a recommendable workaround for the ___chkstk_ms
function not being found.
Do you have any thoughts on
CFLAGS=-fno-addrsig
? I had to use that in a different situation.
I think that one should be mostly fine, although I don't remember all the details about the LLVM addrsig feature.
Closing this one, it seems to have progressed from the original issue, please reopen if the issue persists.
I cannot build gettext with clang. But with gcc, there is no errors.