libopenshot icon indicating copy to clipboard operation
libopenshot copied to clipboard

MacOS build error when run `cmake -d -G....'

Open cer-cer opened this issue 10 months ago • 4 comments

When i built libopensot use the method

$ cd [libopenshot repo folder]
$ mkdir build
$ cd build
$ cmake -d -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/ -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" -DCMAKE_SHARED_LINKER_FLAGS="-stdlib=libc++" -D"CMAKE_INSTALL_RPATH_USE_LINK_PATH=1" -D"ENABLE_RUBY=0" -D"CMAKE_BUILD_TYPE:STRING=Release" ../
$ make

The line of cmake -d -G..., got an error

cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/ -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" -DCMAKE_SHARED_LINKER_FLAGS="-stdlib=libc++" -D"CMAKE_INSTALL_RPATH_USE_LINK_PATH=1" -D"ENABLE_RUBY=0" -D"CMAKE_BUILD_TYPE:STRING=Release" ../

      Welcome to the OpenShot Build System!

CMake will now check libopenshot's build dependencies and inform you of any missing files or other issues.

For more information, please visit http://www.openshot.org/.

Generating build files for OpenShot with CMake 4.0.2 Building libopenshot (version 0.5.0) SO/API/ABI Version: 28

CMake Error at src/CMakeLists.txt:187 (find_package): By not providing "FindOpenShotAudio.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenShotAudio", but CMake did not find one.

Could not find a package configuration file provided by "OpenShotAudio" (requested version 0.4.0) with any of the following names:

OpenShotAudioConfig.cmake
openshotaudio-config.cmake

Add the installation prefix of "OpenShotAudio" to CMAKE_PREFIX_PATH or set "OpenShotAudio_DIR" to a directory containing one of the above files. If "OpenShotAudio" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!

Could you please help to solve it? any suggestion...

cer-cer avatar Jan 25 '26 02:01 cer-cer

My OS:

ProductName: macOS ProductVersion: 26.0 M4..

cer-cer avatar Jan 25 '26 03:01 cer-cer

Hi @cer-cer, I spent an afternoon building libopenshot from a clean clone on an Apple Silicon Mac to understand where this error comes from. Short version: the OpenShotAudio CMake error you hit is a symptom, not the root cause. The underlying problem is that doc/INSTALL-MAC.md is about a decade out of date (it still references gcc48, Python 3.3, Qt 5.4.2, the non-existent cmake -d flag, and Intel-only /usr/local/Cellar paths), so contributors following it today run into a cascade of misleading errors. The "OpenShotAudio not found" message is what you land on after libopenshot-audio has already failed to build (or was skipped), and the doc does not explain how to make libopenshot find it.

I have filed #1058 with a full rewrite of doc/INSTALL-MAC.md, using a recipe that I verified end-to-end on macOS 15, Apple Silicon (arm64), AppleClang 17, CMake 4.0.3. It works on Intel Macs too, because every prefix is resolved with $(brew --prefix ...).

If you would like to unblock yourself before that PR merges, the TL;DR of the new doc is roughly:

# 1. Install deps
brew install cmake swig qt@5 ffmpeg@7 libomp zeromq cppzmq pkgconf

# 2. Build libopenshot-audio as a sibling directory
git clone https://github.com/OpenShot/libopenshot-audio.git
cd libopenshot-audio
cmake -B build -S .
cmake --build build -j
cd ..

# 3. Build libopenshot, pointing at the libopenshot-audio build tree
git clone https://github.com/OpenShot/libopenshot.git
cd libopenshot

QT5_PREFIX="$(brew --prefix qt@5)"
FFMPEG_PREFIX="$(brew --prefix ffmpeg@7)"
LIBOMP_PREFIX="$(brew --prefix libomp)"

PKG_CONFIG_PATH="$FFMPEG_PREFIX/lib/pkgconfig" \
cmake -B build -S . \
    -DCMAKE_PREFIX_PATH="$QT5_PREFIX;$FFMPEG_PREFIX" \
    -DOpenShotAudio_ROOT="$PWD/../libopenshot-audio/build" \
    -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$LIBOMP_PREFIX/include" \
    -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$LIBOMP_PREFIX/include" \
    -DOpenMP_C_LIB_NAMES=omp \
    -DOpenMP_CXX_LIB_NAMES=omp \
    -DOpenMP_omp_LIBRARY="$LIBOMP_PREFIX/lib/libomp.dylib" \
    -DENABLE_RUBY=0

cmake --build build -j

Notes that matter on macOS specifically:

  • OpenShotAudio_ROOT is the direct answer to the error you saw. It tells CMake where the sibling libopenshot-audio/build directory is without needing to install anything.
  • The five OpenMP_* flags are needed because AppleClang does not ship an OpenMP runtime, so find_package(OpenMP REQUIRED) fails by default. libomp from Homebrew provides it.
  • ENABLE_RUBY=0 is currently mandatory on macOS because Apple's system Ruby headers still use the C++17-removed register keyword.
  • cppzmq is listed as "optional" during CMake configure but the code actually requires it, so install the Homebrew formula.

If that recipe works for you, great. If it does not, please drop the error in here and I will take another look. Also please consider reviewing #1058, since you are closer to this problem than most.

geekrebel avatar Apr 16 '26 11:04 geekrebel

Thanks a lot, after i tried your suggestion step by step, i got an error:

Image

but when i tried to install AGL by brew,

Warning: No available formula with the name "agl". Did you mean agg, age, acl or cgl?

What i have installed by brew

Image

cer-cer avatar Apr 24 '26 00:04 cer-cer

Hi @cer-cer, sorry for the slow follow-up on this.

The framework 'AGL' not found error in your screenshot was not something missing from your machine. AGL was dropped from the macOS SDK years ago, and libopenshot-audio was still trying to link against it, which is why there was no Homebrew formula to install. That has now been fixed in OpenShot/libopenshot-audio#169, which is merged and included in the libopenshot-audio 1.0.1 release.

To pick it up, pull the latest develop in both repositories and rebuild libopenshot-audio from a clean build directory:

cd libopenshot-audio
git pull
rm -rf build
cmake -B build -S .
cmake --build build -j

cd ../libopenshot
git pull
rm -rf build

Then run the libopenshot cmake and cmake --build steps from my earlier comment again. Current libopenshot requires libopenshot-audio 1.0.1, so updating both matters.

One change since that comment: libopenshot no longer uses ZeroMQ, so you can leave zeromq and cppzmq out of the brew install line.

I re-ran the whole recipe today on an Apple Silicon Mac (macOS 27, Apple Clang 21, CMake 4.0.3) and both libraries build, with import openshot working from the build tree. If it works for you too, could you let us know here so this issue can be closed? If something else breaks, paste the error and I'll take a look.

geekrebel avatar Oct 07 '26 21:10 geekrebel