Compiling from source - stakira/OpenUtau GitHub Wiki

Compiling OpenUtau from source

Compiling OpenUtau can be done easily.

Prerequisites

You will need the .NET 6.0 SDK.

For Windows and Mac you can get it here

On Ubuntu, Debian, or any derivatives (e.g. Linux Mint):

sudo apt install dotnet-sdk-6.0

On an Arch-based distro:

sudo pacman -S dotnet-sdk

For other instructions see the link above.

You will also neet Git. Windows | Mac | Linux

Download source code

Once you have the prerequisites set up, run the following command to clone the repository

git clone https://github.com/stakira/OpenUtau.git

Building in Visual Studio

Visual Studio is an IDE for .NET that supports Windows.

Download and install Visual Studio Community 2022 from Visual Studio Official Website. Choose ".NET Desktop Development" workload when installing.

Open "OpenUtau.sln" with Visual Studio.

Choose "OpenUtau" and click the green ▶ icon to run.

Building in Visual Studio Code

Visual Studio Code (aka. VSCode) is a lightweight code editor that supports Windows, MacOS and Linux.

Download and install VSCode from VSCode official website

Launch VSCode, search and install the C# extension.

image

Open the directory where you've downloaded the source code of OpenUtau and open any .cs file. A notification saying "Required assets to build and debug are missing from 'OpenUtau'. Add them?" will pop up. Click "Yes".

image

Open .vscode/launch.json, change the "OpenUtau.dll" to the executable file name on your OS, like "OpenUtau.exe" on windows.

image

Click "Run → Start Debugging"

Building in GitHub Codespaces

GitHub Codespaces is an online linux environment provided by GitHub with a vscode webui. Users can access to GitHub Codespaces from any device with a browser.

On OpenUtau's repo page, click "Code → Codespaces → +"

image

Open any .cs file under the OpenUtau folder, and click the Debug button

image

Ports → Add Port → input 6080 → Open In Browser

image

In the noVNC page poped up, connect → input vscode

image

Successfully connected to the remote desktop of GitHub Codespaces.

image

Building from command line

Navigate to the directory via command line

cd OpenUtau

And finally, to compile, run the following commands:

dotnet restore OpenUtau

dotnet build OpenUtau

The executable files will be in the directory OpenUtau/OpenUtau/bin/Debug/net6.0

Building worldline

Worldline is the c++ part of OpenUtau.

  1. Install Bazelisk
  2. In commond line, cd to cpp folder
  3. Run bazelisk build //worldline to build .dll on Windows, .dylib on macOS or .so on Linux. You can also run bazelisk build //worldline:main to build a executable version, though curve expressions won't be available.

Notes:

  • On Windows omits // in commands.
  • Recommends Visual Studio Code to leverage IntelliSense.
  • If Bazel ever freezes on Windows, open up Task Manager and kill the Java process.
  • bazelisk clean cleans up build cache.
  • bazelisk clean --expunge cleans up build cache and dependencies.

Debugging worldline in visual studio

  1. Build worldline with bazelisk build worldline -c dbg
  2. Copy the compiled dll and pdb (in <path to your openutau repo>\cpp\bazel-out\x64_windows-dbg\bin\worldline) into runtimes\win-x64\native
  3. In visual studio, open OpenUtau.sln, right click on the OpenUtau project -> properties -> Debug -> Open debug launch profiles UI -> enable native code debugging
  4. In visual studio, debug -> options -> debugging -> symbols, add <path to your openutau repo>\cpp\bazel-out\x64_windows-dbg\bin\worldline
  5. run

Testing pull requests from other developer

  1. navigate to your openutau development folder
  2. git stash to save any uncommitted changes
  3. git fetch https://github.com/{author}/OpenUtau {branch}; git checkout FETCH_HEAD, replacing {author} and {branch} with the author and branch you want to test(e.g. git fetch https://github.com/lennyservant/OpenUtau improve-classic-pitch-timing; git checkout FETCH_HEAD)
  4. open visual studio, build and run

You can find the author and branch name in the pull request on github, which usually have a line with the format author:branch just below the pull request title

After testing, you can switch back to your branch and pop/apply your stashed changes through visual studio (menu -> view -> git changes), or you can type git checkout {branch} to switch branches and git stash pop to pop stashed changes