asg017 / sqlite-vss

A SQLite extension for efficient vector search, based on Faiss!
MIT License
1.59k stars 58 forks source link

Linux arm64 #82

Open metaskills opened 11 months ago

metaskills commented 11 months ago

Using a M2 Mac with development containers. Target deploy will be an AWS Lambda which can be x86 or arm64. However, I'm kind of blocked right now developing since all my devcontainers just naturally match my current platform, arm64. Looking into docs now on compiling, will report any issues... https://github.com/asg017/sqlite-vss/blob/main/docs.md

metaskills commented 11 months ago

Trying to debug this.

> make loadable-release
make: *** No rule to make target `loadable-release'.  Stop.
asg017 commented 11 months ago

Can you ls to make sure there's a Makefile in your directory? Could also try make loadable but both should work

metaskills commented 11 months ago

Some updates on this. First, the "No rule to make target" was my own fault. I forgot to cd up a few directories. I've been having a hard time with Amazon Linux 2 (I always do) WRT getting things built from source. Things were looking good like they may work in my devcontainer with this:

FROM public.ecr.aws/sam/build-nodejs18.x
RUN yum update -y && \
    yum install -y libgomp atlas-devel lapack-devel sqlite-devel cmake3 && \
    /usr/sbin/update-alternatives --install /usr/bin/cmake cmake /usr/bin/cmake3 1

Like I had to get cmake 3 installed vs the default of v2. For record keeping, here is where things ended up.

However, I kept hitting this with make loadable-release. I even tried installing gcc v9 instead of AML2 v7. No luck.

mkdir -p dist/debug
mkdir -p dist/release
cmake -DCMAKE_BUILD_TYPE=Release -B build_release; make -C build_release
CMake Error: The source directory "" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
make: *** build_release: No such file or directory.  Stop.
make: *** [dist/release/vector0.so] Error 2

I'm gonna pivot a bit and fork the project and see if I can contribute a pull request for building with GitHub Actions and QEMU. I've had tons of experience doing this in the https://github.com/rails-lambda projects for multi-platform support. It is a little slow but gets the job done till GitHub finally releases their own arm64 runners.

Any thoughts?

metaskills commented 11 months ago

Currently testing building on ghcr.io/catthehacker/ubuntu:act-22.04 which mimics GitHub Actions runners and has the version of cmake needed as well as arm64 image support. Found this along the way:

metaskills commented 11 months ago

OK, here is where I am. Summary with details below:

I created a fork here (https://github.com/metaskills/sqlite-vss/tree/LinuxArm64) with a single commit to prototype building a sqlite-vss-linux-arm64 npm test package. I used the ghcr.io/catthehacker/ubuntu:act-22.04 container from the act project (https://github.com/nektos/act). I chose this for a few reasons. 1) Mimics GitHub Actions Runners 2) Is a multi-platform image 3) CMake is of sufficient version. My full notes on the build and test package here:

https://github.com/metaskills/sqlite-vss/commit/474e2daf266792842866a47a9b9586f5c9129915#diff-fbc3aef752b70d1a9396dd71d18baf5e8a99b18ac31f8e8ba8143020bfe3be17

Will report back after I switch my Lambda Container project from AL2 to Ubuntu.

metaskills commented 11 months ago

SUCCESS! Had to use a Debian bookwork image to get GLIBC up far enough. Details here:

https://github.com/metaskills/sqlite-vss/commit/f2c95cdecd1d4e4ef9390ba6232b08c038063f7b

So, is GLIBC v2.32 or higher a requirement? Cloud not find any mention of it.

neilkinnish commented 11 months ago

@metaskills 👋 did you manage to deploy this on AWS lambda?

metaskills commented 11 months ago

No, not gotten that far. Should be easy, just package it up in a container using the same local version I built. Will get there in the coming days/weeks.

asg017 commented 11 months ago

Hey @metaskills , thanks again for your hard work here! I do intend to dig into this + ship linux-arm64 version of sqlite-vss to Python/Ruby/Node.js etc. I got sick this week so I'll be out for a few days, but fully intend to get back to this when I get better!

metaskills commented 11 months ago

Thanks, take your time. I am unblocked, so no rush. I still have a TON of AI learning to do before having a turn-key linux arm npm package would be a concern. Cheers!

neilkinnish commented 11 months ago

thanks @metaskills.

Had a play this morning with your fork... have it running on lambda 👍

Hope you feel better @asg017