Can't combine universal binary built using Clang++

177 Views Asked by At
sudo cmake -DCMAKE_BUILD_TYPE=Release -S . -B cmake-build-release  -Wno-dev -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX
sudo cmake --build ./cmake-build-release --config Release

eventually leads to lipo being called, where it complains:

warning: Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Invalid value (Producer: 'LLVM15.0.6' Reader: 'LLVM APPLE_1_1300.0.29.3_0')
fatal error: Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PluginProcessor-eb9c16/PluginProcessor-arm64.o

I believe lipo is being called because I added this to my cmake project:

    set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")

Anyone know if its possible to tell cmake to use llvm-lipo rather than lipo?

1

There are 1 best solutions below

0
On

Per documentation CMAKE_OSX_ARCHITECTURES has to be set before the project() call