juce-framework / JUCE

JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, LV2 and AAX audio plug-ins.
https://juce.com
Other
6.51k stars 1.72k forks source link

[Bug]: JUCE 7.0.6 broke CMake/Xcode generator for VST3 #1286

Closed fzwoch closed 9 months ago

fzwoch commented 11 months ago

Detailed steps on how to reproduce the bug

$ cmake . -B cmake-build -DJUCE_BUILD_EXAMPLES=ON -G Xcode
$ cd make-build
$ xcodebuild -target HostPluginDemo_VST3

Works fine with JUCE 7.0.5. Newer ones including develop seems broken. Probably only happens on Apple Silicon due to requirements that binaries are required to be signed. From what I have figured the issue comes from juce_vst3_helper which tries to load the VST3 which fails because the VST3 at that point does not have any signature at all, note even a ad-hoc one.

Issue does not occur when Apple's System Integration Protection is disabled (as it disabled requirement of having binaries with a signature). Issue does not occur when building with Ninja or Makefile generator.

What is the expected behaviour?

Successful build of VST3 plugins.

Operating systems

macOS

What versions of the operating systems?

macOS Ventura 13.6 Xcode 15.0 cmake version 3.27.6

Architectures

ARM

Stacktrace

[..]
Ld /Users/fzwoch/code/juce/cmake-build/examples/Plugins/HostPluginDemo_artefacts/Debug/VST3/HostPluginDemo.vst3/Contents/MacOS/HostPluginDemo normal (in target 'HostPluginDemo_VST3' from project 'JUCE')
    cd /Users/fzwoch/code/juce
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -Xlinker -reproducible -target arm64-apple-macos13.6 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -O0 -L/Users/fzwoch/code/juce/cmake-build/build/EagerLinkingTBDs/Debug -L/Users/fzwoch/code/juce/cmake-build/examples/Plugins/HostPluginDemo_artefacts/Debug/VST3 -F/Users/fzwoch/code/juce/cmake-build/build/EagerLinkingTBDs/Debug -F/Users/fzwoch/code/juce/cmake-build/examples/Plugins/HostPluginDemo_artefacts/Debug/VST3 -filelist /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Objects-normal/arm64/HostPluginDemo.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Objects-normal/arm64/HostPluginDemo_lto.o -Xlinker -no_deduplicate -Xlinker -adhoc_codesign -bundle -Wl,-headerpad_max_install_names /Users/fzwoch/code/juce/cmake-build/examples/Plugins/HostPluginDemo_artefacts/Debug/libHostPluginDemo_SharedCode.a -Xlinker -framework -Xlinker AudioUnit -Xlinker -framework -Xlinker CoreAudioKit -Xlinker -framework -Xlinker Accelerate -Xlinker -framework -Xlinker CoreAudio -Xlinker -framework -Xlinker CoreMIDI -Xlinker -framework -Xlinker AudioToolbox -Xlinker -framework -Xlinker DiscRecording -Xlinker -framework -Xlinker Foundation -Xlinker -framework -Xlinker IOKit -Xlinker -framework -Xlinker Security -Xlinker -framework -Xlinker QuartzCore -Xlinker -framework -Xlinker Cocoa -weak_framework Metal -weak_framework MetalKit -Xlinker -framework -Xlinker WebKit -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Objects-normal/arm64/HostPluginDemo_dependency_info.dat -o /Users/fzwoch/code/juce/cmake-build/examples/Plugins/HostPluginDemo_artefacts/Debug/VST3/HostPluginDemo.vst3/Contents/MacOS/HostPluginDemo

WriteAuxiliaryFile /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Script-DAF08EC419E61447D93AAC5D.sh (in target 'HostPluginDemo_VST3' from project 'JUCE')
    cd /Users/fzwoch/code/juce
    write-file /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Script-DAF08EC419E61447D93AAC5D.sh

PhaseScriptExecution CMake\ PostBuild\ Rules /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Script-DAF08EC419E61447D93AAC5D.sh (in target 'HostPluginDemo_VST3' from project 'JUCE')
    cd /Users/fzwoch/code/juce
    /bin/sh -c /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Script-DAF08EC419E61447D93AAC5D.sh
The bundle “HostPluginDemo” couldn’t be loaded.Command PhaseScriptExecution failed with a nonzero exit code

note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'JUCE')
** BUILD FAILED **

The following build commands failed:
    PhaseScriptExecution CMake\ PostBuild\ Rules /Users/fzwoch/code/juce/cmake-build/build/HostPluginDemo_VST3.build/Debug/Script-DAF08EC419E61447D93AAC5D.sh (in target 'HostPluginDemo_VST3' from project 'JUCE')
(1 failure)

Plug-in formats (if applicable)

VST3

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

mhhollomon commented 10 months ago

I am seeing this same issue with 7.0.8 as a part of the github actions on my repo for a simple plug-in. https://github.com/mhhollomon/Starp

mhhollomon commented 10 months ago

Adding Ninja didn't work for me.

/Users/runner/work/Starp/Starp/build/Source/Starp_artefacts/Release/VST3/Starp.vst3: code object is not signed at all
In architecture: x86_64
-- Replacing invalid signature with ad-hoc signature
/bin/sh: line 1:  5479 Segmentation fault: 11  /Users/runner/work/Starp/Starp/build/Source/juce_vst3_helper -create -version 0.2.0 -path /Users/runner/work/Starp/Starp/build/Source/Starp_artefacts/Release/VST3/Starp.vst3 -output /Users/runner/work/Starp/Starp/build/Source/Starp_artefacts/Release/VST3/Starp.vst3/Contents/Resources/moduleinfo.json
ninja: build stopped: subcommand failed.

Error: Process completed with exit code 1.
mhhollomon commented 10 months ago

Adding this link to a thread in the forums for future searchers.

Adding VST3_AUTO_MANIFEST FALSE to my juce_add_plugin call fixed it for me.

https://forum.juce.com/t/vst3-build-with-juce-7-0-6-on-macos-is-broken/57304

fzwoch commented 10 months ago

Probably addressed with https://github.com/juce-framework/JUCE/commit/3a33c70a6c815af5db425c36ed33dfde2a8f850a

mhhollomon commented 9 months ago

This has been fixed for me even without the extra flag.