Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mavericks (OSX 10.9) build fixes #54

Closed
meshula opened this issue Nov 17, 2013 · 12 comments
Closed

Mavericks (OSX 10.9) build fixes #54

meshula opened this issue Nov 17, 2013 · 12 comments

Comments

@meshula
Copy link
Contributor

meshula commented Nov 17, 2013

Here are a couple of patches to get past initial Mavericks compatibility problems. This allows the build to get to the end of the initial make steps. There's still a bunch of compile time issues after that.

Unfortunately premake4.4b4 doesn't generate clean Xcode projects (it generates 32 bit targets when 64 is specified, and the include paths are not set up correctly). AFAIK those problems need to be resolved within premake itself. Given the current state of premake development, I wonder if it is worth simply creating some clean Xcode projects manually and storing them in the bgfx repo? (That's what I ended up doing with my own projects which were initially premake based).

Here's a correction for glext.h

ifndef GL_ARB_shader_objects

/* GL types for program/shader text and shader object handles */
typedef char GLcharARB;

if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)

typedef void* GLhandleARB;

else

typedef unsigned int GLhandleARB;

endif

endif

A fix to bx's unordered_map shim.

if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)

include <unordered_map>

else

include <tr1/unordered_map>

endif

bx's allocator.h

if BX_CONFIG_ALLOCATOR_CRT

if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)

else

include <malloc.h>

endif

@bkaradzic
Copy link
Owner

Thanks for update, I'm still on 10.8.6 here. I'll add this (or if you have changes already you can just send pull request).

I don't use Xcode at all. I use only gmake on OSX/iOS/Android/etc. Did you try to build thru command line?

$ make osx-release64

Anyhow bgfx project files are there just as an example, I assume if anyone is using bgfx that they will just switch to their build system anyway.

For example, building it with CMake:
https://github.com/LoomSDK/LoomSDK/blob/master/loom/graphics/CMakeLists.txt and stripping down library to minimum needed: https://github.com/LoomSDK/LoomSDK/tree/master/loom/graphics/internal

At some point I'll probably provide compiled libs for all targets, but currently I don't have automated way to do it.

@meshula
Copy link
Contributor Author

meshula commented Nov 18, 2013

I saw you pushed the latest from Kronos - I stashed my changes and tried again. glext.h is good now :)

Gor bx, I had to delete unordered_map entirely to get it out of the search path, as well as removing the include of malloc.h.

I've shifted to a command line build strategy as you suggest, with the bx mods, the library builds fine. Trying to get the samples building now, for some reason it's hung up on not finding the SDL2 headers (which I've currently got in /Library/Frameworks.) I'm sure it'll be easy enough to resolve at my end.

Maybe the premake script could generate the unordered_map header on pre 10.9 installations?

@meshula
Copy link
Contributor Author

meshula commented Nov 18, 2013

Solved SDL2 with
cd 3rdparty
ln -s /Library/Frameworks/SDL2.framework/Versions/A/Headers SDL2
mkdir lib; cd lib; mkdir osx64_gcc; cd osx64_gcc
ln -s /Library/Frameworks/SDL2.framework/Versions/A/SDL2 libSDL2.a

I think maybe you were assuming that SDL2 would be installed by people into /usr/local instead of as a framework? A few notes in the readme might be helpful.

After a command line build, the examples are working (i.e., they run properly) up to the stencil shadow sample, which doesn't build because for an obvious reason -

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cmath:1242:46: fatal error: declaration conflicts
with target of using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);}
^
../../../examples/common/fpumath.h:20:14: note: target of using declaration
inline float fmax(float _a, float _b)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cmath:1239:9: note: using declaration
using ::fmax;
^

Getting close!

@bkaradzic
Copy link
Owner

I had to delete unordered_map entirely

Yeah I was wondering about that. Since it would include itself.

Btw, can you try deleting whole bx/include/compat/osx. Based on your changes it might work that way, and then I'll figure out how to remove include path from 10.9 in Premake script instead.

@bkaradzic
Copy link
Owner

I've been wanting to disable SDL2 build for OSX anyway. Someone requested SDL2 integration and I left it enabled mostly for testing reasons. Setting ENTRY_CONFIG_USE_SDL to 0 build with native entry path.

@bkaradzic
Copy link
Owner

What's using cmath?

@bkaradzic
Copy link
Owner

Btw, SDL2 path is just what SDL2 uses when building from source. I just did make && make install. How did you obtain SDL2? Is it part of Xcode/SDK now?

@bkaradzic
Copy link
Owner

Fixed this fmin/fmax name collision (a4df646). It seems defined everywhere except MSVC. Not sure why this never caused any issues?!

@meshula
Copy link
Contributor Author

meshula commented Nov 18, 2013

  1. deleting compat/osx. FTW - it's good.
  2. unordered_map > hash_table > math
  3. http://www.libsdl.org/download-2.0.php has SDL2 prebuilt binaries as a .dmg file
  4. with a4df646, the build succeeds all the way through.

All of the demos I tried look good, except the SDF font demo is quite glitched around the edges of some letters.

@bkaradzic
Copy link
Owner

All of the demos I tried look good, except the SDF font demo is quite glitched around the edges of some letters.

Probably would be the best to create screenshot and open new issue specifically for it.

@bkaradzic
Copy link
Owner

deleting compat/osx. FTW - it's good.

Ok, I don't have solution yet how to make it work with 10.8.4 and 10.9 but good to know.

@meshula
Copy link
Contributor Author

meshula commented Nov 18, 2013

LOL, okay, I'll learn how to add screenshots to issue reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants