llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Compile bug: iOS version able to build not not able to run

Open Animaxx opened this issue 2 months ago • 8 comments

Git commit

https://github.com/ggerganov/llama.cpp/commit/43ed389a3f102517e6f7d5620d8e451e88afbf27

Operating systems

Mac

GGML backends

Metal

Problem description & steps to reproduce

related to https://github.com/ggerganov/llama.cpp/issues/10747

I have follow with the CI action for macOS

mkdir build
cd build

cmake -G Xcode .. \
    -DGGML_METAL_USE_BF16=ON \
    -DGGML_METAL_EMBED_LIBRARY=ON \
    -DLLAMA_BUILD_EXAMPLES=OFF \
    -DLLAMA_BUILD_TESTS=OFF \
    -DLLAMA_BUILD_SERVER=OFF \
    -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
    -DCMAKE_SYSTEM_NAME=Darwin \
    -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
    -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
    
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
sudo cmake --install . --config Release

# build for swift package
cd ..
xcodebuild -scheme llama-Package -destination 'generic/platform=macOS'

or build for iOS

mkdir build
cd build
cmake -G Xcode .. \
    -DGGML_METAL_USE_BF16=ON \
    -DGGML_METAL_EMBED_LIBRARY=ON \
    -DLLAMA_BUILD_EXAMPLES=OFF \
    -DLLAMA_BUILD_TESTS=OFF \
    -DLLAMA_BUILD_SERVER=OFF \
    -DCMAKE_SYSTEM_NAME=iOS \
    -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
    -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml

cmake --build . --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
sudo cmake --install . --config Release

# build for swift package
cd ..
xcodebuild -scheme llama-Package -destination 'generic/platform=iOS'

the build is success but when run it shows error dyld[70862]: Library not loaded: @rpath/libggml.dylib

First Bad Commit

No response

Relevant log output

dyld[70862]: Library not loaded: @rpath/libggml.dylib
  Referenced from: <4A6AE769-FE07-3AAE-84F0-552992A8720C> /Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/LocalLLM.app/Contents/MacOS/LocalLLM.debug.dylib
  Reason: tried: '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/libggml.dylib' (no such file), '/usr/lib/system/introspection/libggml.dylib' (no such file, not in dyld cache), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/PackageFrameworks/libggml.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/PackageFrameworks/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/LocalLLM.app/Contents/MacOS/Frameworks/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/LocalLLM.app/Contents/MacOS/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/PackageFrameworks/libggml.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/PackageFrameworks/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/LocalLLM.app/Contents/MacOS/Frameworks/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/LocalLLM.app/Contents/MacOS/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/PackageFrameworks/libggml.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/PackageFrameworks/libggml.dylib' (no such file), '/Users/animax/Library/Developer/Xcode/DerivedData/LocalLLM-ctyejtpossqslxdwvdukottbyflj/Build/Products/Debug/LocalLLM.app/Contents/MacOS/Frameworks/libggml.dylib' (no such file)
Message from debugger: Terminated due to signal 6

Animaxx avatar Dec 20 '24 19:12 Animaxx