Building Cesium-Unreal for VisionOS

I’m currently building Cesium-Unreal to target VisionOS. I have the 2.11.0 release commit cloned and building for iOS.

In updating the CMake toolchain files to support visionOS (adapting the iOS toolchain files) I get errors in triplets with ezckpgg:

~/Library/Application Support/JetBrains/CLion2024.3/scratches
/bin/bash /Users/myUserName/Library/Application\ Support/JetBrains/CLion2024.3/scratches/scratch_1.sh
DriverKit SDKs:
        DriverKit 24.1                  -sdk driverkit24.1

iOS SDKs:
        iOS 18.1                        -sdk iphoneos18.1

iOS Simulator SDKs:
        Simulator - iOS 18.1            -sdk iphonesimulator18.1

macOS SDKs:
        macOS 15.1                      -sdk macosx15.1
        macOS 15.1                      -sdk macosx15.1

tvOS SDKs:
        tvOS 18.1                       -sdk appletvos18.1

tvOS Simulator SDKs:
        Simulator - tvOS 18.1           -sdk appletvsimulator18.1

visionOS SDKs:
        visionOS 2.1                    -sdk xros2.1

visionOS Simulator SDKs:
        Simulator - visionOS 2.1        -sdk xrsimulator2.1

watchOS SDKs:
        watchOS 11.1                    -sdk watchos11.1

watchOS Simulator SDKs:
        Simulator - watchOS 11.1        -sdk watchsimulator11.1

----------------------------------------------
CESIUM_UNREAL_VERSION=v2.11.0
UPLOAD_PACKAGE_BASE_NAME=cesium-unreal
BUILD_CESIUM_UNREAL_PACKAGE_NAME=cesium-unreal-v2.11.0
BUILD_ROOT=/Users/myUserName/dev/cesium-unreal-samples/Plugins/cesium-unreal
----------------------------------------------
Installing nasm...
----------------------------------------------
UNREAL_ENGINE_ROOT=/Users/myUserName/.jenkins/workspace/UnrealEngineSourceBuild
CESIUM_VCPKG_RELEASE_ONLY=TRUE
----------------------------------------------
----------------------------------------------
Building cesium-native for VisionOS...
----------------------------------------------
Creating VisionOS project - Using iOS target
refer to temporary solution - https://github.com/CesiumGS/cesium-unity/pull/502
-- Currently using iOS toolchain settings in visionOS toolchain
-- TODO - Resulting XCode project will need to be retargeted from iOS to VisionOS
-- Using Unreal Engine installation at: /Users/myUserName/.jenkins/workspace/UnrealEngineSourceBuild
-- Debug - Detecting VCPKG
 - CMAKE_SYSTEM_PROCESSOR: arm64
 - CMAKE_OSX_ARCHITECTURES: arm64
 - CMAKE_SYSTEM_NAME: visionOS
-- DETECT-VCPKG-TRIPLET.Cmake: Using iOS for Vision OS builds
-- Debug - Detected VCPKG_TRIPLET set to arm64-visionos
-- Debug - Using DETECTED_VCPKG_TRIPLET
-- Debug - Detecting VCPKG
 - CMAKE_SYSTEM_PROCESSOR: arm64
 - CMAKE_OSX_ARCHITECTURES: arm64
 - CMAKE_SYSTEM_NAME: visionOS
-- DETECT-VCPKG-TRIPLET.Cmake: Using iOS for Vision OS builds
-- Debug - Detected VCPKG_TRIPLET set to arm64-visionos
-- VCPKG_TRIPLET arm64-visionos-unreal
-- VCPKG_OVERLAY_PORTS /Users/myUserName/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern/vcpkg-overlays
-- VCPKG_OVERLAY_TRIPLETS /Users/myUserName/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern/vcpkg-overlays/triplets
-- EZVCPKG v0.1 starting up
        Website: https://github.com/jherico/ezvcpkg
-- EZVCPKG_BASEDIR envrionment variable not found and basedir not set, using default /Users/myUserName/.ezvcpkg
-- EZVCPKG initializing
        commit:     2024.11.16
        repository: https://github.com/microsoft/vcpkg.git
        local dir:  /Users/myUserName/.ezvcpkg/2024.11.16
-- EZVCPKG Building/Verifying package asyncplusplus using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package expected-lite using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package fmt using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package glm using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package rapidjson using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package spdlog using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package stb using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package uriparser using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package abseil using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package draco using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package ktx using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package modp-base64 using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package meshoptimizer using triplet arm64-visionos-unreal
-- EZVCPKG Building/Verifying package openssl using triplet arm64-visionos-unreal
CMake Error at cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:83 (message):
  EZVCPKG failed with error 1
Call Stack (most recent call first):
  cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:184 (EZVCPKG_CHECK_RESULTS)
  cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:276 (EZVCPKG_BUILD)
  cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:290 (EZVCPKG_FETCH_IMPL)
  cesium-native/CMakeLists.txt:67 (ezvcpkg_fetch)


*** The output from the command was:
Computing installation plan...
The following packages will be built and installed:
    openssl:arm64-visionos-unreal@0.0.0 -- /Users/myUserName/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern/vcpkg-overlays/openssl
