depthai-core icon indicating copy to clipboard operation
depthai-core copied to clipboard

[BUG/v3_develop] macOS Sequoia 15.4.1 depthai-core build failure (w/some resolution approaches)

Open marc-medley opened this issue 6 months ago • 5 comments

Describe Issue

A cmake v3_develop branch snapshot was found to build OK on a Raspberry Pi OS (Debian) RPi5 when using mkdir build && cd build followed by cmake -S .. -B .. However, the same snapshot failed to build with a current macOS 15.4.1 / Xcode 16.3 / Apple clang version 17.0.0 (clang-1700.0.13.3) toolchain.

Steps were then taken to achieve a successful macOS 15.4.1 build. The steps for a successful build are outlined in the Additional Context section. Also, the successfully built snapshot is provided on the v3_develop_macos15 branch of the marc-medley/depthai-core fork.

Minimal Reproducible Example

Configuration:

Use a macOS with an up-to-date toolchain. In this case, a macOS 15.4.1 / Xcode 16.3 / Apple clang version 17.0.0 (clang-1700.0.13.3) toolchain was used.

xcrun --sdk macosx --show-sdk-path
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk
xcrun --sdk macosx --show-sdk-version
# 15.4

Steps:

brew uninstall clang-format
brew install opencv pcl 

git clone --single-branch \
    --branch v3_develop \
    --recurse-submodules \
    [email protected]:luxonis/depthai-core.git \
    depthai_v3_develop
cd depthai_v3_develop

mkdir build && cd build
cmake -S .. -B . \
    -D'CMAKE_POLICY_VERSION_MINIMUM=3.5'

NUM_CORES=$(sysctl -n hw.ncpu) # optional
cmake --build .  --parallel $NUM_CORES

After the blocking "Running vcpkg install - failed" and xtensor+xtl build issues were resolved, then the building of the cpp examples was checked.

cd path/to/depthai_v3_develop
rm -rf build

mkdir build && cd build
cmake -S .. -B . \
    -D'CMAKE_POLICY_VERSION_MINIMUM=3.5' \
    -D'DEPTHAI_BUILD_EXAMPLES=ON'

cmake --build .  --parallel $NUM_CORES

Result:

  • "Running vcpkg install - failed" when using cmake -S . -B build
  • xtensor, xtl failures blocked the build
  • some cpp examples failed to build
  • 1,628 warnings due to a SDK major version mismatch
  • ClangFormat warnings

Expected behavior

Primary expectation:

  • A successful depthai-core v3.x.y-beta-like build on an up-to-date macOS toolchain.

Secondary exectation:

Attach System Log

log_system_information.json

Additional Context

Running vcpkg install - failed

The first blocking issue was a "Running vcpkg install - failed" fatal errror. This is reported separately as [BUG/v3_develop] Running vcpkg install - failed #1334

xtensor, xtl

The code build issues with xtensor v0.25.0, xtl v0.7.6 were resolved by updating to the xtensor v0.26.0, xtl v0.8.0 releases.

Note: xtensor v0.25.0, xtl v0.7.6 are available through homebrew.

brew info xtensor
# ==> xtensor: stable 0.26.0 (bottled)
# Multi-dimensional arrays with broadcasting and lazy computing
# https://xtensor.readthedocs.io/en/latest/
# ==> Dependencies
# Build: cmake ✔
# Required: xtl ✔

brew info xtl
# ==> xtl: stable 0.8.0 (bottled)
# X template library
# https://github.com/xtensor-stack/xtl
# ==> Dependencies
# Build: cmake ✔, pkgconf ✔
# Required: nlohmann-json ✔

brew install xtensor

Rerun Examples

Two cpp examples (RGBD, RVC2/VSLAM) failed to build because the Apache Arrow dependency of rerun-io/rerun 0.16.1 [2024.05.29] failed to build.

A quick check of using the current release rerun-io/rerun 0.23.2 [2025.05.06] also did not build. So, these two examples were just commented out instead of putting more effort into the examples at this time.

