bkaradzic / bgfx

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
https://bkaradzic.github.io/bgfx/overview.html
BSD 2-Clause "Simplified" License
14.86k stars 1.93k forks source link

mingw-w64 under macOS: build errors #1055

Open djtracy opened 7 years ago

djtracy commented 7 years ago

I am using macOS 10.11.6, and mingw-w64 installed via the excellent 'brew' package manager.

My MINGW environment var is set to '/usr/local/Cellar/mingw-w64/5.0.1', which contains a bin/ directory that has links to all of the tools.

Compiling with 'make mingw-gcc-debug64' in the bgfx/ directory I get the following:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -R -C .build/projects/gmake-mingw-gcc config=debug64 ==== Building bx (debug64) ==== bx.cpp (more successfully compiled source files) Creating ../../win64_mingw-gcc/bin Archiving bx /bin/sh: /usr/local/Cellar/mingw-w64/5.0.1/bin/ar: No such file or directory ==== Building bgfx (debug64) ==== Creating ../../win64_mingw-gcc/obj/x64/Debug/bgfx Creating ../../win64_mingw-gcc/obj/x64/Debug/bgfx/src bgfx.cpp (more successfully compiled source files) renderer_d3d11.cpp renderer_d3d12.cpp renderer_d3d9.cpp renderer_gl.cpp (more successfully compiled source files) make[2]: No rule to make target ../../win64_mingw-gcc/bin/libbxDebug.a', needed by../../win64_mingw-gcc/bin/libbgfxDebug.a'. Stop. make[1]: [bgfx] Error 2 make: *** [mingw-gcc-debug64] Error 2

Note first the error of not finding the 'ar' binutil. In that bin directory, I have the following ar utils:

i686-w64-mingw32-ar i686-w64-mingw32-gcc-ar x86_64-w64-mingw32-ar x86_64-w64-mingw32-gcc-ar

but GENie appears to be looking for plain 'ar'.

There is also the subsequent error, caused by 'ar' failure:

make[2]: *** No rule to make target ../../win64_mingw-gcc/bin/libbxDebug.a', needed by../../win64_mingw-gcc/bin/libbgfxDebug.a'.

Questions:

  1. Is use of mingw-w64 under macOS for cross-compilation an intended use case for bgfx + GENie? Is it a tested configuration? If that is the case, it is possible that my setup is simply wrong in some way. I do notice that mingw-w64 under linux seems to be supported.

  2. Perhaps there is an easy fix for the ar issue? It looks like ascertaining the name of the 'ar' utility for the environment failed, possibly due to assumptions broken by macOS + mingw-w64?

bkaradzic commented 7 years ago

I never tried building with MinGW on OSX. Technically using system ar should not be an issue. Make sure you're building bx as library.

djtracy commented 7 years ago

Using system ar may or may not work, but the build system seems to be looking for a system-named 'ar' in a 'x86_64-w64-mingw32-gcc-ar' directory.

I executed 'make mingw-gcc-debug64' in the bgfx/ directory, as I have done for other platforms that work. I'm not sure what you mean by "make sure you're building bx as a library". No other software is involved.