Installing RISC-V QEMU on macOS Mojave

In my ongoing book project, I have decided to change architecture, from OpenRISC to RISC-V.

My main motivation (yes, you might want to call it procrastination), is to be more aligned with current topics, and to have access to a broader range of reference material.

As a first step, I wanted to run on my macOS Mojave computer (later on, I should also use Ubuntu).

I downloaded QEMU using Git, as

git clone
cd qemu
git submodule init
git submodule update --recursive

Configure was done, as

mkdir objdir
cd objdir
../configure --target-list=riscv32-softmmu --prefix=/Users/$USER/qemu_riscv

This resulted in an error, as

ERROR: pkg-config binary 'pkg-config' not found 

I guessed (based on earlier Mac experiences) that I could have use of brew. From the Homebrew page, I learned how to install brew, as

/usr/bin/ruby -e "$(curl -fsSL"

I did this, and then tried to install pkg-config, as

brew install pkg-config

Trying the configure command again, as

../configure --target-list=riscv32-softmmu --prefix=/Users/$USER/qemu_riscv

resulted in the error message

ERROR: glib-2.40 gthread-2.0 is required to compile QEMU

I guessed that brew could help me also here, so I tried

brew install glib

The configure command now gave

ERROR: pixman >= 0.21.8 not present.
       Please install the pixman devel package.

Continuing with brew, as

brew install pixman

resulted in a successful configure command.

I tried building, using

make -j

which finished with errors, as

clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable
make: *** [util/drm.o] Error 1
make: *** Waiting for unfinished jobs....
  CC      util/guest-random.o
clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable
make: *** [util/qsp.o] Error 1

Using a sequential make, as


resulted in a successful build.

I could then install QEMU, by doing

make install

As a sanity check of the installation, I did

Olas-MacBook:objdir ola$ /Users/ola/qemu_riscv/bin/qemu-system-riscv32 --help | head
QEMU emulator version 4.0.90 (v4.1.0-rc0)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
usage: qemu-system-riscv32 [options] [disk_image]

'disk_image' is a raw hard disk image for IDE hard disk 0

Standard options:
-h or -help     display this help and exit
-version        display version information and exit
-machine [type=]name[,prop[=value][,...]]

About Ola
Developer and writer -- creating Layered Books ( -- with books on programming and embedded systems - published a thriller at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: