Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile bug: fatal error: 'ggml.h' file not found #12101

Open
peekaboolabs-appdev opened this issue Feb 28, 2025 · 0 comments
Open

Compile bug: fatal error: 'ggml.h' file not found #12101

peekaboolabs-appdev opened this issue Feb 28, 2025 · 0 comments

Comments

@peekaboolabs-appdev
Copy link

Git commit

a800ae4

Operating systems

Mac

GGML backends

Vulkan, Metal

Problem description & steps to reproduce

Hello, I was trying to build flutter package using llama.cpp using

#!/bin/bash

IPHONEOS_DEPLOYMENT_TARGET=13.0
ARCHS="arm64"

SOURCE_FILES=(
    "src/pllama.cpp"
    "src/pllama_tokenize.cpp"
    "src/llama.cpp/src/llama.cpp"
    "src/llama.cpp/src/llama-model.cpp"
    "src/llama.cpp/src/llama-vocab.cpp"
)

HEADERS=(
    "-I./src/llama.cpp/include"
    "-I./src/llama.cpp/ggml"
    "-I./src"
)

COMPILE_OPTIONS=(
    "-std=c++17"
    "-fPIC"
    "-DNDEBUG"
    "-O3"
)

for ARCH in $ARCHS; do
    clang++ \
        -target ${ARCH}-apple-ios \
        ${COMPILE_OPTIONS[@]} \
        ${HEADERS[@]} \
        ${SOURCE_FILES[@]} \
        -shared \
        -o libpllama-${ARCH}.dylib
done

But it gives following error;

clang++: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
In file included from src/pllama.cpp:2:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
In file included from src/pllama_tokenize.cpp:2:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
In file included from src/llama.cpp/src/llama.cpp:1:
src/llama.cpp/src/llama-impl.h:3:10: fatal error: 'ggml.h' file not found
    3 | #include "ggml.h" // for ggml_log_level
      |          ^~~~~~~~
1 error generated.
In file included from src/llama.cpp/src/llama-model.cpp:1:
In file included from src/llama.cpp/src/llama-model.h:3:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
In file included from src/llama.cpp/src/llama-vocab.cpp:1:
In file included from src/llama.cpp/src/llama-vocab.h:3:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: libpllama-arm64.dylib (No such file or directory)

I checked llama.cpp and etc, but it looks like it is trying to use files from other directories.
I'm building my package on MacBook Pro, would it be a problem?

First Bad Commit

No response

Compile command

#!/bin/bash

IPHONEOS_DEPLOYMENT_TARGET=13.0
ARCHS="arm64"

SOURCE_FILES=(
    "src/pllama.cpp"
    "src/pllama_tokenize.cpp"
    "src/llama.cpp/src/llama.cpp"
    "src/llama.cpp/src/llama-model.cpp"
    "src/llama.cpp/src/llama-vocab.cpp"
)

HEADERS=(
    "-I./src/llama.cpp/include"
    "-I./src/llama.cpp/ggml"
    "-I./src"
)

COMPILE_OPTIONS=(
    "-std=c++17"
    "-fPIC"
    "-DNDEBUG"
    "-O3"
)

for ARCH in $ARCHS; do
    clang++ \
        -target ${ARCH}-apple-ios \
        ${COMPILE_OPTIONS[@]} \
        ${HEADERS[@]} \
        ${SOURCE_FILES[@]} \
        -shared \
        -o libpllama-${ARCH}.dylib
done

Relevant log output

clang++: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
In file included from src/pllama.cpp:2:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
In file included from src/pllama_tokenize.cpp:2:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
In file included from src/llama.cpp/src/llama.cpp:1:
src/llama.cpp/src/llama-impl.h:3:10: fatal error: 'ggml.h' file not found
    3 | #include "ggml.h" // for ggml_log_level
      |          ^~~~~~~~
1 error generated.
In file included from src/llama.cpp/src/llama-model.cpp:1:
In file included from src/llama.cpp/src/llama-model.h:3:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
In file included from src/llama.cpp/src/llama-vocab.cpp:1:
In file included from src/llama.cpp/src/llama-vocab.h:3:
./src/llama.cpp/include/llama.h:4:10: fatal error: 'ggml.h' file not found
    4 | #include "ggml.h"
      |          ^~~~~~~~
1 error generated.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: libpllama-arm64.dylib (No such file or directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant