Open shlwapi opened 2 years ago
please show the complile error message. My env is cmake with "Unix Makefiles", not "ninja"
please show the complile error message. My env is cmake with "Unix Makefiles", not "ninja"
I'm not on that computer anymore. The setup on the current machine is a bit different. There is no MSYS2 but only Clang (this Clang is also based on MinGW-W64 and uses MinGW-W64 libraries). CMake and Ninja are installed separately. But I can confirm the error message is almost the same as when on MSYS2.
[1/69] Building C object gear-lib/libposix/CMakeFiles/posix.dir/libposix.c.obj
FAILED: gear-lib/libposix/CMakeFiles/posix.dir/libposix.c.obj
C:\upp\bin\clang\bin\cc.exe -I../gear-lib/libposix/. -I../gear-lib/libposix/pthreads4w -I../gear-lib/libposix/MsvcLibX/include -MD -MT gear-lib/libposix/CMakeFiles/posix.dir/libposix.c.obj -MF gear-lib\libposix\CMakeFiles\posix.dir\libposix.c.obj.d -o gear-lib/libposix/CMakeFiles/posix.dir/libposix.c.obj -c ../gear-lib/libposix/libposix.c
In file included from ../gear-lib/libposix/libposix.c:23:
In file included from ../gear-lib/libposix/./libposix.h:45:
In file included from ../gear-lib/libposix/./libposix4win.h:25:
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:34:2: error: The msvclibx library is designed for use with the Microsoft Visual C/C++ tools only.
#error The msvclibx library is designed for use with the Microsoft Visual C/C++ tools only.
^
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:48:6: error: No msvclibx.lib version for this 64-bits OS.
# error No msvclibx.lib version for this 64-bits OS.
^
In file included from ../gear-lib/libposix/libposix.c:23:
In file included from ../gear-lib/libposix/./libposix.h:45:
In file included from ../gear-lib/libposix/./libposix4win.h:27:
../gear-lib/libposix/MsvcLibX/include/stdio.h:33:10: error: pasting formed '/stdio', an invalid preprocessing token
#include UCRT_INCLUDE_FILE(stdio.h) /* Include MSVC's own <stdio.h> file */
^
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:128:83: note: expanded from macro 'UCRT_INCLUDE_FILE'
#define UCRT_INCLUDE_FILE(relpath) MSVCLIBX_STRINGIZE(MSVCLIBX_CONCAT(UCRTINCLUDE,MSVCLIBX_CONCAT(/,relpath))) /* C runtime library include files */
^
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:123:30: note: expanded from macro 'MSVCLIBX_CONCAT'
#define MSVCLIBX_CONCAT(a,b) MSVCLIBX_CONCAT1(a,b) /* Substitute the arguments, then concatenate the values */
^
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:122:32: note: expanded from macro 'MSVCLIBX_CONCAT1'
#define MSVCLIBX_CONCAT1(a,b) a##b /* Concatenate the raw arguments */
^
In file included from ../gear-lib/libposix/libposix.c:23:
In file included from ../gear-lib/libposix/./libposix.h:45:
In file included from ../gear-lib/libposix/./libposix4win.h:27:
../gear-lib/libposix/MsvcLibX/include/stdio.h:33:10: error: pasting formed 'UCRTINCLUDE/', an invalid preprocessing token
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:128:55: note: expanded from macro 'UCRT_INCLUDE_FILE'
#define UCRT_INCLUDE_FILE(relpath) MSVCLIBX_STRINGIZE(MSVCLIBX_CONCAT(UCRTINCLUDE,MSVCLIBX_CONCAT(/,relpath))) /* C runtime library include files */
^
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:123:30: note: expanded from macro 'MSVCLIBX_CONCAT'
#define MSVCLIBX_CONCAT(a,b) MSVCLIBX_CONCAT1(a,b) /* Substitute the arguments, then concatenate the values */
^
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:122:32: note: expanded from macro 'MSVCLIBX_CONCAT1'
#define MSVCLIBX_CONCAT1(a,b) a##b /* Concatenate the raw arguments */
^
In file included from ../gear-lib/libposix/libposix.c:23:
In file included from ../gear-lib/libposix/./libposix.h:45:
In file included from ../gear-lib/libposix/./libposix4win.h:27:
../gear-lib/libposix/MsvcLibX/include/stdio.h:33:10: fatal error: 'UCRTINCLUDE/stdio.h' file not found
#include UCRT_INCLUDE_FILE(stdio.h) /* Include MSVC's own <stdio.h> file */
^~~~~~~~~~~~~~~~~~~~~~~~~~
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:128:36: note: expanded from macro 'UCRT_INCLUDE_FILE'
#define UCRT_INCLUDE_FILE(relpath) MSVCLIBX_STRINGIZE(MSVCLIBX_CONCAT(UCRTINCLUDE,MSVCLIBX_CONCAT(/,relpath))) /* C runtime library include files */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:125:31: note: expanded from macro 'MSVCLIBX_STRINGIZE'
#define MSVCLIBX_STRINGIZE(x) MSVCLIBX_STRINGIZE1(x) /* Substitute the argument, then convert its value to a string */
^~~~~~~~~~~~~~~~~~~~~~
../gear-lib/libposix/MsvcLibX/include/msvclibx.h:124:32: note: expanded from macro 'MSVCLIBX_STRINGIZE1'
#define MSVCLIBX_STRINGIZE1(x) #x /* Convert the raw argument to a string */
^~
<scratch space>:4:1: note: expanded from here
"UCRTINCLUDE/stdio.h"
^~~~~~~~~~~~~~~~~~~~~
5 errors generated.
ninja: build stopped: subcommand failed.
Well, on libposix.h please have a look at this snippet:
/******************************************************************************
* OS_LINUX
******************************************************************************/
#if defined (__linux__) || defined (__CYGWIN__)
#define OS_LINUX
#define GEAR_API __attribute__((visibility("default")))
#include "libposix4nix.h"
/******************************************************************************
* OS_WINDOWS
******************************************************************************/
#elif defined (__WIN32__) || defined (WIN32) || defined (_MSC_VER)
#define OS_WINDOWS
#define GEAR_API __declspec(dllexport)
#include "libposix4win.h"
You didn't cover MinGW (either the legacy MinGW or MinGW-W64), so it mistakenly thinks that it's building for MSVC. This expectation is wrong, so there is the errors above about the library is designed for use with the Microsoft Visual C/C++ tools only. You can check for MinGW-W64 with this macro __MINGW32__
(defined on both 64 bit and 32 bit MinGW-W64) or __MINGW64__
(defined on 64 bit MinGW-W64 only).
The check for OS_WINDOWS is problematic, __WIN32__
and WIN32
are of course defined on MinGW-W64 (which is true for any compilers targeting Windows environment). The check caused the confusion that it's MSVC is being used even though _MSC_VER
is not defined.
Another possible situation is, you don't support MinGW-W64 based compilers at all. If it's the case please make it clear on README.md. Thanks.
thank for your issue, hope you can send pull request and fix the porting problems on mingw/cygwin,
I'm on MSYS2 with cmake and ninja. Compiler is mingw-w64-x86_64-gcc. I followed the steps in INSTALL.md but was greeted with this fatal error: UCRTINCLUDE/stdio.h: No such file or directory. As I'm using MSYS2 I have no idea why this error involves MSVC at all.