bgfx
bgfx copied to clipboard
Mingw-clang
Just a query, is Windows mingw-clang actually compilable (which would be awesome by the way) or is this still experimental? Because I tried it but I couldn't get it to compile.
Here's a sample output:
c:\My Projects\Research\bgfx\.build\projects\gmake-mingw-clang>c:\LLVM/bin/clang++ -MMD -MP -MP -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D_DEBUG -DWIN32 -DMINGW_HAS_SECURE_API=1 -I../../../../bx/include/compat/mingw -I../../../../bx/include -Wall -Wextra -fomit-frame-pointer -g -m32 -fno-rtti -fno-exceptions -Wunused-value -fdata-sections -ffunction-sections -msse2 -Wundef -isystemc:\TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++ -isystemc:\TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32 -isystemc:\TDM-GCC-64/x86_64-w64-mingw32/include -m32 -std=c++11 -o "../../win32_mingw-clang/obj/x32/Debug/bx/bx/src/bx.o" -c "../../../../bx/src/bx.cpp
In file included from ../../../../bx/src/bx.cpp:6:
In file included from ../../../../bx/include\bx/debug.h:9:
In file included from ../../../../bx/include\bx/bx.h:9:
In file included from ../../../../bx/include/compat/mingw\alloca.h:4:
c:\TDM-GCC-64/x86_64-w64-mingw32/include\malloc.h:147:28: error: use of undeclared identifier '_ALLOCA_S_MARKER_SIZE'
_Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE;
^
c:\TDM-GCC-64/x86_64-w64-mingw32/include\malloc.h:166:34: error: use of undeclared identifier '_ALLOCA_S_MARKER_SIZE'
_Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE;
^
In file included from ../../../../bx/src/bx.cpp:6:
In file included from ../../../../bx/include\bx/debug.h:9:
In file included from ../../../../bx/include\bx/bx.h:12:
c:\TDM-GCC-64/x86_64-w64-mingw32/include\stdlib.h:306:47: error: expected ';' after top level declarator
void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN;
Thanks!
It compiled at some point, but I didn't test it in long time.
Alright, which mingw repo did yo use? http://tdm-gcc.tdragon.net?
Yes TDM. But this is probably more important, this clang: http://llvm.org/builds/ (it can work with both MSVC or MinGW runtime)
Wait, is this any different to http://releases.llvm.org/4.0.0/LLVM-4.0.0-win64.exe which I installed? Oh, that snapshot build is LLVM 5.0... but still the same error. I've tried both 32 & 64 bit installs.
@bkaradzic do you remember maybe exactly which LLVM version you used to test this?
One that's in VS plugin: https://github.com/bkaradzic/bx/blob/master/scripts/toolchain.lua#L89
If you can genie --vs=vs2015-clang
you should use the same LLVM to do mingw-clang
Alright, did a test with llvm 3.9 and vs2015-clang does indeed work but mingw still doesn't compile.
Can you post some of errors?
They are the same ones posted above basically.
I'll post full error dump tomorrow.
- Freshly cloned bx, bgfx, bimg
- Installed http://releases.llvm.org/3.9.0/LLVM-3.9.0-win64.exe
- Run:
set PATH=%PATH%;..\gnumake
set MINGW=c:\TDM-GCC-64
set CLANG=c:\LLVM
..\bx\tools\bin\windows\genie --with-examples --gcc=mingw-clang gmake
make mingw-clang-debug64
Here's the full output: clang_mingw_error_output.txt
This part:
In file included from ../../../../bx/include\bx/bx.h:15:
../../../../bx/include\bx/platform.h:158:51: warning: '_USING_V110_SDK71_' is not defined, evaluates to 0 [-Wundef]
# if defined(_MSC_VER) && (_MSC_VER >= 1700) && (!_USING_V110_SDK71_)
^
suggests that _MSC_VER is defined and that clang
might think it's compiling for MSVC... This definitely wasn't case when I built with it.
Ok, finally figured out how to get mingw & clang work together with LLVM 4.0.
You just have to add:
-target x86_64-w64-mingw32
to all clang calls. Didn't have time to try bgfx with it yet thought.
I have compiled bgfx with mingw clang toolchain. It needs some tiny fixes. Would you like to accept those patches? If possible I can try to add some GitHub Actions so that you don't have to test the build manually.
It needs some tiny fixes. Would you like to accept those patches?
Sure.
If possible I can try to add some GitHub Actions so that you don't have to test the build manually.
I would like to have GH actions for other targets too. You should come to Discord chat to discuss this further.
I think this issue can be closed. mingw-clang target can be built successfully.