Telosnex / fllama

llama.cpp for Flutter
Other
99 stars 11 forks source link

Error building fllama project on Linux #11

Closed wajeehulhassanvii closed 2 weeks ago

wajeehulhassanvii commented 2 weeks ago

I am trying to build the app for Linux but it's failing with the following error.

CMake Warning at flutter/ephemeral/.plugin_symlinks/fllama/src/llama.cpp/common/CMakeLists.txt:30 (message):
  Git repository not found; to enable automatic generation of build info,
  make sure Git is installed and the project is a Git repository.

/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:29:6: error: no template named 'shared_ptr' in namespace 'std'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:73:8: error: no template named 'shared_ptr' in namespace 'std'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:97:6: error: no template named 'shared_ptr' in namespace 'std'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:131:14: error: cannot initialize return object of type 'int' with an rvalue of type 'std::nullptr_t'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:135:10: error: no member named 'shared_ptr' in namespace 'std'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:135:21: error: 'llama_model' does not refer to a value
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:135:34: error: use of undeclared identifier 'model'; did you mean 'modfl'?
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:136:9: error: cannot initialize a parameter of type 'long double' with an lvalue of type 'llama_model *'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:138:32: error: use of undeclared identifier 'model'; did you mean 'modfl'?
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:138:29: error: no viable overloaded '='
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:140:12: error: use of undeclared identifier 'model'; did you mean 'modfl'?
/home/wajeeh-/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp:140:12: error: cannot initialize return object of type 'int' with an lvalue of type 'long double (long double, long double *) noexcept(true)'
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/llava.cpp:118:22: warning: 'backend' is deprecated: use the buffer type to find the storage location of the tensor [-Wdeprecated-declarations]
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/llama.cpp/ggml/src/ggml.c:2065:5: warning: implicit conversion increases floating-point precision: 'float' to 'ggml_float' (aka 'double') [-Wdouble-promotion]
/home/wajeeh/workspace///fllama/example/linux/flutter/ephemeral/.plugin_symlinks/fllama/src/llama.cpp/ggml/src/ggml.c:2113:9: warning: implicit conversion increases floating-point precision: 'float' to 'ggml_float' (aka 'double') [-Wdouble-promotion]
Building Linux application...                           
wajeehulhassanvii commented 2 weeks ago

Solved it. Now its compiling for Linux Desktop as well.

In the /linux/flutter/ephemeral/.plugin_symlinks/fllama/src/fllama_tokenize.cpp filem add #include <memory>, I added the statement below #include <mutex>

#include <memory>

Reference: http://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared use head file in your code.