Other than different tools and a few compiler/linker flags, everything is the same as with MSVC. My *build script* takes care of setting variables like INCLUDE, LIB and PATH.
This is the only issue I have encountered using clang-cl.exe. Everything else works just fine. Actually, I tried to rebuild everything from scratch with clang-cl.exe and noticed that iconv-2.dll, when built with clang-cl exports sprintf symbol, and passing `-Wno-error=implicit-function-declaration` allows to build everything successfully. - Kirill Makurin ________________________________ From: Bruno Haible <br...@clisp.org> Sent: Tuesday, June 10, 2025 4:16 AM To: bug-gnulib@gnu.org <bug-gnulib@gnu.org>; Kirill Makurin <maiddais...@outlook.com> Subject: Re: clang-cl: undeclared library function 'sprintf' Hi Kirill, > As part of my attempts to build some GNU packages with MSVC tools, I also > tried to build them with LLVM tools which can be installed with Visual Studio > (clang-cl.exe and lld-link.exe). > > When compiling source files lib/strerror.c and lib/vasnprintf.c (and possibly > some other) the following error occurs: > > ``` > H:/releases/gettext-0.25/libtextstyle/lib/strerror.c(64,7): error: call to > undeclared library function 'sprintf' with type 'int (char *restrict, const > char *restrict, ...)'; ISO C99 and later do not support implicit function > declarations [-Wimplicit-function-declaration] > 64 | sprintf (buf, fmt, n); > | ^ > H:/releases/gettext-0.25/libtextstyle/lib/strerror.c(64,7): note: include the > header <stdio.h> or explicitly provide a declaration for 'sprintf' > 1 error generated. > ``` While I cannot say anything about this particular error, two remarks about clang-cl: * It's a combination of the clang compiler (with an MSVC like front end) with the MSVC header files. Therefore, some pairs of versions work well together, while some don't. My personal experience is that with MSVC 14.00, clang versions 8, 9, 10 worked fine, whereas starting with clang 11 or 12, it did not work well any more. Maybe other people's experience, with a newer version of MSVC, is different. * It's your duty to find the appropriate settings for the INCLUDE and LIB environment variables. My approach was to use the same values as for MSVC, i.e. not use any clang-provided header files. Your approach might be different... Bruno