From d5b89886b6978bb1a11a17175a940242b2956f80 Mon Sep 17 00:00:00 2001 From: Bill Meltsner Date: Fri, 2 Mar 2012 19:00:03 -0500 Subject: [PATCH] Switch back to Clang for Mac OS X compilation, and add a new legendary hack to ensure it still runs on Leopard. --- .../macosx/love.xcodeproj/project.pbxproj | 2 - src/common/config.h | 4 ++ src/love.cpp | 41 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/platform/macosx/love.xcodeproj/project.pbxproj b/platform/macosx/love.xcodeproj/project.pbxproj index ac5ba438a..558bbd92a 100644 --- a/platform/macosx/love.xcodeproj/project.pbxproj +++ b/platform/macosx/love.xcodeproj/project.pbxproj @@ -1966,7 +1966,6 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = NO; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; @@ -2018,7 +2017,6 @@ GCC_INPUT_FILETYPE = automatic; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO; GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = NO; - GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = NO; GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; diff --git a/src/common/config.h b/src/common/config.h index 93c0912d6..ade0843ce 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -72,6 +72,10 @@ # define NOMINMAX #endif +#if defined(LOVE_MACOSX) +# define LOVE_LEGENDARY_LIBSTDCXX_HACK +#endif + // Autotools config.h #ifdef HAVE_CONFIG_H # include <../config.h> diff --git a/src/love.cpp b/src/love.cpp index a66498e92..b136c2105 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -232,6 +232,47 @@ int w__openConsole(lua_State * L) #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK +#ifdef LOVE_LEGENDARY_LIBSTDCXX_HACK + +// Workarounds for symbols that are missing from Leopard stdlibc++.dylib. +// http://stackoverflow.com/questions/3484043/os-x-program-runs-on-dev-machine-crashing-horribly-on-others +_GLIBCXX_BEGIN_NAMESPACE(std) +// From ostream_insert.h +template ostream& __ostream_insert(ostream&, const char*, streamsize); + +#ifdef _GLIBCXX_USE_WCHAR_T +template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize); +#endif + +// From ostream.tcc +template ostream& ostream::_M_insert(long); +template ostream& ostream::_M_insert(unsigned long); +template ostream& ostream::_M_insert(bool); +#ifdef _GLIBCXX_USE_LONG_LONG +template ostream& ostream::_M_insert(long long); +template ostream& ostream::_M_insert(unsigned long long); +#endif +template ostream& ostream::_M_insert(double); +template ostream& ostream::_M_insert(long double); +template ostream& ostream::_M_insert(const void*); + +#ifdef _GLIBCXX_USE_WCHAR_T +template wostream& wostream::_M_insert(long); +template wostream& wostream::_M_insert(unsigned long); +template wostream& wostream::_M_insert(bool); +#ifdef _GLIBCXX_USE_LONG_LONG +template wostream& wostream::_M_insert(long long); +template wostream& wostream::_M_insert(unsigned long long); +#endif +template wostream& wostream::_M_insert(double); +template wostream& wostream::_M_insert(long double); +template wostream& wostream::_M_insert(const void*); +#endif + +_GLIBCXX_END_NAMESPACE + +#endif // LOVE_LEGENDARY_LIBSTDCXX_HACK + #ifdef LOVE_BUILD_EXE int main(int argc, char ** argv)