Maknee / minigpt4.cpp

Port of MiniGPT4 in C++ (4bit, 5bit, 6bit, 8bit, 16bit CPU inference with GGML)
MIT License
549 stars 26 forks source link

CMake build fails for Ubuntu 20.04.6 LTS #14

Closed mvsoom closed 11 months ago

mvsoom commented 11 months ago

Trying to build following the instructions of the README. I'm on Ubuntu 20.04.6 LTS.

I first cloned the repo:

git clone --recursive https://github.com/Maknee/minigpt4.cpp
cd minigpt4.cpp

I then installed cmake version 3.16.3-1ubuntu1.20.04.1 with sudo apt install cmake.

Then I ran cmake ., but it fails:

cmake .
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Working on fmt
-- Module support is disabled.
-- Version: 9.1.0
-- Build type: 
-- CXX_STANDARD: 23
-- Required features: cxx_variadic_templates
-- Working on unordered_dense
-- Working on stb
    Header only
-- Working on spdlog
-- Build spdlog: 1.11.0
-- Build type: Release
-- Working on nlohmann_json
-- Using the multi-header code from /home/marnix/ART/CAMERA/minigpt4.cpp/_deps/nlohmann_json-src/include/
-- Working on tl_expected
-- Working on llama_cpp
CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:40 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_STATIC'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:41 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_NATIVE'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:42 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_LTO'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:55 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_AVX'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:56 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_AVX2'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:57 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_AVX512'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:60 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_FMA'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at _deps/llama_cpp-src/CMakeLists.txt:67 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLAMA_ACCELERATE'.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Git: /usr/bin/git (found version "2.25.1") 
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Working on magic_enum
-- Configuring done
CMake Error in CMakeLists.txt:
  The CXX_STANDARD property on target "minigpt4" contained an invalid value:
  "23".

CMake Generate step failed.  Build files cannot be regenerated correctly.

Any idea what is going on?

Is building from source necessary to get optimal performance for my system's architecture?

mvsoom commented 11 months ago

Building works for Ubuntu 22.10. Is my Ubuntu LTS too old?

Maknee commented 11 months ago

It seems like the error is stemming from this line

CMake Error in CMakeLists.txt:
  The CXX_STANDARD property on target "minigpt4" contained an invalid value:
  "23".

Perhaps the compiler you have on ubuntu 20.04 lts does not support c++23. If you update the compiler, it should work correctly.

mvsoom commented 11 months ago

OK, thanks :) Is building from source necessary to get optimal performance for my system's architecture?

Maknee commented 11 months ago

Yes. set these flags MINIGPT4_NATIVE/MINIGPT4_LTO in CMake

mvsoom commented 11 months ago

Thank you very much!