Results 1 to 5 of 5
  1. #1
    How do you compile command line args within Xcode?

    Member Since
    Jul 19, 2011
    Posts
    3
    How do you compile command line args within Xcode?
    Hi folks.
    I'm trying to compile RakNet for the mac. The readme portion pertaining to macs is the following:

    -----------------------------------------
    Mac Users
    -----------------------------------------
    From My Community - Index
    Open a Terminal window and type: cd ~/Desktop/RakNet/Source

    Give the following command:

    Code:
    g++ -c -DNDEBUG -I -isysroot /Developer/SDKs/MacOSX10.5u.sdk/ -arch i386 *.cpp
    Use whichver SDK you have. However, the 10.4 SDK is bugged and will not compile unless you use GCC 4.0 from inside XCODE

    The sources should build cleanly. This gives you a bunch of PowerPC binaries, compiled against the 10.3.9 SDK which is a good thing.

    Give the following command:

    Code:
    libtool -static -o raknetppc.a *.o

    This will stitch together a static library for the PowerPC architecture. There may be warnings that some .o files do not have any symbols. If you want to be prudent, remove the named files (the .o files, not the .cpp files!) and re-run the libtool command.

    Now, we build the source files for Intel:

    Code:
    gcc -c -I ../Include -isysroot /Developer/SDKs/MacOSX10.4u.sdk/ -arch i386 *.cpp

    ..and stitch it into a i386 library:

    Code:
    libtool -static -o rakneti386.a *.o

    Now, type:

    Code:
    ls *.a

    which should list the two .a files. Now, we make them into a universal binary:

    Code:
    lipo -create *.a -o libraknet.a

    You now have a file named libraknet.a. This is the RakNet library, built to run on both PowerPC and Intel Macs. Enjoy! ;-)
    If you try to compile this, it gives you errors when you get to the "gcc -c -I ../Include -isysroot /Developer/SDKs/MacOSX10.4u.sdk/ -arch i386 *.cpp" part. I am wondering if this refers to the part I highlighted in red about compiling it within Xcode.

    Is there a way to compile GCC command lines from within Xcode? If so, please let me know where I put the arguments in xcode. Or is there some special terminal command I need to enter so that the terminal command runs it through Xcode somehow?

    If anyone has any pointers, I'd really appreciate it.

  2. #2
    How do you compile command line args within Xcode?
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,395
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    There's no reason you can't use gcc from the command line and I highly doubt that adding compile options in Xcode will solve this. What was the error?

    Check your SDK folder as you may not even have the 10.4 one and make sure you're using the right one.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3
    How do you compile command line args within Xcode?

    Member Since
    Jul 19, 2011
    Posts
    3
    Quote Originally Posted by vansmith View Post
    There's no reason you can't use gcc from the command line and I highly doubt that adding compile options in Xcode will solve this. What was the error?

    Check your SDK folder as you may not even have the 10.4 one and make sure you're using the right one.
    Following the readme instructions, when I enter the "gcc -c -I ../Include -isysroot /Developer/SDKs/MacOSX10.4u.sdk/ -arch i386 *.cpp" command, I start to get a bunch of errors.

    trevors-imac:Source trevor$ gcc -c -I ../Include -isysroot /Developer/SDKs/MacOSX10.4u.sdk/ -arch i386 *.cpp
    In file included from BitStream.h:17,
    from BitStream.cpp:12:
    RakMemoryOverride.h:14:15: error: new: No such file or directory
    In file included from RakString.h:8,
    from BitStream.h:21,
    from BitStream.cpp:12:
    /Developer/SDKs/MacOSX10.4u.sdk//usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
    In file included from BitStream.h:25,
    from BitStream.cpp:12:
    /Developer/SDKs/MacOSX10.4u.sdk//usr/include/float.h:8:24: error: float.h: No such file or directory
    BitStream.cpp:35:17: error: cmath: No such file or directory
    ...
    And then many more such errors.

    Ya, I do have /Developer/SDKs/MacOSX10.4u.sdk/

    I wonder if it's just bugged?

  4. #4
    How do you compile command line args within Xcode?
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,395
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Is there any particular reason you are using the 10.4 SDK? Are you running Tiger? If not, use a newer SDK.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5
    How do you compile command line args within Xcode?

    Member Since
    Jul 19, 2011
    Posts
    3
    Quote Originally Posted by vansmith View Post
    Is there any particular reason you are using the 10.4 SDK? Are you running Tiger? If not, use a newer SDK.
    I believe in order to support non-intel macs, I need to use 10.4 SDK.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Compare OS X command line to Linux command line?
    By V6Pony in forum OS X - Development and Darwin
    Replies: 5
    Last Post: 09-26-2013, 12:32 PM
  2. How to compile (without building) a .c/.cpp file with Xcode?
    By ZhimingWang in forum OS X - Development and Darwin
    Replies: 7
    Last Post: 08-27-2013, 10:46 AM
  3. XCode command line tools?
    By jnojr in forum OS X - Operating System
    Replies: 1
    Last Post: 11-27-2012, 04:53 PM
  4. Is there any command to compile the vct file of visex
    By shridhark in forum Running Windows (or anything else) on your Mac
    Replies: 0
    Last Post: 01-03-2006, 09:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •