Issues

Issue #789 resolved

unknown type name '_GLIBCXX_BEGIN_NAMESPACE'

ryandesign
created an issue

Building LÖVE 9c7510832f8b633de1cf58368cffa6bb7bb9b958 on OS X 10.9 with ./configure and make is failing:

libtool: compile:  /usr/bin/clang++ -DHAVE_CONFIG_H -I. -I.. -I. -I./modules -I./libraries -I./libraries/enet/libenet/include -I/usr/include/freetype2 -D_FILE_OFFSET_BITS=64 -isystem/opt/local/include -D_THREAD_SAFE -I/opt/local/include/SDL2 -pipe -Os -I/opt/local/include/freetype2 -I/opt/local/include -arch x86_64 -stdlib=libc++ -std=c++11 -MT modules/love/love.lo -MD -MP -MF modules/love/.deps/love.Tpo -c modules/love/love.cpp  -fno-common -DPIC -o modules/love/.libs/love.o
modules/love/love.cpp:45:1: error: unknown type name '_GLIBCXX_BEGIN_NAMESPACE'
_GLIBCXX_BEGIN_NAMESPACE(std)
^
modules/love/love.cpp:45:30: error: expected ';' after top level declarator
_GLIBCXX_BEGIN_NAMESPACE(std)
                             ^
                             ;
modules/love/love.cpp:54:10: error: unknown type name 'ostream'; did you mean 'std::ostream'?
template ostream& ostream::_M_insert(long);
         ^~~~~~~
         std::ostream
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:146:38: note: 'std::ostream' declared here
typedef basic_ostream<char>          ostream;
                                     ^

The log has much more of the same; I'll attach the whole thing. But it might all come down to the unknown _GLIBCXX_BEGIN_NAMESPACE type name.

On OS X these days, the compiler used is the Apple LLVM compiler, which is based on the open source clang compiler. There is no GCC.

$ clang -v
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

In addition, OS X 10.9 removed libstdc++ which was used on OS X 10.8 and earlier and replaced it with libc++ which behaves somewhat differently sometimes. If I understand correctly, it implements the C++11 standard, but not some of the not-quite-standard ways that were in use before the standard was finalized.

I'm not a C/C++ programmer so my ability to fix this problem in the LÖVE source code is limited, but I'm happy to test any changes you propose.

Comments (6)

  1. Alex Szpakowski

    libstdc++ still exists in 10.9. LÖVE requires that bit of code for Mac OS 10.5 support.

    It's necessary to use libstdc++ when the minimum version of OS X supported at runtime (aka the deployment target / MACOSX_DEPLOYMENT_TARGET) is 10.6 or below.

  2. ryandesign reporter

    That shouldn't apply in this case, since MacPorts sets MACOSX_DEPLOYMENT_TARGET to the same as the OS X version, i.e. on OS X 10.9 it's set to 10.9.

  3. ryandesign reporter

    Thanks, this works on OS X 10.9, but I think it will fail on versions earlier than 10.6 because MAC_OS_X_VERSION_10_6 is not defined in /usr/include/AvailabilityMacros.h on OS X versions earlier than 10.6.

  4. Alex Szpakowski

    On the one hand that's true, on the other hand it just means there's no support for compiling LÖVE on 10.5 systems. The situation is the same for SDL 2 anyway, so even if compilation works for LÖVE itself, it doesn't for its libraries.

    We're going to drop 10.5 runtime support soon anyway.

  5. Log in to comment