0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GNU Hurdでllama.cppを動かす

Last updated at Posted at 2025-09-15

せっかくx86_64で動いたのでLLMを動かしたい!必要なツールをインストールして、ソースコードをダウンロードします。

   $ sudo apt update
   $ sudo apt install build-essential cmake libcurl4-openssl-dev git
   $ git clone https://github.com/ggerganov/llama.cpp.git

以下の内容で、

#include <limits.h>
#define PATH_MAX 4096
 || defined(__GNU__)

いくつかのソースファイルを修正します。

common/arg.cpp
#ifdef __linux__
#include <linux/limits.h>
#elif defined(_WIN32)
#   if !defined(PATH_MAX)
#   define PATH_MAX MAX_PATH
#   endif
#elif defined(_AIX)
#include <sys/limits.h>
#else
#include <limits.h>
#define PATH_MAX 4096
//#include <sys/syslimits.h>
#endif
src/llama-mmap.cpp
#include "llama-mmap.h"

#include "llama-impl.h"

#include "ggml.h"

#include <cstring>
#include <climits>
#include <stdexcept>
#include <cerrno>
#include <algorithm>
#define PATH_MAX 4096
tools/gguf-split/gguf-split.cpp
#include "ggml.h"
#include "gguf.h"
#include "llama.h"
#include "common.h"

#include <algorithm>
#include <cinttypes>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <stdexcept>
#include <cstring>
#include <fstream>
#include <string>
#include <vector>
#define PATH_MAX 4096
common/common.cpp
//#if defined(__linux__) || defined(__FreeBSD__) || defined(_AIX) || defined(__OpenBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(_AIX) || defined(__OpenBSD__) || defined(__GNU__)
        if (std::getenv("XDG_CACHE_HOME")) {
            cache_directory = std::getenv("XDG_CACHE_HOME");
        } else {
            cache_directory = std::getenv("HOME") + std::string("/.cache/");
        }
#elif defined(__APPLE__)
        cache_directory = std::getenv("HOME") + std::string("/Library/Caches/");
#elif defined(_WIN32)
        cache_directory = std::getenv("LOCALAPPDATA");
#else
#  error Unknown architecture
#endif
   $ cd llama.cpp/
   $ cmake -B build
   $ cmake --build build
   $ cd build/bin
   $ ./llama-run ollama://deepseek-r1:1.5b
> hello
<think>

</think>

Hello! How can I assist you today? 😊
> /bye
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?