レベル5

Xcode error: Command CodeSign failed with a nonzero exit code

Object Oriented Programmingという授業でJUCEアプリを使い、MacのXcodeとC++でDJミキサーを作成するというプロジェクトを行っています。

その最中に理由がわからないエラーがいくつか起こりましたので、こちらはそれらのエラーをどうやって解決したかという記録を残していきたいと思います。

Command CodeSign failed with a nonzero exit code

まずはCommand CodeSign failed with a nonzero exit codeというエラーです。

Macのターミナルを起動し、プロジェクトを保存している対象のフォルダーへ移動します。

cd(ターミナルでデレクトリを移動するときに使うコマンド)␣/user/... ENTER
xattr -rc . ENTER

私の場合はこれで解決しました。

原因はいまだによくわかりませんが、よくあるMacとXcodeのバグらしいです。

JUCE::の入力を省く

Xcodeで毎回JUCE::を入力しないようにする設定です。簡単ですが記録として残しておきます。

No member named ‘browseForFileToOpen’ in ‘juce::FileChooser’

下記のコードをJucerの指定の箇所に入力して保存。

JUCE_MODAL_LOOPS_PERMITTED=1

たったこれだけでエラーが消えました。

JUCE Assertion failure in juce_ResamplingAudioSource.cpp:40

これは課題で参考にした教授のコードがエラーを発生させていたようです。個人用記録ですので参考にならないかもしれません。

「DJAudioPlayer.cppファイル内」の以下の部分を <= と変更すると直りました。

if (ratio <= 0 || ratio > 100.0)

JUCE Assertion failure in juce_AudioFormatManager.cpp:43 

The addInputSource method on your MixerAudioSource object calls prepareToPlay on the sources you add (if you are using recent versions of juce). This means the video lectures are incorrect about calling the prepareToPlay methods on your 2 DJAudioPLayer instances from the MainComponent::prepareToPlay method. If you remove these calls, your code will run without the failure. Notice the two commented out lines:

UoL community
void MainComponent::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
{
//    player1.prepareToPlay(samplesPerBlockExpected, sampleRate);
//    player2.prepareToPlay(samplesPerBlockExpected, sampleRate);

    mixerSource.prepareToPlay(samplesPerBlockExpected, sampleRate);
    
    mixerSource.addInputSource(&player1, false);
    mixerSource.addInputSource(&player2, false);
    
}

おすすめ記事