Building APSW for Pyodide

25 views
Skip to first unread message

AKHILESH AIREN

unread,
Aug 20, 2024, 4:20:06 AM8/20/24
to python-sqlite
Hi Team,

I am trying to build APSW to use with Pyodide following steps from below link:


I pulled apsw code and copied sqlite3.c and sqlit3.h file in src folder, but now it is showing me below error:

/tmp/tmpt8tky0so/cc build/temp.emscripten_3_1_58_wasm32-cpython-312/src/apsw.o -lsqlite3 -o build/lib.emscripten_3_1_58_wasm32-cpython-312/apsw/__init__.cpython-312-wasm32-emscripten.so
wasm-ld: error: unable to find library -lsqlite3
emcc: error: '/home/scc_av/temp/pyodide/emsdk/upstream/bin/wasm-ld -o build/lib.emscripten_3_1_58_wasm32-cpython-312/apsw/__init__.cpython-312-wasm32-emscripten.so build/temp.emscripten_3_1_58_wasm32-cpython-312/src/apsw.o -lsqlite3 --fatal-warnings -L/home/scc_av/temp/pyodide/apsw/.pyodide-xbuildenv-0.28.0/0.26.2/xbuildenv/pyodide-root/cpython/installs/python-3.12.1/lib/ -L/home/scc_av/temp/pyodide/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-memory --strip-debug --export=PyInit_apsw --export=__wasm_call_ctors --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__wasm_apply_data_relocs --experimental-pic --unresolved-symbols=import-dynamic -shared --no-export-dynamic' failed (returned 1)
error: command '/tmp/tmpt8tky0so/cc' failed with exit code 1

Can you provide any help to generate package for APSW in Pyodide?

Thanks

Roger Binns

unread,
Aug 20, 2024, 12:00:31 PM8/20/24
to Python-SQLite group
> I pulled apsw code and copied sqlite3.c and sqlit3.h file in src
> folder, but now it is showing me below error:

They should be in a folder named sqlite3, not src to be directly included. Near the top of the build you will see a line like one of the following telling you how SQLite is found.

SQLite: Using amalgamation ..../sqlite3.c
SQLite: Using system sqlite include/libraries

> Can you provide any help to generate package for APSW in Pyodide?

A simpler approach is to use the cibuildwheel tool locally.

# start in a clean working directory and make a virtual env
$ python3 -m venv venv

# Get latest APSW source from PyPI - this source will also download SQLite
$ venv/bin/pip download --no-deps --no-binary :all: apsw

# install cibuildwheel
$ venv/bin/pip install cibuildwheel

# build against source archive
$ venv/bin/cibuildwheel --platform pyodide apsw-3.46.1.0.tar.gz

# After a while and a success message, check the results
$ ls wheelhouse
apsw-3.46.1.0-cp312-cp312-pyodide_2024_0_wasm32.whl

PyPI doesn't allow publishing pyodide wheels yet. Once it does, APSW will be available there.

Roger


AKHILESH AIREN

unread,
Aug 20, 2024, 11:56:22 PM8/20/24
to python-sqlite
Awesome, thanks a lot!!
Reply all
Reply to author
Forward
0 new messages