Unable to determine toolchain use for arm64-visionos-unreal with with CMAKE_SYSTEM_NAME visionos. Did you mean to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?
note: updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

CMake Error at cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:102 (message):
Call Stack (most recent call first):
  cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:184 (EZVCPKG_CHECK_RESULTS)
  cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:276 (EZVCPKG_BUILD)
  cesium-native/cmake/ezvcpkg/ezvcpkg.cmake:290 (EZVCPKG_FETCH_IMPL)
  cesium-native/CMakeLists.txt:67 (ezvcpkg_fetch)

It looks like a very similar issue has been also encountered with Unity by @ChrisHandzlik, with the workaround being to use an iOS toolchain to build the project data with CMake then retarget the resulting Xcode project to VisionOS.

I’m curious if there are any other solutions or is this to date the best way to do this for Unreal engine given it’s CMake rather than Unity directly handling the Cesium-Native compilation.

Hi @dagillespie,

I’m afraid we can’t really advise – we don’t have a Vision Pro to test building on. But if you could share how you updated the files, maybe something obvious will jump out at us?

Hi @janine - no worries at all. I appreciate the question was rather vaguely formulated.

  • This example uses the VRTemplate project which has been converted to a C++ Unreal project configured for VisionOS and has successfully built and run on a VisionPro.

  • After confirming this has worked, I have then cloned the cerium-unreal repo into the project plugins then proceeded to get cesium-native to compile.

Steps for getting unreal-native to compile (the approach @ChrisHandzlik took for Unity through using iOS binaries - please forgive any errors here - CMake is a new beast to me!):

Using the travis CI commands as a basis, I’ve used the following commands to build VisionOS binaries (full version attached):

mkdir -p extern/build-visionos
cd extern
cmake -B build-visionos -S . -GXcode -DCMAKE_TOOLCHAIN_FILE="unreal-visionos-toolchain.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build build-visionOS -j4 --target install --config Release

the toolchain file is:

set(GENERATOR Xcode)
set(CMAKE_SYSTEM_NAME visionOS)
set(CMAKE_OSX_ARCHITECTURES arm64)
set(CMAKE_SYSTEM_PROCESSOR arm64)
set(CMAKE_OSX_DEPLOYMENT_TARGET 2.1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)

then updating detect-vcpkg-triplet.cmake:

elseif (CMAKE_SYSTEM_NAME STREQUAL "visionOS")
    message(STATUS "DETECT-VCPKG-TRIPLET.Cmake: Using iOS for Vision OS builds")
    message(STATUS "refer to similar temporary solution - https://github.com/CesiumGS/cesium-unity/pull/502")
    set(DETECTED_VCPKG_TRIPLET "arm64-ios")

Having run the .sh I was able to build the project and open the editor. Packaging to VisionOS however resulted in the following:

UATHelper: Packaging (VisionOS): RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: 139
PackagingResults: Error: AutomationTool was unable to run successfully. Exited with code: 139
PackagingResults: Error: Unknown Error

I’ve also attached the full log
BuildCommandAndLog.zip (8.0 KB)

I’m also testing my base assumptions first of all with my dev environment by testing first of all that if I use the latest Unreal 5.5 GitHub zipped release 2.11.0 and first of all package to iOS with CesiumForUnreal that this is successful.

In this instance, I am doing the following:

  • Unreal 5.5.1 from Epic Launcher on M3 MacBook Air
  • Creating a VRTemplate project
  • Testing that this builds fine to iOS (it does and took less than 5 mins)
  • Adding CesiumForUnreal 2.11.0 release from github
  • Regenerate project files and compile through Xcode
  • Ensure CesiumForUnreal is enabled
  • Build to iOS

Currently the build to iOS with CesiumForUnreal enabled appears to be hanging compiling vecmath.cpp (1hr + and counting). I’ll be patient and leave this overnight however I wouldn’t have thought that this library would have caused such a long compilation time or be hanging?

UATHelper: Packaging (IOS): [182/188] Compile [arm64] VecMath.cpp

Assuming this packages, I’ll then extend the task to VisionOS as it might be possible to drop the pre-compiled cesium-native pre-compiled binaries into the 2.11.0 release and add a link to these in the relevant build.cs files by adding something along the lines of…

else if(Target.Platform == UnrealTargetPlatform.VisionOS)
{
    platform = "VisionOS-ARM64-";
    libSearchPattern = "lib*.a";
}

Confirming that after 12hrs - iOS build was still stuck compiling VecMath.cpp

Hi @dagillespie,

Thank you for all the details you shared. That’s a weird file for the process to get stuck on. I can’t imagine why it’d get stuck, but our team definitely needs to take a look, since iOS is supposed to be a supported platform.

I’ve opened a Github issue for this so we can formally track the problem. I’ll be sure to leave updates when we get a chance to more deeply investigate. Thank you :pray:

1 Like

Hi @janine - many thanks for having a look into this - hopefully it’s a straightforward fix as first iOS, then I’ll be shifting the problem to VisionOS!

@janine - FYI - I’ve now managed to package the plugin for VisionOS (using iOS binaries) however not surprisingly, I’m still getting that hang compiling VectorMath.cpp