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
I wanted to use translateLocally on my PinePhone, which is running mobian and has a Cortex-a53 CPU. I couldn't compile translateLocally directly on my phone, instead I set up a qemu VM that way:
Make sure you select -cpu cortex-a53. If you boot with -cpu cortex-a72 translateLocally will compile, but will use instruction sets, which are not available on the native cortex-a53 CPU on the PinePhone. You can check and compare the instructions by:
mobian@mobian:~$ for t in param target; do cmd="gcc -Q -O2 --help=$t"; diff -U0 <(LANG=C $cmd) <(LANG=C $cmd -march=native); done
--- /dev/fd/63 2024-09-25 13:43:43.498193423 +0200
+++ /dev/fd/62 2024-09-25 13:43:43.506193512 +0200
@@ -3 +3 @@
- -march= armv8-a
+ -march= armv8-a+crypto+crc
and on a Cortex-A72:
for t in param target; do cmd="gcc -Q -O2 --help=$t"; diff -U0 <(LANG=C $cmd) <(LANG=C $cmd -march=native); done
--- /dev/fd/63 2024-09-24 20:43:02.773358011 +0000
+++ /dev/fd/62 2024-09-24 20:43:02.809357468 +0000
@@ -3 +3 @@
- -march= armv8-a
+ -march= armv8-a+crypto+crc+lse+rcpc+rdma+fp16fml+rng+sb+ssbs+sve2-sm4+sve2-aes+sve2-sha3+sve2-bitperm+i8mm+bf16+flagm+pauth
You can check the emulated CPU with lscpu.
If you use the Qemu VM -cpu max, then translateLocally won't compile and will fail with the following error:
/tmp/ccySen0g.s: Assembler messages:
/tmp/ccySen0g.s:14442: Error: selected processor does not support `eor3 v28.16b,v19.16b,v22.16b,v25.16b'
/tmp/ccySen0g.s:14456: Error: selected processor does not support `eor3 v5.16b,v19.16b,v1.16b,v4.16b'
/tmp/ccySen0g.s:14469: Error: selected processor does not support `eor3 v30.16b,v19.16b,v24.16b,v27.16b'
/tmp/ccySen0g.s:14482: Error: selected processor does not support `eor3 v5.16b,v19.16b,v2.16b,v6.16b'
/tmp/ccySen0g.s:14495: Error: selected processor does not support `eor3 v3.16b,v19.16b,v26.16b,v29.16b'
/tmp/ccySen0g.s:14508: Error: selected processor does not support `eor3 v5.16b,v19.16b,v20.16b,v6.16b'
make[2]: *** [3rd_party/bergamot-translator/3rd_party/marian-dev/src/3rd_party/sentencepiece/src/CMakeFiles/sentencepiece_train-static.dir/build.make:132: 3rd_party/bergamot-translator/3rd_party/marian-dev/src/3rd_party/sentencepiece/src/CMakeFiles/sentencepiece_train-static.dir/trainer_interface.cc.o] Error 1
At the first boot of the VM, you need to extend the file system, before you can install all dependencies:
The package libpcre++-dev is no longer available, but apparently also not required anymore. Since Debian Trixie and Ubuntu 24.04 the package libruy-dev is already available as deb package, but I didn't figure out how to link against the system package, instead of building its own 3rd-party package of libruy. Maybe with the system package, the Ruy hack around the inclusion of header files can be omitted.
The building translateLocally is straightforward:
git clone --recurse-submodules https://github.com/XapaJIaMnu/translateLocally.git
cd translateLocally
mkdir build
cd build
cmake ..
cmake/fix_ruy_build.sh .. .
make -j 4
Copy the resulting binary, as well as logo and desktop file onto the PinePhone, and into the right places, assuming ~/bin/ is in your $PATH directory:
I wanted to use translateLocally on my PinePhone, which is running mobian and has a Cortex-a53 CPU. I couldn't compile translateLocally directly on my phone, instead I set up a qemu VM that way:
The
nocloud
image has the default userroot
without password.Boot into the Qemu VM:
Make sure you select
-cpu cortex-a53
. If you boot with-cpu cortex-a72
translateLocally will compile, but will use instruction sets, which are not available on the nativecortex-a53
CPU on the PinePhone. You can check and compare the instructions by:and on a Cortex-A72:
You can check the emulated CPU with
lscpu
.If you use the Qemu VM
-cpu max
, then translateLocally won't compile and will fail with the following error:At the first boot of the VM, you need to extend the file system, before you can install all dependencies:
Then install all dependencies:
The package
libpcre++-dev
is no longer available, but apparently also not required anymore. Since Debian Trixie and Ubuntu 24.04 the packagelibruy-dev
is already available as deb package, but I didn't figure out how to link against the system package, instead of building its own 3rd-party package of libruy. Maybe with the system package, the Ruy hack around the inclusion of header files can be omitted.The building translateLocally is straightforward:
Copy the resulting binary, as well as logo and desktop file onto the PinePhone, and into the right places, assuming
~/bin/
is in your$PATH
directory:And install missing dependencies on the PinePhone:
This process also works on Bookworm, should you still run bookworm on your PinePhone.
And with that offline translations (in case you don't have mobile reception) is also working natively on the PinePhone now:
The text was updated successfully, but these errors were encountered: