Posted on Leave a comment

Building BugVM

One needs a Mac running macOS 10.14. Download and install Java SE JDK 8 from Oracle. Make sure $JAVA_HOME is set properly by editing ~/.bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)

Install Xcode from the Mac App Store.
Use xcode-select command line tool to select correct Xcode if there are multiple versions of Xcode.

xcode-select -s /Applications/
xcode-select -s /Applications/OtherVersion/

Installing Xcode Command Line Tools

xcode-select --install

You may need to install cmake, pkg-config, openssl if this is first time.

brew install pkg-config
brew install cmake
brew install openssl

Install any other missing components your build systems may complain about.
Clone GitHub repo.

git clone bvm
cd bvm

BugVM uses Gradle build system. Little or no knowledge of Gradle is required to build BugVM. There is nothing you need to install or configure. Just simple one command line is all you need.

./gradlew all

Note: Gradle will self-configure and download necessary things from the Internet. It takes a few hours to complete all the build processes.

Building BugVM on Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-38-generic x86_64)

One may need:

apt -y install make
apt -y install cmake
apt -y install g++
apt -y install g++-multilib
apt -y install clang
apt -y install libcap-dev
apt -y install libxml2-dev
apt -y install zlib1g-dev
apt -y install openjdk-8-jdk

Clone GitHub and Build

git clone bvm
cd bvm
./gradlew all
./gradlew install

Sample HelloWorld Console App

git clone bcon
cd bcon/helloworld

Sample iOS Apps

git clone bios
Button App
cd bios/button
./gradlew sim
WebView App
cd bios/webview
./gradlew sim

Using Gradle Plugin


buildscript {
    ext {
        bugvm_version = "1.2.9"
        kotlin_version = "1.2.40"
    repositories {
    dependencies {
        classpath "com.bugvm:bugvm-gradle:$bugvm_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
apply plugin: "bugvm"
apply plugin: "kotlin"
kotlin {
    experimental {
        coroutines "enable"
compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
repositories {
dependencies {
    compile "com.bugvm:bugvm-rt:$bugvm_version"
    compile "com.bugvm:bugvm-apple:$bugvm_version"
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3"
task sim {
    dependsOn launchIPhoneSimulator, build, clean
    launchIPhoneSimulator.mustRunAfter build
    build.mustRunAfter clean
task pad {
    dependsOn launchIPadSimulator, build, clean
    launchIPadSimulator.mustRunAfter build
    build.mustRunAfter clean
task dev {
    dependsOn launchIOSDevice, build, clean
    launchIOSDevice.mustRunAfter build
    build.mustRunAfter clean
task dist {
    dependsOn createIPA
    doLast {
        println "The IPA should be in build/bugvm directory."
In order to install to device or to package for the app store, one needs to follow Apple's
signing requirements. Easy way to setup signing and all is to create a sample iOS project
with Xcode. Xcode will advise you if something is missing or not correct.
Once Xcode can build and upload to the iTunes Connect, all setup is good.
gradle.taskGraph.whenReady { graph ->
    if (graph.hasTask(dev)) {
        bugvm.iosSignIdentity = "iPhone Developer"
    } else
    if (graph.hasTask(dist)) {
        bugvm.iosSignIdentity = "iPhone Distribution"

Gradle Tasks

Launch to iPhone Simulator

./gradlew sim

Launch to iPad Simulator

./gradlew pad

Install to Device

./gradlew dev

Create App for App Store Distribution

./gradlew dist
Leave a Reply

Your email address will not be published. Required fields are marked *