Menu

Compiling under OS X

Help
Ben Whaley
2003-10-13
2003-11-13
  • Ben Whaley

    Ben Whaley - 2003-10-13

    I had a lot of problems getting v0.7 built on OS X. Now that I did it, I want to document it for other users...

    If you run make and get the following errors:

    g++ -g -Wall -Wstrict-prototypes -O2  -I./src  -c -o src/XmlRpcSocket.o src/XmlRpcSocket.cpp
    src/XmlRpcSocket.cpp: In static member function `static int
       XmlRpc::XmlRpcSocket::accept(int)':
    src/XmlRpcSocket.cpp:139: `socklen_t' undeclared (first use this function)
    src/XmlRpcSocket.cpp:139: (Each undeclared identifier is reported only once for
       each function it appears in.)
    src/XmlRpcSocket.cpp:139: parse error before `=' token
    src/XmlRpcSocket.cpp:141: `addrlen' undeclared (first use this function)

    You can fix it by adding "-Dsocklen_t=int" to the Makefile. You may then get the error:

    g++ -g -Wall -Wstrict-prototypes -O2  -I../src   HelloClient.cpp ../libXmlRpc.a   ../libXmlRpc.a -o HelloClient
    ld: archive: ../libXmlRpc.a has no table of contents, add one with ranlib(1) (can't load from it)
    ld: archive: ../libXmlRpc.a has no table of contents, add one with ranlib(1) (can't load from it)
    make[1]: *** [HelloClient] Error 1
    make: *** [tests] Error 2

    To fix this, run "ranlib libXmlRpc.a" to add a table of contents to libXmlRpc.a.

    The socklen_t error is because OS X uses a different prototype than other Unixes do. This fix defines socklen_t as an int, which makes it fit the OS X prototype.

    Regards,
    Ben

     
    • Ben Whaley

      Ben Whaley - 2003-10-13

      Forgot something... add -Dsocklen_t=int to the CPPFLAGS section of the Makefile :)

       
    • Eli Mendez

      Eli Mendez - 2003-11-07

      Ok, yeah, you rule!

       
      • Eli Mendez

        Eli Mendez - 2003-11-07

        Hmm, except that after doing this I get the following errors:
        Validator.cpp:140: error: ambiguous overload for `std::string& +=
           XmlRpc::XmlRpcValue&' operator
        /usr/include/gcc/darwin/3.3/c++/bits/basic_string.h:465: error: candidates are:
           std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
           _Traits, _Alloc>::operator+=(const std::basic_string<_CharT, _Traits,
           _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc =
           std::allocator<char>]
        /usr/include/gcc/darwin/3.3/c++/bits/basic_string.h:468: error:                
           std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
           _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char, _Traits =
           std::char_traits<char>, _Alloc = std::allocator<char>] <near match>
        /usr/include/gcc/darwin/3.3/c++/bits/basic_string.h:471: error:                
           std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
           _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char, _Traits =
           std::char_traits<char>, _Alloc = std::allocator<char>]

         
        • Jone Marius Vignes

          Try the patch found <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=792665&group_id=70654&atid=528555">here</a>

           

Log in to post a comment.