You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: adapt to the latest `llama.cpp` interface
* feat: print helpful information to help resolve a clone issue when it happens
* feat: print helpful information to help resolve build issues related to CUDA
* feat: make portable cmake on Windows more stable
* feat: update `CMakeLists.txt` to match `llama.cpp` better
* fix: do not download redundant node headers
* fix: improve cmake custom options handling
* fix: do not set `CMAKE_GENERATOR_TOOLSET` for CUDA
* fix: do not fetch information from GitHub when using a local git bundle
* fix: GBNF JSON schema string const formatting
* docs: document a solution to a compilation problem on macOS
* docs: document more CUDA build error solutions
* docs: explain about ES modules in the getting started guide
* chore: update `.commitlintrc.json`
* chore: remove redundant dependency
Copy file name to clipboardExpand all lines: docs/guide/CUDA.md
+27-6Lines changed: 27 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,18 +23,39 @@ To build `node-llama-cpp` with any of these options, set an environment variable
23
23
### Fix the `Failed to detect a default CUDA architecture` build error
24
24
To fix this issue you have to set the `CUDACXX` environment variable to the path of the `nvcc` compiler.
25
25
26
-
For example, if you installed CUDA Toolkit 12.2 on Windows, you have to run the following command:
27
-
```bash
28
-
set CUDACXX=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe
26
+
For example, if you have installed CUDA Toolkit 12.2, you have to run a command like this:
27
+
::: code-group
28
+
```bash [Linux]
29
+
export CUDACXX=/usr/local/cuda-12.2/bin/nvcc
29
30
```
30
31
31
-
On Linux, it would be something like this:
32
-
```bash
33
-
export CUDACXX=/usr/local/cuda-12.2/bin/nvcc
32
+
```bash [Windows]
33
+
set CUDACXX=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe
34
34
```
35
+
:::
35
36
36
37
Then run the build command again to check whether setting the `CUDACXX` environment variable fixed the issue.
37
38
39
+
### Fix the `The CUDA compiler identification is unknown` build error
40
+
The solution to this error is the same as [the solution to the `Failed to detect a default CUDA architecture` error](#fix-the-failed-to-detect-a-default-cuda-architecture-build-error).
41
+
42
+
### Fix the `A single input file is required for a non-link phase when an outputfile is specified` build error
43
+
To fix this issue you have to set the `CMAKE_GENERATOR_TOOLSET` cmake option to the CUDA home directory, usually already set as the `CUDA_PATH` environment variable.
44
+
45
+
To do this, set the `NODE_LLAMA_CPP_CMAKE_OPTION_CMAKE_GENERATOR_TOOLSET` environment variable to the path of your CUDA home directory:
Copy file name to clipboardExpand all lines: docs/guide/building-from-source.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,8 @@ If `cmake` is not installed on your machine, `node-llama-cpp` will automatically
27
27
28
28
If the build fails, make sure you have the required dependencies of `cmake` installed on your machine. More info is available [here](https://github.com/cmake-js/cmake-js#:~:text=projectRoot/build%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Bstring%5D-,Requirements%3A,-CMake) (you don't have to install `cmake` or `cmake-js`, just the dependencies).
29
29
30
+
If the build fails on macOS with the error `"/usr/bin/cc" is not able to compile a simple test program`, try running `xcode-select --install` to install the Xcode command line tools.
Copy file name to clipboardExpand all lines: docs/guide/cli/build.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,10 @@ const commandDoc = docs.build;
10
10
11
11
{{commandDoc.description}}
12
12
13
+
::: info
14
+
If the build fails on macOS with the error `"/usr/bin/cc" is not able to compile a simple test program`, try running `xcode-select --install` to install the Xcode command line tools.
Copy file name to clipboardExpand all lines: docs/guide/cli/download.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,10 @@ This is useful for building from source on machines that aren't connected to the
20
20
21
21
:::
22
22
23
+
::: info
24
+
If the build fails on macOS with the error `"/usr/bin/cc" is not able to compile a simple test program`, try running `xcode-select --install` to install the Xcode command line tools.
> If binaries are not available for your platform, it'll fallback to download a release of `llama.cpp` and build it from source with `cmake`.
15
15
> To disable this behavior, set the environment variable `NODE_LLAMA_CPP_SKIP_DOWNLOAD` to `true`.
16
16
17
+
## ESM usage
18
+
`node-llama-cpp` is an [ES module](https://nodejs.org/api/esm.html#modules-ecmascript-modules), so can only use `import` to load it and cannot use `require`.
19
+
20
+
To make sure you can use it in your project, make sure your `package.json` file has `"type": "module"` in it.
21
+
17
22
## CUDA and Metal support
18
23
**Metal:** Metal support is enabled by default on macOS. If you're using a Mac with an Intel chip, [you might want to disable it](./Metal.md).
0 commit comments