Skip to content

Commit 81f8218

Browse files
authored
Add riscv64gc-unknown-linux-gnu for RISC-V Nerves devices (#27)
Nerves supports 64-bit RISC-V devices. One of these is the MangoPi MQ Pro which is being used as an alternative to the Raspberry Pi. Currently it's much, much easier to use precompiled Rust binaries with Nerves. In fact, manually crosscompiling `tokenizers` with Nerves doesn't work due to a compiler error deep in the Rust build. This adds the riscv64gc target to make it possible to use `tokenizers` with Nerves on 64-bit RISC-V devices as easy as 64-bit ARM ones. This, in turn, enables Bumblebee support.
1 parent f0540fc commit 81f8218

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.16", use-cross: true }
3838
- { target: aarch64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.16", use-cross: true }
3939
- { target: aarch64-apple-darwin, os: macos-11, nif: "2.16" }
40+
- { target: riscv64gc-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.16", use-cross: true }
4041
- { target: x86_64-apple-darwin, os: macos-11, nif: "2.16" }
4142
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.16" }
4243
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.16", use-cross: true }
@@ -52,6 +53,7 @@ jobs:
5253
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.15", use-cross: true }
5354
- { target: aarch64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.15", use-cross: true }
5455
- { target: aarch64-apple-darwin, os: macos-11, nif: "2.15" }
56+
- { target: riscv64gc-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.15", use-cross: true }
5557
- { target: x86_64-apple-darwin, os: macos-11, nif: "2.15" }
5658
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.15" }
5759
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.15", use-cross: true }
@@ -67,6 +69,7 @@ jobs:
6769
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.14", use-cross: true }
6870
- { target: aarch64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.14", use-cross: true }
6971
- { target: aarch64-apple-darwin, os: macos-11, nif: "2.14" }
72+
- { target: riscv64gc-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.14", use-cross: true }
7073
- { target: x86_64-apple-darwin, os: macos-11, nif: "2.14" }
7174
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.14" }
7275
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.14", use-cross: true }

lib/tokenizers/native.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ defmodule Tokenizers.Native do
99
version: version,
1010
base_url: "#{github_url}/releases/download/v#{version}",
1111
force_build: System.get_env("TOKENIZERS_BUILD") in ["1", "true"],
12-
targets: RustlerPrecompiled.Config.default_targets() ++ ["aarch64-unknown-linux-musl"]
12+
targets:
13+
RustlerPrecompiled.Config.default_targets() ++
14+
["aarch64-unknown-linux-musl", "riscv64gc-unknown-linux-gnu"]
1315

1416
def decode(_tokenizer, _ids, _skip_special_tokens), do: err()
1517
def decode_batch(_tokenizer, _ids, _skip_special_tokens), do: err()

0 commit comments

Comments
 (0)