Hosts/Mac: Difference between revisions

From QEMU
(Add example)
(Add list of available machines)
Line 29: Line 29:
After downloading the QEMU source code, double-click it to expand it.
After downloading the QEMU source code, double-click it to expand it.


Then configure and make QEMU:
Then configure and make QEMU. The target-list option is used to build only the machine or machines you want. If you don't specify it, all machines would be built. Probably not what you want.
 
  ./configure --target-list=<list of machines here>
  ./configure --target-list=<list of machines here>
  make
  make
Line 41: Line 40:


   ./configure --target-list=i386-softmmu,ppc-softmmu && make ; say "I'm all done compiling QEMU"
   ./configure --target-list=i386-softmmu,ppc-softmmu && make ; say "I'm all done compiling QEMU"
You can use './configure --help' to see a full list of options.
Here are all the currently available machines:
<ul>
<li>aarch64-softmmu</li>
<li>alpha-softmmu</li>
<li>arm-softmmu</li>
<li>cris-softmmu</li>
<li>i386-softmmu</li>
<li>lm32-softmmu</li>
<li>m68k-softmmu</li>
<li>microblaze-softmmu</li>
<li>microblazeel-softmmu</li>
<li>mips-softmmu</li>
<li>mips64-softmmu</li>
<li>mips64el-softmmu</li>
<li>mipsel-softmmu</li>
<li>moxie-softmmu</li>
<li>or32-softmmu</li>
<li>ppc-softmmu</li>
<li>ppc64-softmmu</li>
<li>ppcemb-softmmu</li>
<li>s390x-softmmu</li>
<li>sh4-softmmu</li>
<li>sh4eb-softmmu</li>
<li>sparc-softmmu</li>
<li>sparc64-softmmu</li>
<li>tricore-softmmu</li>
<li>unicore32-softmmu</li>
<li>x86_64-softmmu</li>
<li>xtensa-softmmu</li>
<li>xtensaeb-softmmu</li>
</ul>


If you have a recent version of Mac OS X (OS X 10.7 or better with Xcode 4.2 or better) we recommend building QEMU with the -default compiler provided by Apple, for your version of Mac OS X (which will be 'clang'). The configure script will automatically pick this.
If you have a recent version of Mac OS X (OS X 10.7 or better with Xcode 4.2 or better) we recommend building QEMU with the -default compiler provided by Apple, for your version of Mac OS X (which will be 'clang'). The configure script will automatically pick this.

Revision as of 17:32, 23 November 2016

QEMU on OS X (macOS) hosts

While QEMU's main host platform is Linux, it is also supported on operating systems for Apple's Mac computers (known as OS X or macOS).

Please note that less developers work on QEMU for Mac hosts, so it might be less stable (but I don't think it is).

Some system emulations on Linux use KVM, a special emulation mode which claims to reach nearly native speed. KVM is mainly used for x86 (32 and 64 bit) emulation on x86 hosts running Linux. There exists a port of QEMU to Hypervisor.framework (a kernel module from Apple which is similar in spirit to KVM), but unfortunately it is not included in upstream QEMU.

Building QEMU for OS X

The system requirements are:

  • OS X 10.5 or higher
  • The clang compiler shipped with Xcode 4.2 or higher, or GCC 4.3 or higher

Additional build requirements are:

You may find it easiest to get these from a third-party packager such as Homebrew, Macports, or Fink.

After downloading the QEMU source code, double-click it to expand it.

Then configure and make QEMU. The target-list option is used to build only the machine or machines you want. If you don't specify it, all machines would be built. Probably not what you want.

./configure --target-list=<list of machines here>
make

This way doesn't require you to wait for the configure command to complete:

./configure --target-list=<list of machines here> && make

If your system has the 'say' command, you can use it to tell you when QEMU is done

 ./configure --target-list=i386-softmmu,ppc-softmmu && make ; say "I'm all done compiling QEMU"

You can use './configure --help' to see a full list of options.

Here are all the currently available machines:

  • aarch64-softmmu
  • alpha-softmmu
  • arm-softmmu
  • cris-softmmu
  • i386-softmmu
  • lm32-softmmu
  • m68k-softmmu
  • microblaze-softmmu
  • microblazeel-softmmu
  • mips-softmmu
  • mips64-softmmu
  • mips64el-softmmu
  • mipsel-softmmu
  • moxie-softmmu
  • or32-softmmu
  • ppc-softmmu
  • ppc64-softmmu
  • ppcemb-softmmu
  • s390x-softmmu
  • sh4-softmmu
  • sh4eb-softmmu
  • sparc-softmmu
  • sparc64-softmmu
  • tricore-softmmu
  • unicore32-softmmu
  • x86_64-softmmu
  • xtensa-softmmu
  • xtensaeb-softmmu


If you have a recent version of Mac OS X (OS X 10.7 or better with Xcode 4.2 or better) we recommend building QEMU with the -default compiler provided by Apple, for your version of Mac OS X (which will be 'clang'). The configure script will automatically pick this.

Errors on old compilers

Note: If after the configure step you see a message like this:

ERROR: Your compiler does not support the __thread specifier for
       Thread-Local Storage (TLS). Please upgrade to a version that does.

you may have to install your own version of gcc. You can build it from source (expect that to take several hours) or obtain third party binaries of gcc available from Homebrew or MacPorts.

You can have several versions of GCC on your system. To specify a certain version, use the --cc and --cxx options.

./configure --cxx=<path of your c++ compiler> --cc=<path of your c compiler> <other options>