Mozilla-Ocho / llamafile

Distribute and run LLMs with a single file.
https://llamafile.ai
Other
20.05k stars 1.01k forks source link

Failed to compile from sources @ Linux ("unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper") #225

Closed vitali2y closed 9 months ago

vitali2y commented 9 months ago

Hello, I failed to compile llamafile from sources on Linux Mint 21.2: make -j $(nproc) complained with unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper error:

➜  ~ cd ~/prjs/my_ai && git clone https://github.com/Mozilla-Ocho/llamafile.git && cd llamafile
~...~
➜  llamafile git:(main) make -j $(nproc)
~...~
2024-01-24 06:57:08 (11.1 MB/s) - ‘cosmocc.zip’ saved [177092620/177092620]
cosmocc.zip: OK
~...~
 extracting: x86_64-linux-cosmo/lib/libz.a  
  inflating: LICENSE.lgpl2           
finishing deferred symbolic links:
  libexec/gcc/aarch64-linux-cosmo/11.2.0/ld -> ld.bfd
  libexec/gcc/x86_64-linux-cosmo/11.2.0/ld -> ld.bfd
  bin/unknown-unknown-cosmo-c++ -> cosmocc
  bin/aarch64-unknown-cosmo-nm -> aarch64-linux-cosmo-nm
  bin/aarch64-linux-cosmo-as -> ../libexec/gcc/aarch64-linux-cosmo/11.2.0/as
  bin/aarch64-unknown-cosmo-strip -> aarch64-linux-cosmo-strip
  bin/aarch64-unknown-cosmo-readelf -> aarch64-linux-cosmo-readelf
  bin/x86_64-linux-cosmo-ld -> ../libexec/gcc/x86_64-linux-cosmo/11.2.0/ld.bfd
  bin/x86_64-unknown-cosmo-nm -> x86_64-linux-cosmo-nm
  bin/x86_64-unknown-cosmo-readelf -> x86_64-linux-cosmo-readelf
  bin/unknown-unknown-cosmo-install -> cosmoinstall
  bin/x86_64-unknown-cosmo-objcopy -> x86_64-linux-cosmo-objcopy
  bin/x86_64-unknown-cosmo-as -> x86_64-linux-cosmo-as
  bin/x86_64-linux-cosmo-ld.bfd -> ../libexec/gcc/x86_64-linux-cosmo/11.2.0/ld.bfd
  bin/x86_64-unknown-cosmo-objdump -> x86_64-linux-cosmo-objdump
  bin/x86_64-linux-cosmo-cpp -> x86_64-linux-cosmo-gcc
  bin/aarch64-unknown-cosmo-ar -> aarch64-linux-cosmo-ar
  bin/aarch64-unknown-cosmo-c++ -> cosmocross
  bin/aarch64-unknown-cosmo-addr2line -> aarch64-linux-cosmo-addr2line
  bin/x86_64-unknown-cosmo-ar -> x86_64-linux-cosmo-ar
  bin/aarch64-linux-cosmo-c++ -> aarch64-linux-cosmo-g++
  bin/x86_64-linux-cosmo-c++ -> x86_64-linux-cosmo-g++
  bin/x86_64-linux-cosmo-as -> ../libexec/gcc/x86_64-linux-cosmo/11.2.0/as
  bin/aarch64-linux-cosmo-cpp -> aarch64-linux-cosmo-gcc
  bin/x86_64-unknown-cosmo-c++filt -> x86_64-linux-cosmo-c++filt
  bin/unknown-unknown-cosmo-cc -> cosmocc
  bin/x86_64-unknown-cosmo-cc -> cosmocross
  bin/aarch64-linux-cosmo-ld.bfd -> ../libexec/gcc/aarch64-linux-cosmo/11.2.0/ld.bfd
  bin/x86_64-linux-cosmo-cc -> x86_64-linux-cosmo-gcc
  bin/x86_64-unknown-cosmo-strip -> x86_64-linux-cosmo-strip
  bin/aarch64-unknown-cosmo-cc -> cosmocross
  bin/aarch64-unknown-cosmo-objdump -> aarch64-linux-cosmo-objdump
  bin/aarch64-linux-cosmo-ld -> ../libexec/gcc/aarch64-linux-cosmo/11.2.0/ld.bfd
  bin/aarch64-linux-cosmo-cc -> aarch64-linux-cosmo-gcc
  bin/aarch64-unknown-cosmo-as -> aarch64-linux-cosmo-as
  bin/x86_64-unknown-cosmo-addr2line -> x86_64-linux-cosmo-addr2line
  bin/aarch64-unknown-cosmo-c++filt -> aarch64-linux-cosmo-c++filt
  bin/cosmoc++           -> cosmocc
  bin/x86_64-unknown-cosmo-c++ -> cosmocross
  bin/unknown-unknown-cosmo-ar -> cosmoar
  bin/aarch64-unknown-cosmo-objcopy -> aarch64-linux-cosmo-objcopy
.cosmocc/3.2.4/bin/cosmoc++ -g -O3 -fexceptions  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llama.cpp/main/main.o llama.cpp/main/main.cpp
.cosmocc/3.2.4/bin/cosmoc++ -g -O3 -fexceptions  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llama.cpp/server/server.o llama.cpp/server/server.cpp
.cosmocc/3.2.4/bin/cosmoc++ -g -O3 -fexceptions  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llama.cpp/llava/clip.o llama.cpp/llava/clip.cpp
.cosmocc/3.2.4/bin/cosmoc++ -g -O3 -fexceptions  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llama.cpp/llava/llava-cli.o llama.cpp/llava/llava-cli.cpp
.cosmocc/3.2.4/bin/cosmoc++ -g -O3 -fexceptions  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llama.cpp/llava/llava.o llama.cpp/llava/llava.cpp
.cosmocc/3.2.4/bin/cosmoc++ -g -O3 -fexceptions  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llama.cpp/llava/llava-quantize.o llama.cpp/llava/llava-quantize.cpp
.cosmocc/3.2.4/bin/cosmocc -g -O3 -fexceptions -DGGML_MULTIPLATFORM  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llamafile/addnl.o llamafile/addnl.c
.cosmocc/3.2.4/bin/cosmocc -g -O3 -fexceptions -DGGML_MULTIPLATFORM  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llamafile/check_cpu.o llamafile/check_cpu.c
.cosmocc/3.2.4/bin/cosmocc -g -O3 -fexceptions -DGGML_MULTIPLATFORM  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llamafile/cuda.o llamafile/cuda.c
.cosmocc/3.2.4/bin/cosmocc -g -O3 -fexceptions -DGGML_MULTIPLATFORM  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llamafile/extract.o llamafile/extract.c
.cosmocc/3.2.4/bin/cosmocc -g -O3 -fexceptions -DGGML_MULTIPLATFORM  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llamafile/get_app_dir.o llamafile/get_app_dir.c
.cosmocc/3.2.4/bin/cosmocc -g -O3 -fexceptions -DGGML_MULTIPLATFORM  -iquote. -mcosmo -DGGML_MULTIPLATFORM  -Xx86_64-mssse3 -c -o o//llamafile/get_tmp_dir.o llamafile/get_tmp_dir.c
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
run-detectors: run-detectors: run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemperunable to find an interpreter for .cosmocc/3.2.4/bin/mktemper

unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
make: *** [build/rules.mk:21: o//llama.cpp/llava/llava.o] Error 2
make: *** Waiting for unfinished jobs....
make: *** [build/rules.mk:21: o//llama.cpp/llava/llava-quantize.o] Error 2
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
make: *** [build/rules.mk:21: o//llama.cpp/llava/llava-cli.o] Error 2
make: *** [build/rules.mk:21: o//llama.cpp/server/server.o] Error 2
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
make: *** [build/rules.mk:21: o//llama.cpp/main/main.o] Error 2
make: *** [build/rules.mk:21: o//llama.cpp/llava/clip.o] Error 2
make: *** [build/rules.mk:12: o//llamafile/addnl.o] Error 2
make: *** [build/rules.mk:12: o//llamafile/cuda.o] Error 2
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
make: *** [build/rules.mk:12: o//llamafile/check_cpu.o] Error 2
make: *** [build/rules.mk:12: o//llamafile/extract.o] Error 2
make: *** [build/rules.mk:12: o//llamafile/get_tmp_dir.o] Error 2
make: *** [build/rules.mk:12: o//llamafile/get_app_dir.o] Error 2
➜  llamafile git:(main) .cosmocc/3.2.4/bin/mktemper --help
run-detectors: unable to find an interpreter for .cosmocc/3.2.4/bin/mktemper
➜  llamafile git:(main) uname -a                          
Linux greenway 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
➜  llamafile git:(main)
jart commented 9 months ago

Your distro is configured to block MZ shell scripts. You need to run these commands to fix it:

sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo chmod +x /usr/bin/ape
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"

See also https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#gotchas

thiagogcosta commented 2 weeks ago

Your distro is configured to block MZ shell scripts. You need to run these commands to fix it:

sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo chmod +x /usr/bin/ape
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"

See also https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#gotchas

Thank you very much!