The xPack QEMU RISC-V can be installed automatically, using the xpm
command (the recommended method), or manually, by downloading and unpacking one of the platform specific archives.
The easiest (and recommended) way to install xPack QEMU RISC-V is via xpm and the package available as @xpack-dev-tools/qemu-riscv
from the npmjs.com
registry.
xpm packages, abbreviated as xPacks, are general-purpose, language-neutral software packages. They use the same format as npm packages, which is a collection of files/folders and a package.json
file with the package metadata.
xpm can install source and binary packages. Binary packages include references to regular archives with the platform specific binaries (such as .tar.gz
for Unix or .zip
for Windows). These archives are unpacked and links/forwarders to the executables are created in a .bin
folder.
For more details, please see the previous explanation in the Getting Started page.
PrerequisitesThe only requirement for an automated install is a recent xpm, which is a portable Node.js command line application that complements npm with several extra features specific to C/C++ projects.
To install xpm, follow the instructions in the xpm install page.
If already installed, it is always a good idea to update it to the latest version with:
npm install --location=global xpm@latest
tip
Although not mandated by xpm, it is also a good idea to upgrade npm to the latest version, and node to a reasonably recent version (currently npm requires a node >=18.17.0).
Local installsOne of the xPack design goals is to allow each project to choose the exact versions of the tools it requires.
Similarly to npm being able to install specific versions of the JavaScript tools into each project, xpm was also designed to be able to install specific versions of the required binary tools locally into each project.
Therefore, similarly to the way npm installs the JavaScript packages into node_modules
, xpm installs the binary tools into xpacks
. Here there will be separate folders with the installed packages, for example xpacks/@xpack-dev-tools/qemu-riscv
.
Each such folder includes the package.json
file with the project metadata and a sub-folder .content
with the extracted binary archive. The executables are usually in .content/bin
.
tip
On some platforms, names starting with .
(dot) might be hidden for normal browsing, and seeing them requires separate options (like ls -A
) or, in file browsers, to enable settings like Show Hidden Files.
xpacks/.bin
folder
If multiple binary packages are installed, in order to allow the executables to be accessed, one possible solution is to add all <package>/.content/bin
folders to the PATH
.
To simplify things, npm employs a separate <project>/node_modules/.bin
folder where it places links/forwarders pointing to the actual executable files.
Similarly, xpm adds links/forwarders into a separate <project>/xpacks/.bin
folder.
With this setup, the project needs to prepend only this .bin
folder to the PATH
, and all the required tools are accessible and preferred to possible system tools.
Given that some binary tools (such as toolchains) can be very large (hundreds of megabytes or more), it is impractical to keep multiple copies of these tools, one for each project.
Instead, xpm installs the binary packages only once into a user global store (a platform-dependent folder within the home folder), thereby conserving disk space when the same tools are used across multiple projects.
In order to allow the projects to access the binary tools installed in the user global store, instead of unpacking the archives in xpacks
, xpm adds symbolic links pointing to the user global xPacks store.
The outcome is functionally equivalent to installing the tools into each project, but without the wasted disk space.
tip
It is possible to force a local install into a project by passing --copy
to xpm install
.
if necessary, it is also possible to install packages only globally, without creating local links/forwarders (see below).
The user xPacks cacheTo save download time, all archives are first stored in a cache, and all subsequent downloads are replaced with the cached content.
Therefore all published archives should be read-only and it is not allowed to replace them at a later time.
Initialise the projectUpon initial use, ensure that a package.json
file is present in the project root folder.
This can be achieved by running xpm init
in the desired project folder (substitute my-project
accordingly):
The main purpose of xpm init
is to create a package.json
file, if not already present.
In addition to name
& version
, the minimal package.json
must include a property named xpacks
, even empty. This property is mandatory to identify the package as an xpm package.
Upon initial use, ensure that a package.json
file is present in the project root folder.
This can be achieved by running xpm init
in the desired project folder (substitute my-project
accordingly):
The main purpose of xpm init
is to create a package.json
file, if not already present.
In addition to name
& version
, the minimal package.json
must include a property named xpacks
, even empty. This property is mandatory to identify the package as an xpm package.
The next step is to install the qemu-riscv package into the project.
The command to install the latest available version of qemu-riscv is:
xpm install @xpack-dev-tools/qemu-riscv@latest --verbose
To install a specific version, specify it explicitly:
xpm install @xpack-dev-tools/qemu-riscv@8.2.6-1.1 --verbose
The main result is a set of forwarders in the .bin
folder:
With all binary tools installed in xpacks/.bin
, the project build configurations need only a single PATH adjustment:
export PATH=<...project-path...>/xpacks/.bin:$PATH
tip
This syntax is for the Git Bash console. When using COMMAND.EXE or Power Shell, adjust the syntax for the corresponding Windows specific shell.
The main result is a set of links in the .bin
folder:
With all binary tools installed in xpacks/.bin
, the project build configurations need only a single PATH adjustment:
export PATH=<...project-path...>/xpacks/.bin:$PATH
The main result is a set of links in the .bin
folder:
With all binary tools installed in xpacks/.bin
, the project build configurations need only a single PATH adjustment:
export PATH=<...project-path...>/xpacks/.bin:$PATH
Installation details
The above xpm install
command will do the following:
identify the platform specific archive for the desired version of @xpack-dev-tools/qemu-riscv, download it into a cache and unpack it into a versioned folder in the user's global xPacks store (if not already there); check the output of the xpm install
command for the actual folder used on your platform;
create a local symbolic link like xpacks/@xpack-dev-tools/qemu-riscv
pointing to the versioned folder in the user's global xPacks store
add links/forwarders into the local xpacks/.bin
folder, referring to the binaries in xpacks/@xpack-dev-tools/qemu-riscv/.content/bin
;
add @xpack-dev-tools/qemu-riscv
to package.json
as a development dependency; this associates a specific version of the xPack QEMU RISC-V with the current project (details below).
tip
The install location can be configured using the XPACKS_STORE_FOLDER
environment variable; for more details please check the xpm folders page.
devDependencies
To ensure reproducibility, it is essential for each project to always use the exact desired versions of the required tools, regardless of the tools installed in the system.
To achieve this goal, xpm records all locally installed binary packages as development dependencies in the project package.json
file.
The result looks like this:
"xpack": {
"minimumXpmRequired": "0.20.7",
"dependencies": {},
"devDependencies": {
"@xpack-dev-tools/qemu-riscv": {
"specifier": "8.2.6-1.1",
"local": "link",
"platforms": "all"
}
},
"properties": {},
"actions": {},
"buildConfigurations": {}
}
If the package.json
is saved in the revision system, the above definition acts as a hard reference to the specific version of the xPack QEMU RISC-V.
After cloning the project into a different location, the command xpm install
can be used to install all development dependencies.
This is particularly useful for CI/CD environments.
Install globallyFor older development environments, it is also possible to install xPack QEMU RISC-V only globally in the user's global xPacks store, without any local links/forwarders; it is the developer's responsibility to configure the path to the tools.
No other files are installed in any system folders or other locations.
xpm install @xpack-dev-tools/qemu-riscv@latest --global --verbose
note
Installing packages locally into a project always installs the packages in the user's global xPacks store; subsequent attempts to install the packages globally will fail with already installed.
PATH setupIn order to access the xPack QEMU RISC-V binaries installed in the user's global xPacks store, the project build configurations need a PATH adjustment:
export PATH=$HOME/AppData/Roaming/xPacks/xpack-dev-tools/qemu-riscv/8.2.6-1.1/.content/bin:$PATH
tip
When not using the Git console, adjust the syntax for the corresponding shell.
export PATH=$HOME/Library/xPacks/xpack-dev-tools/qemu-riscv/8.2.6-1.1/.content/bin:$PATH
export PATH=$HOME/.local/xPacks/xpack-dev-tools/qemu-riscv/8.2.6-1.1/.content/bin:$PATH
Uninstall
The xpm binaries do not use any form of system installer; instead they are distributed as portable (.zip
or .tar.gz
) archives; therefore they do not require to run any uninstaller; simply removing the links and possibly the user's global xPacks store folder and the user xPack cache folder is enough.
To remove the links created by xpm in the current project, go to the project folder:
and ask xpm to uninstall the package:
xpm uninstall @xpack-dev-tools/qemu-riscv --verbose
To completely remove the package from the user's global xPacks store:
xpm uninstall --global @xpack-dev-tools/qemu-riscv --verbose
Clean-ups
For a thorough clean-up, please note that xpm uses only two folders:
%APPDATA%\Roaming\xPacks
%APPDATA%\Local\Caches\xPacks
${HOME}/Library/xPacks
${HOME}/Library/Caches/xPacks
${HOME}/.local/xPacks
${HOME}/.cache/xPacks
They can be removed at any time and space reclaimed; xpm will recreate them on new installs.
However, projects linking to the user's global xPacks store will fail with broken paths.
Quick testTo check if the xPack QEMU RISC-V installed by xpm starts properly, use something like:
C:\> %USERPROFILE%\AppData\Roaming\xPacks\@xpack-dev-tools\qemu-riscv\8.2.6-1.1\.content\bin\qemu-system-riscv32.exe --version
xPack QEMU emulator version 8.2.6
% ~/Library/xPacks/@xpack-dev-tools/qemu-riscv/8.2.6-1.1/.content/bin/qemu-system-riscv32 --version
xPack QEMU emulator version 8.2.6
$ ~/.local/xPacks/@xpack-dev-tools/qemu-riscv/8.2.6-1.1/.content/bin/qemu-system-riscv32 --version
xPack QEMU emulator version 8.2.6
note
The reported version is the upstream version, which is shorter than the xPack version, as the latter requires more digits to identify the releases.
Manual installFor all platforms, the xPack QEMU RISC-V binaries are released as portable archives that can be installed in any location.
The archives can be downloaded from the GitHub Releases pages.
Download & unpackThe Windows versions of xPack QEMU RISC-V are packed as .zip
files. Download the latest version named like:
xpack-qemu-riscv-8.2.6-1-win32-x64.zip
note
In case you wonder where the suffix comes from, it is exactly the Node.js process.platform
and process.arch
. The win32
part is confusing, but we have to live with it.
To manually install the xPack QEMU RISC-V, unpack the archive and move it to a location of your choice.
The recommended location is the %USERPROFILE%\AppData\Roaming\xPacks\qemu-riscv
folder, for example C:\Users\ilg\AppData\Roaming\xPacks\qemu-riscv\xpack-qemu-riscv-8.2.6-1
.
note
According to Microsoft, AppData\Roaming
is the recommended location for installing user specific packages.
The macOS versions of xPack QEMU RISC-V are packed as .tar.gz
archives. Download the latest version named like:
xpack-qemu-riscv-8.2.6-1-darwin-x64.tar.gz
xpack-qemu-riscv-8.2.6-1-darwin-arm64.tar.gz
note
In case you wonder where the suffix comes from, it is exactly the Node.js process.platform
and process.arch
.
To manually install the xPack QEMU RISC-V, unpack the archive and move it to a location of your choice.
The recommended location is the ~/Library/xPacks/qemu-riscv
folder, for example /Users/ilg/Library/xPacks/qemu-riscv/xpack-qemu-riscv-8.2.6-1
:
mkdir -p ~/Library/xPacks/qemu-riscv
cd ~/Library/xPacks/qemu-riscv
tar xvf ~/Downloads/xpack-qemu-riscv-8.2.6-1-darwin-x64.tar.gz
chmod -R -w xpack-qemu-riscv-8.2.6-1
The GNU/Linux versions of xPack QEMU RISC-V are packed as .tar.gz
archives. Download the latest version named like:
xpack-qemu-riscv-8.2.6-1-linux-x64.tar.gz
xpack-qemu-riscv-8.2.6-1-linux-arm64.tar.gz
note
In case you wonder where the suffix comes from, it is exactly the Node.js process.platform
and process.arch
.
To manually install the xPack QEMU RISC-V, unpack the archive and move it to a location of your choice.
The recommended location is the ~/.local/xPacks/qemu-riscv
folder, for example /home/ilg/.local/xPacks/qemu-riscv/xpack-qemu-riscv-8.2.6-1
:
mkdir -p ~/.local/xPacks/qemu-riscv
cd ~/.local/xPacks/qemu-riscv
tar xvf ~/Downloads/xpack-qemu-riscv-8.2.6-1-linux-x64.tar.gz
chmod -R -w xpack-qemu-riscv-8.2.6-1
info
For manual installs, the recommended install location is slightly different then the folders created by xpm install
, which use the @xpack-dev-tools
scope to group different tools, and .content
to store the unpacked archive.
To check if the xPack QEMU RISC-V installed manually starts properly, use something like:
C:\> %USERPROFILE%\AppData\Roaming\xPacks\qemu-riscv\xpack-qemu-riscv-8.2.6-1\bin\qemu-system-riscv32.exe --version
xPack QEMU emulator version 8.2.6
% ~/Library/xPacks/qemu-riscv/xpack-qemu-riscv-8.2.6-1/bin/qemu-system-riscv32 --version
xPack QEMU emulator version 8.2.6
$ ~/.local/xPacks/qemu-riscv/xpack-qemu-riscv-8.2.6-1/bin/qemu-system-riscv32 --version
xPack QEMU emulator version 8.2.6
note
The reported version is the upstream version, which is shorter than the xPack version, as the latter requires more digits to identify the releases.
Folders hierarchyAfter install, the package creates a hierarchy of folders like the following (only the first two depth levels are shown):
C:> tree /f %USERPROFILE%\AppData\Roaming\xPacks\@xpack-dev-tools\qemu-riscv\8.2.6-1\.content
Folder PATH listing
Volume serial number is B02D-925C
├── README.md
├── bin
│ ├── SDL2.dll
│ ├── SDL2_image.dll
│ ├── libffi-8.dll
│ ├── libgio-2.0-0.dll
│ ├── libglib-2.0-0.dll
│ ├── libgmodule-2.0-0.dll
│ ├── libgmp-10.dll
│ ├── libgobject-2.0-0.dll
│ ├── libhogweed-6.dll
│ ├── libintl-8.dll
│ ├── libjpeg-9.dll
│ ├── liblzo2-2.dll
│ ├── libnettle-8.dll
│ ├── libpcre2-8-0.dll
│ ├── libpixman-1-0.dll
│ ├── libssp-0.dll
│ ├── libwinpthread-1.dll
│ ├── libzstd.dll
│ ├── qemu-system-riscv32.exe
│ ├── qemu-system-riscv32w.exe
│ ├── qemu-system-riscv64.exe
│ └── qemu-system-riscv64w.exe
├── distro-info
│ └── licenses
├── include
│ ├── fdt.h
│ ├── libfdt.h
│ ├── libfdt_env.h
│ └── qemu-plugin.h
├── lib
│ ├── libfdt.a
│ ├── libqemu_plugin_api.a
│ └── pkgconfig
└── share
├── QEMU,cgthree.bin
├── QEMU,tcx.bin
├── applications
├── bamboo.dtb
├── bios-256k.bin
├── bios-microvm.bin
├── bios.bin
├── canyonlands.dtb
├── edk2-licenses.txt
├── efi-e1000.rom
├── efi-e1000e.rom
├── efi-eepro100.rom
├── efi-ne2k_pci.rom
├── efi-pcnet.rom
├── efi-rtl8139.rom
├── efi-virtio.rom
├── efi-vmxnet3.rom
├── hppa-firmware.img
├── icons
├── keymaps
├── kvmvapic.bin
├── linuxboot.bin
├── linuxboot_dma.bin
├── multiboot.bin
├── multiboot_dma.bin
├── npcm7xx_bootrom.bin
├── openbios-ppc
├── openbios-sparc32
├── openbios-sparc64
├── opensbi-riscv32-generic-fw_dynamic.bin
├── opensbi-riscv64-generic-fw_dynamic.bin
├── palcode-clipper
├── petalogix-ml605.dtb
├── petalogix-s3adsp1800.dtb
├── pvh.bin
├── pxe-e1000.rom
├── pxe-eepro100.rom
├── pxe-ne2k_pci.rom
├── pxe-pcnet.rom
├── pxe-rtl8139.rom
├── pxe-virtio.rom
├── qboot.rom
├── qemu-nsis.bmp
├── qemu_vga.ndrv
├── s390-ccw.img
├── s390-netboot.img
├── skiboot.lid
├── slof.bin
├── trace-events-all
├── u-boot-sam460-20100605.bin
├── u-boot.e500
├── vgabios-ati.bin
├── vgabios-bochs-display.bin
├── vgabios-cirrus.bin
├── vgabios-qxl.bin
├── vgabios-ramfb.bin
├── vgabios-stdvga.bin
├── vgabios-virtio.bin
├── vgabios-vmware.bin
├── vgabios.bin
├── vof-nvram.bin
└── vof.bin
10 directories, 88 files
$ tree -L 2 ~/Library/xPacks/@xpack-dev-tools/qemu-riscv/8.2.6-1/.content/
/Users/ilg/Library/xPacks/@xpack-dev-tools/qemu-riscv/8.2.6-1/.content/
├── README.md
├── bin
│ ├── qemu-system-riscv32
│ └── qemu-system-riscv64
├── distro-info
│ └── licenses
├── include
│ ├── fdt.h
│ ├── libfdt.h
│ ├── libfdt_env.h
│ └── qemu-plugin.h
├── lib
│ ├── libfdt.a
│ └── pkgconfig
├── libexec
│ ├── libbz2.1.0.8.dylib
│ ├── libcrypto.1.1.dylib
│ ├── libffi.8.dylib
│ ├── libgio-2.0.0.dylib
│ ├── libglib-2.0.0.dylib
│ ├── libgmodule-2.0.0.dylib
│ ├── libgmp.10.dylib
│ ├── libgobject-2.0.0.dylib
│ ├── libhogweed.6.8.dylib
│ ├── libhogweed.6.dylib -> libhogweed.6.8.dylib
│ ├── libiconv.2.dylib
│ ├── libintl.8.dylib
│ ├── libjpeg.9.dylib
│ ├── liblzo2.2.dylib
│ ├── libncursesw.6.dylib
│ ├── libnettle.8.8.dylib
│ ├── libnettle.8.dylib -> libnettle.8.8.dylib
│ ├── libpcre2-8.0.dylib
│ ├── libpixman-1.0.dylib
│ ├── libpng16.16.dylib
│ ├── libssh.4.9.6.dylib
│ ├── libssh.4.dylib -> libssh.4.9.6.dylib
│ ├── libusb-1.0.0.dylib
│ ├── libvdeplug.3.dylib
│ ├── libz.1.3.1.dylib
│ ├── libz.1.dylib -> libz.1.3.1.dylib
│ ├── libzstd.1.5.5.dylib
│ └── libzstd.1.dylib -> libzstd.1.5.5.dylib
└── share
├── applications
├── icons
└── qemu
12 directories, 36 files
$ tree -L 2 ~/.local/xPacks/@xpack-dev-tools/qemu-riscv/8.2.6-1/.content/
/home/ilg/.local/xPacks/@xpack-dev-tools/qemu-riscv/8.2.6-1/.content/
├── README.md
├── bin
│ ├── qemu-system-riscv32
│ └── qemu-system-riscv64
├── distro-info
│ └── licenses
├── include
│ ├── fdt.h
│ ├── libfdt.h
│ ├── libfdt_env.h
│ └── qemu-plugin.h
├── lib
│ └── x86_64-linux-gnu
├── libexec
│ ├── libSDL2-2.0.so.0 -> libSDL2-2.0.so.0.3000.1
│ ├── libSDL2-2.0.so.0.3000.1
│ ├── libSDL2_image-2.0.so.0 -> libSDL2_image-2.0.so.0.800.2
│ ├── libSDL2_image-2.0.so.0.800.2
│ ├── libcrypto.so.1.1
│ ├── libffi.so.8 -> libffi.so.8.1.4
│ ├── libffi.so.8.1.4
│ ├── libgio-2.0.so.0 -> libgio-2.0.so.0.8000.0
│ ├── libgio-2.0.so.0.8000.0
│ ├── libglib-2.0.so.0 -> libglib-2.0.so.0.8000.0
│ ├── libglib-2.0.so.0.8000.0
│ ├── libgmodule-2.0.so.0 -> libgmodule-2.0.so.0.8000.0
│ ├── libgmodule-2.0.so.0.8000.0
│ ├── libgmp.so.10 -> libgmp.so.10.5.0
│ ├── libgmp.so.10.5.0
│ ├── libgobject-2.0.so.0 -> libgobject-2.0.so.0.8000.0
│ ├── libgobject-2.0.so.0.8000.0
│ ├── libhogweed.so.6 -> libhogweed.so.6.8
│ ├── libhogweed.so.6.8
│ ├── libiconv.so.2 -> libiconv.so.2.6.1
│ ├── libiconv.so.2.6.1
│ ├── libjpeg.so.9 -> libjpeg.so.9.6.0
│ ├── libjpeg.so.9.6.0
│ ├── liblzo2.so.2 -> liblzo2.so.2.0.0
│ ├── liblzo2.so.2.0.0
│ ├── libncursesw.so.6 -> libncursesw.so.6.4
│ ├── libncursesw.so.6.4
│ ├── libnettle.so.8 -> libnettle.so.8.8
│ ├── libnettle.so.8.8
│ ├── libpcre2-8.so.0 -> libpcre2-8.so.0.12.0
│ ├── libpcre2-8.so.0.12.0
│ ├── libpixman-1.so.0 -> libpixman-1.so.0.43.4
│ ├── libpixman-1.so.0.43.4
│ ├── libpng16.so.16 -> libpng16.so.16.43.0
│ ├── libpng16.so.16.43.0
│ ├── libresolv-2.27.so
│ ├── libresolv.so.2 -> libresolv-2.27.so
│ ├── libssh.so.4 -> libssh.so.4.9.6
│ ├── libssh.so.4.9.6
│ ├── libssp.so.0 -> libssp.so.0.0.0
│ ├── libssp.so.0.0.0
│ ├── libudev.so.1 -> libudev.so.1.6.9
│ ├── libudev.so.1.6.9
│ ├── libusb-1.0.so.0 -> libusb-1.0.so.0.4.0
│ ├── libusb-1.0.so.0.4.0
│ ├── libvdeplug.so.3 -> libvdeplug.so.3.0.1
│ ├── libvdeplug.so.3.0.1
│ ├── libz.so.1 -> libz.so.1.3.1
│ ├── libz.so.1.3.1
│ ├── libzstd.so.1 -> libzstd.so.1.5.5
│ └── libzstd.so.1.5.5
└── share
├── applications
├── icons
└── qemu
11 directories, 58 files
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4