OS X support

337 views
Skip to first unread message

Martin G

unread,
Feb 14, 2014, 11:45:43 AM2/14/14
to freer...@googlegroups.com
Is OS X supported, or is planned to be? I tried building it today but ran into some issues.
System info:
OS X 10.9.1
FreeRCT revision 1046 from svn


cmake .
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/bin/gcc-4.2
-- Check for working C compiler: /usr/bin/gcc-4.2 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
--
-- Building rcdgen
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.5.17")
-- Found BISON: /usr/bin/bison (found version "2.3")
-- Found FLEX: /usr/bin/flex (found version "2.5.35")
-- Building RCD Files
-- Building FreeRCT
-- Found SDL: /usr/local/lib/libSDLmain.a;/usr/local/lib/libSDL.dylib;-framework Cocoa (found version "1.2.15")
-- Found SDL_ttf: /usr/local/lib/libSDL_ttf.dylib (found version "2.0.11")
-- Could NOT find Hg (missing:  HG_EXECUTABLE)
-- Found Subversion: /usr/bin/svn (found version "1.7.10")
-- Found Git: /usr/local/bin/git (found version "1.8.5.4")
-- Detected svn checkout
-- Version string: 20140209-1955.r1046
-- Generating src/rev.cpp
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sharix/freerct-read-only

make
[  1%] Generating scanner.cpp
[  2%] Generating parser.cpp
Scanning dependencies of target rcdgen
[  4%] Building CXX object src/rcdgen/CMakeFiles/rcdgen.dir/ast.cpp.o
In file included from /Users/sharix/freerct-read-only/src/rcdgen/ast.cpp:12:
In file included from /Users/sharix/freerct-read-only/src/rcdgen/../stdafx.h:89:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:594:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4019:35: error:
      no viable overloaded '='
                __e->__weak_this_ = *this;
                ~~~~~~~~~~~~~~~~~ ^ ~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4281:9: note:
      in instantiation of function template specialization
      'std::__1::shared_ptr<const
      NumberLiteral>::__enable_weak_this<Expression>' requested here
    __r.__enable_weak_this(__r.__ptr_);
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4636:12: note:
      in instantiation of function template specialization
      'std::__1::shared_ptr<const NumberLiteral>::make_shared<const Position &,
      long long>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
           ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.cpp:122:20: note: in
      instantiation of function template specialization
      'std::__1::make_shared<const NumberLiteral, const Position &, long long>'
      requested here
                case '-': return std::make_shared<const NumberLiteral>(t...
                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4948:15: note:
      candidate function not viable: no known conversion from
      'std::__1::shared_ptr<const NumberLiteral>' to 'const
      std::__1::weak_ptr<Expression>' for 1st argument
    weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4959:15: note:
      candidate function not viable: no known conversion from
      'std::__1::shared_ptr<const NumberLiteral>' to
      'std::__1::weak_ptr<Expression>' for 1st argument
    weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4955:9: note:
      candidate template ignored: failed template argument deduction
        operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4966:9: note:
      candidate template ignored: failed template argument deduction
        operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4973:13: note:
      candidate template ignored: disabled by 'enable_if' [with _Yp = const
      NumberLiteral]
            is_convertible<_Yp*, element_type*>::value,
            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4019:35: error:
      no viable overloaded '='
                __e->__weak_this_ = *this;
                ~~~~~~~~~~~~~~~~~ ^ ~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4281:9: note:
      in instantiation of function template specialization
      'std::__1::shared_ptr<const
      StringLiteral>::__enable_weak_this<Expression>' requested here
    __r.__enable_weak_this(__r.__ptr_);
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4636:12: note:
      in instantiation of function template specialization
      'std::__1::shared_ptr<const StringLiteral>::make_shared<const Position &,
      const std::__1::basic_string<char> &>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
           ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.cpp:183:9: note: in instantiation
      of function template specialization 'std::__1::make_shared<const
      StringLiteral, const Position &, const std::__1::basic_string<char> &>'
      requested here
        return std::make_shared<const StringLiteral>(this->pos, this->text);
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4948:15: note:
      candidate function not viable: no known conversion from
      'std::__1::shared_ptr<const StringLiteral>' to 'const
      std::__1::weak_ptr<Expression>' for 1st argument
    weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4959:15: note:
      candidate function not viable: no known conversion from
      'std::__1::shared_ptr<const StringLiteral>' to
      'std::__1::weak_ptr<Expression>' for 1st argument
    weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4955:9: note:
      candidate template ignored: failed template argument deduction
        operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4966:9: note:
      candidate template ignored: failed template argument deduction
        operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4973:13: note:
      candidate template ignored: disabled by 'enable_if' [with _Yp = const
      StringLiteral]
            is_convertible<_Yp*, element_type*>::value,
            ^
2 errors generated.
make[2]: *** [src/rcdgen/CMakeFiles/rcdgen.dir/ast.cpp.o] Error 1
make[1]: *** [src/rcdgen/CMakeFiles/rcdgen.dir/all] Error 2
make: *** [all] Error 2

I used homebrew to get all dependencies. I can post additional info on request.

Alberth

unread,
Feb 15, 2014, 9:27:34 AM2/15/14
to freer...@googlegroups.com
Looks like your std:: libraries behave differently, or your compiler works differently causing the std:: stuff to fail.
No idea how to solve that.

OS X support is not excluded, but it is also not included currently due to lack of an OS X developer.

Lord Aro

unread,
Feb 15, 2014, 6:35:58 PM2/15/14
to freer...@googlegroups.com
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/bin/gcc-4.2
-- Check for working C compiler: /usr/bin/gcc-4.2 -- works

This screams "Wat." to me :L

First, clang 5.0.0 doesn't exist - current release is 3.4. Although, i guess that could be Apple/Xcode screwing things up
Second, gcc4.2 is very old (but newest available on OSX?), and will not work correctly with C++11 programs

So, if you can get it to build with clang correctly, it may work
Also, this answer - http://stackoverflow.com/a/19757516/995325 - may be of some relevance

Martin G

unread,
Feb 15, 2014, 7:03:43 PM2/15/14
to freer...@googlegroups.com
Here is some more info about the compilers:


which clang
/usr/bin/clang 

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

which gcc
/usr/bin/gcc

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

So I just run "cmake -std=c++11 -stdlib=libstdc++ ." instead of "cmake ." ?

Lord Aro

unread,
Feb 15, 2014, 7:53:37 PM2/15/14
to freer...@googlegroups.com
The issue is that gcc/g++ is symlinked to clang/clang++

What i think you need to do is:
delete all Cmake generated files (no easy way to do this, just everything except CMakeLists.txt)
run:
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cmake
.



Try that, and see what happens :)

Martin G

unread,
Feb 15, 2014, 8:01:23 PM2/15/14
to freer...@googlegroups.com
here is the output (I created a "build" directory inside freerct-read-only so I can easily remove cmake generated files):

cmake ../

-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works

-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works

-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
--
-- Building rcdgen
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.5.17")
-- Found BISON: /usr/bin/bison (found version "2.3")
-- Found FLEX: /usr/bin/flex (found version "2.5.35")
-- Building RCD Files
-- Building FreeRCT
-- Found SDL: /usr/local/lib/libSDLmain.a;/usr/local/lib/libSDL.dylib;-framework Cocoa (found version "1.2.15")
-- Found SDL_ttf: /usr/local/lib/libSDL_ttf.dylib (found version "2.0.11")
-- Could NOT find Hg (missing:  HG_EXECUTABLE)
-- Found Subversion: /usr/bin/svn (found version "1.7.10")
-- Found Git: /usr/local/bin/git (found version "1.8.5.4")
-- Detected svn checkout
-- Version string: 20140214-1724.r1047

-- Generating src/rev.cpp
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sharix/freerct-read-only/build

And then "make" producet the same error as before. :(

Lord Aro

unread,
Feb 15, 2014, 8:17:38 PM2/15/14
to freer...@googlegroups.com
Ok.

In that case, try editing CMakeLists.txt itself

In src/CMakeLists.txt and src/rcdgen/CMakeLists.txt, you'll find a line near the end of the file like:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -pedantic -Wall")

Add
-stdlib=libstdc++

somewhere in that list.
If that doesn't work, try just libc++

If neither of these work, i don't know :3

Martin G

unread,
Feb 15, 2014, 8:27:07 PM2/15/14
to freer...@googlegroups.com
I added it to both files. Unfortunately it still doesnt build, but at least the errors are different now:
make

Scanning dependencies of target rcdgen
[  1%] Building CXX object src/rcdgen/CMakeFiles/rcdgen.dir/ast.cpp.o
In file included from /Users/sharix/freerct-read-only/src/rcdgen/ast.cpp:13:
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:41:32: error: unknown template
      name 'enable_shared_from_this'
class Expression : public std::enable_shared_from_this<Expression> {
                               ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:46:15: error: no type named
      'shared_ptr' in namespace 'std'
        virtual std::shared_ptr<const Expression> Evaluate(const Symbol ...
                ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:46:25: error: expected member
      name or ';' after declaration specifiers
        virtual std::shared_ptr<const Expression> Evaluate(const Symbol ...
        ~~~~~~~~~~~~~~~~~~~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:52:36: error: unknown template
      name 'enable_shared_from_this'
class ExpressionList : public std::enable_shared_from_this<ExpressionList> {
                                   ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:56:17: error: no member named
      'shared_ptr' in namespace 'std'
        std::list<std::shared_ptr<Expression>> exprs; ///< The sequence ...
                  ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:56:28: error: 'Expression' does
      not refer to a value
        std::list<std::shared_ptr<Expression>> exprs; ///< The sequence ...
                                  ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:41:7: note: declared here
class Expression : public std::enable_shared_from_this<Expression> {
      ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:62:52: error: no type named
      'shared_ptr' in namespace 'std'
        UnaryOperator(const Position &pos, int oper, std::shared_ptr<Exp...
                                                     ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:62:62: error: expected ')'
        UnaryOperator(const Position &pos, int oper, std::shared_ptr<Expression...
                                                                    ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:62:15: note: to match this '('
        UnaryOperator(const Position &pos, int oper, std::shared_ptr<Exp...
                     ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:64:7: error: no type named
      'shared_ptr' in namespace 'std'
        std::shared_ptr<const Expression> Evaluate(const Symbol *symbols...
        ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:64:17: error: expected member
      name or ';' after declaration specifiers
        std::shared_ptr<const Expression> Evaluate(const Symbol *symbols...
        ~~~~~~~~~~~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:67:7: error: no type named
      'shared_ptr' in namespace 'std'
        std::shared_ptr<Expression> child; ///< Child expression (shoul...
        ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:67:17: error: expected member
      name or ';' after declaration specifiers
        std::shared_ptr<Expression> child; ///< Child expression (shoul...
        ~~~~~~~~~~~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:73:43: error: no type named
      'shared_ptr' in namespace 'std'
        BinaryOperator(const Position &pos, std::shared_ptr<Expression> ...
                                            ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:73:53: error: expected ')'
        BinaryOperator(const Position &pos, std::shared_ptr<Expression> ...
                                                           ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:73:16: note: to match this '('
        BinaryOperator(const Position &pos, std::shared_ptr<Expression> ...
                      ^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:75:7: error: no type named
      'shared_ptr' in namespace 'std'
        std::shared_ptr<const Expression> Evaluate(const Symbol *symbols...
        ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:75:17: error: expected member
      name or ';' after declaration specifiers
        std::shared_ptr<const Expression> Evaluate(const Symbol *symbols...
        ~~~~~~~~~~~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:78:7: error: no type named
      'shared_ptr' in namespace 'std'
        std::shared_ptr<Expression> left;  ///< Left child expression (s...
        ~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:78:17: error: expected member
      name or ';' after declaration specifiers
        std::shared_ptr<Expression> left;  ///< Left child expression (s...
        ~~~~~~~~~~~~~~~^
/Users/sharix/freerct-read-only/src/rcdgen/ast.h:79:7: error: no type named
      'shared_ptr' in namespace 'std'
        std::shared_ptr<Expression> right; ///< Right child expression (...
        ~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Lord Aro

unread,
Feb 15, 2014, 8:33:58 PM2/15/14
to
Did you try with libc++ as well?

This conversation may go quicker via IRC
Message has been deleted

Skip Lentz

unread,
May 11, 2014, 5:53:56 PM5/11/14
to freer...@googlegroups.com
Martin, I got it working quite easily after installed libsdl2, libsdl2_ttf, libpng and cmake using MacPorts. Make sure you have a valid freerct.cfg, which points to a font in the /Library/Fonts directory, and also make sure you do the "cmake ." command in the root directory of the project (i.e.: don't do an out-of-source build in a seperate "build" directory, it didn't work for me).

Reply all
Reply to author
Forward
0 new messages