Search code examples
macosmonomkbundle

Mono mkbundle on Mac OS X 10.7


I'm trying to get the mkbundle tool working on Mac OS X 10.7. I installed XCode 5, a handful of different Mono versions, going from v2 to v4. Everytime I try to compile my code I get a

sh: as: command not found

When I try to find this command, its not on my system either. After googling, which is pretty hard as "as" is filtered out for being too generic, I simply cannot find a solution to this. The best resource I can find states its the native compiler of XCode, but I have that installed...

Could someone assist?


Solution

  • You are looking for the Xcode assembler:

    > man as

    NAME
           as - Mac OS X Mach-O GNU-based assemblers
    
    SYNOPSIS
           as [ option ...  ] [ file ...  ]
    
    DESCRIPTION
           The as command translates assembly code in the named files to object code.
           If no files are specified, as reads from stdin.  All undefined symbols  in
           the assembly are treated as global.  The output of the assembly is left in
           the file a.out by default.
    
           The program /usr/bin/as is actually a driver that executes assemblers  for
           specific target architectures.  If no target architecture is specified, it
           defaults to the architecture of the host it is running on.
    

    Do you have Xcode and it's cmd line tools installed?

    > which as 
    /usr/bin/as
    
    > file `which as`
    /usr/bin/as: Mach-O 64-bit executable x86_64
    

    Located in Xcode.app:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/x86_64/as
    

    Xcode cmd-line tools:

    Assuming you have installed the 'free' Xcode package via the App store, the cmd line tools can be installed via "xcode-select". Drop into a term window and:

    xcode-select --help

    Usage: xcode-select [options]
    
    Print or change the path to the active developer directory. This directory
    controls which tools are used for the Xcode command line tools (for example,
    xcodebuild) as well as the BSD development commands (such as cc and make).
    
    Options:
      -h, --help                  print this help message and exit
      -p, --print-path            print the path of the active developer directory
      -s <path>, --switch <path>  set the path for the active developer directory
      --install                   open a dialog for installation of the command line developer tools
      -v, --version               print the xcode-select version
      -r, --reset                 reset to the default command line tools path
    

    xcode-select --install

    Once installed, you will get updates via the App Store