MACOS_SDK_MAJOR_VERSION

There were 1,628 warnings related to a SDK major version mismatch.

ld: warning: object file (…/build/_deps/….cpp.o)) 
    was built for newer 'macOS' version (15.0) than being linked (11.0)

The warnings were resolved by adding some automatic MACOS_SDK_MAJOR_VERSION detection.

ClangFormat

There were about 70 ClangFormat not available messages which were resolved with brew install clang-format.

-- ClangFormat: clang-format not found! Target 'clangformat' not available...

The ClangFormat messages were resolved with a brew install:

brew install clang-format

Note: It would be helpful to have brew install clang-format added to the depthai-core/v3_develop/README.md

CMake Versions

  • cmake version 3.31.7 also built OK without requiring -D'CMAKE_POLICY_VERSION_MINIMUM=3.5'.
  • cmake 4.0.2 successfully builds the marc-medley/depthai-core/v3_develop_macos15 snapshot provided -D'CMAKE_POLICY_VERSION_MINIMUM=3.5' is used.

marc-medley avatar May 26 '25 06:05 marc-medley

@marc-medley thanks a bunch for the writeup and the suggested fixes.

I've taken some of your work + ported the rerun examples and what was left to a newer version which could be configured with cmake 4 and made a PR here https://github.com/luxonis/depthai-core/pull/1349. The main thing that's still missing is just adding tests in the CI for the different CMake versions but we should have it integrated next week.

moratom avatar Jun 06 '25 11:06 moratom

@marc-medley can you give v3.0.0-rc.2 a try? I think all of these should be addressed, except for the MACOS_SDK_MAJOR_VERSION, but we'll have to address that one a tad differently, to actually target all of the dependanices to the older MacOS, so the binaries are transferable.

moratom avatar Jun 10 '25 21:06 moratom

@moratom Note: The v3.0.0-rc.2 and v3.0.0-rc.3 had been working OK with a cmake project until today. The compile-time errors were traced to the xtensor v0.27.0 update (2025.07.12) which was subsequently updated via a homebrew 'xtensor'.

Resolution: The cmake project which consumes depthai-core (which in turn uses xtensor) was upgraded from C++17 to C++20.

set(CMAKE_CXX_STANDARD 20)

The depthai-core xtensor compile-time errors were resolved with the use of C++20.

So, a preliminary look indicates the the depthai-core xtensor dependencies would require C++20 to build with xtensor v0.27.0.

marc-medley avatar Jul 15 '25 00:07 marc-medley

@marc-medley sorry for the late response, we actually expect to vendor xtensor ourselfs, did you explicitliy change this to install xtensor via brew instead?

Another possibility is that the system includes are preffered, but I recall this is not the case.

moratom avatar Sep 12 '25 20:09 moratom

@moratom Regarding xtensor,

… did you explicitly change {this} to install xtensor via brew instead?

Here here are my steps and what was/was-not explicitly changed.

  1. Brew Updates. As a background context, I routinely keep brew fully up-to-date. brew update; brew upgrade

  2. depthai-core Standard Builds. The v3.0.0-rc.2 and v3.0.0-rc.3 depthai-core default build was using the system (brew) installed xtensor.

    • Note: The v3.0.0-rc.2 and v3.0.0-rc.3 depthai-core cmake project itself was somehow preferring the system installed xtensor. I did-not make any changes to depthai-core regarding which xtensor to use.
  3. C++17 vs C++20 Check.

    • My findings at that time were (1) the depthai-core cmake project appeared to prefer the system xtensor and (2) internet searches for the build errors indicated that C++20 would support the newer xtensor v0.27.0 code.
    • Base on these findings, I explicity modified set(CMAKE_CXX_STANDARD 20) in the depthai-core project. This single change resolved all the xtensor v0.27.0 related build errors.

marc-medley avatar Sep 13 '25 16:09 marc-medley