

## やったこと

<https://github.com/libsdl-org/SDL/blob/release-2.28.4/docs/README-macos.md>

の下記手順に従い、インストールしました。

[code]

    mkdir build
    cd build
    ../configure
    make
    sudo make install
    
[/code]

ターミナルでは実行できました。

[code]

    $ g++ -o hoge.exe main.cpp -L/usr/local/lib -lSDL2 -I/usr/local/include/
    $ ./hoge.exe
    
[/code]

## エラー

しかしXcodeでは下記エラーです。

[code]

    dyld[23486]: Library not loaded: /usr/local/lib/libSDL2-2.0.0.dylib
      Referenced from: <xxxxxxxxxxx> /Users/user-name/Library/Developer/Xcode/DerivedData/firstsdl-xxxxxx/Build/Products/Debug/firstsdl
      Reason: tried: '/Users/user-name/Library/Developer/Xcode/DerivedData/firstsdl-xxxxxx/Build/Products/Debug/libSDL2-2.0.0.dylib' (no such file), '/usr/lib/system/introspection/libSDL2-2.0.0.dylib' (no such file, not in dyld cache), '/usr/local/lib/libSDL2-2.0.0.dylib' (code signature in <xxxxxxxxx> '/usr/local/lib/libSDL2-2.0.0.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libSDL2-2.0.0.dylib' (no such file), '/usr/local/lib/libSDL2-2.0.0.dylib' (code signature in <xxxxxxx> '/usr/local/lib/libSDL2-2.0.0.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/usr/lib/libSDL2-2.0.0.dylib' (no such file, not in dyld cache)
    Message from debugger: Terminated due to signal 6
    Program ended with exit code: 6
    
[/code]

リンクの様子：  
[![画像の説明をここに入力](https://i.stack.imgur.com/eLYA1.png)](https://i.stack.imgur.com/eLYA1.png)

インクルードの様子：  
[![画像の説明をここに入力](https://i.stack.imgur.com/NclM8.png)](https://i.stack.imgur.com/NclM8.png)

## 質問

ad-hoc signedとはなんでしょうか？  
自分でコンパイルしたのに、署名しないとXcodeでは動かないのでしょうか？  
（そもそも、このエラーにおける署名（signed）とはどのようなもので、勝手にやってしまっていいものでしょうか？そもそもやりかたがわかっていませんが）


CC BY-SA 4.0
2023-10-07T05:29:32.100
96445
2023-10-08T01:59:59.087
2023-10-08T01:59:59.087
3060
9008
question
c++ xcode macos sdl
completely unsigned? Code has to be at least ad-hoc signed が起こる