Skip to content

Hello. How to build with sqlite? #34

Open

Description

@Petrunak

Hello. I have a problem after compile it.
I need to add sqlite3 to this.
How can i do it?
I tried to add this in docker-build.sh, but i get a problem.
My docker file :
`#!/bin/bash

set -e
set -x

apt-get update -y
apt-get install -y autoconf-archive autoconf automake cmake gawk gettext git gcc make patch pkg-config libsqlite3-dev
pip install pysqlite3

export ANDROID_NDK=/android-ndk

if [ ! -d "$ANDROID_NDK" ] ; then
# In general we don't want download NDK for every build, but it is simpler to do it here
# for CI builds
NDK_VER=r25b
apt-get install -y wget zip
wget --no-verbose https://dl.google.com/android/repository/android-ndk-$NDK_VER-linux.zip
unzip android-ndk-${NDK_VER}-linux.zip
ANDROID_NDK=/android-ndk-$NDK_VER
fi

cd /python3-android

./build.sh "$@"`

I have this error on my phone
`SyntaxError: invalid syntax

import sqlite3
Traceback (most recent call last):
File "", line 1, in
File "/data/local/tmp/build/usr/lib/python3.11/sqlite3/init.py", line 57, in
from sqlite3.dbapi2 import *
File "/data/local/tmp/build/usr/lib/python3.11/sqlite3/dbapi2.py", line 27, in
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
`
Where can i add sqlite3 module?

Activity

  1. Petrunak commented on Jul 27, 2023

    @Petrunak
    Author

    I find build_deps.py and try to build it.
    My command line is sudo python3 build_deps.py --arch arm64 --api 25
    % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3499k 100 3499k 0 0 1764k 0 0:00:01 0:00:01 --:--:-- 1764k DEBUG:__main__:Running in /home/test/Downloads/python3-android-master/Android/deps/ncurses-6.3: ./configure --prefix=/usr --libdir=/usr/lib --host=aarch64-linux-android --disable-shared --without-ada --enable-widec --without-debug --without-cxx-binding --disable-stripping configure: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used. checking for ggrep... no checking for grep... grep checking for egrep... grep -E Configuring NCURSES 6.3 ABI 6 (Thu Jul 27 17:30:56 EET 2023) checking for package version... 6.3 checking for package patch date... 20211021 checking build system type... x86_64-pc-linux-gnu checking host system type... aarch64-unknown-linux-android checking target system type... aarch64-unknown-linux-android Configuring for linux-android checking for fgrep... grep -F checking for prefix... /usr checking for aarch64-linux-android-gcc... /home/test/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android25-clang checking for C compiler default output... configure: error: C compiler cannot create executables Traceback (most recent call last): File "/home/test/Downloads/python3-android-master/Android/build_deps.py", line 172, in <module> main() File "/home/test/Downloads/python3-android-master/Android/build_deps.py", line 169, in main build_package(pkg_cls(args.target_arch_name, args.android_api_level)) File "/home/test/Downloads/python3-android-master/Android/build_deps.py", line 147, in build_package pkg.build() File "/home/test/Downloads/python3-android-master/Android/build_deps.py", line 25, in build self.configure() File "/home/test/Downloads/python3-android-master/Android/build_deps.py", line 30, in configure self.run([ File "/home/test/Downloads/python3-android-master/Android/build_deps.py", line 22, in run subprocess.check_call(cmd, cwd=cwd) File "/usr/lib/python3.11/subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['./configure', '--prefix=/usr', '--libdir=/usr/lib', '--host=aarch64-linux-android', '--disable-shared', '--without-ada', '--enable-widec', '--without-debug', '--without-cxx-binding', '--disable-stripping']' returned non-zero exit status 77.
    How can i fix it?

  2. Petrunak commented on Jul 27, 2023

    @Petrunak
    Author

    The problem above was due to the wrong android sdk version. I can to build sqlite and others via build_deps.py. Then I download them to my phone. But again, the error ModuleNotFoundError: No module named '_sqlite3' is silent.
    Perhaps the problem is due to the fact that the docker uses python slim?

  3. anshm-2166 commented on Feb 21, 2024

    @anshm-2166

    @GRRedWings Any news about this issue?

  4. GRRedWings commented on Feb 21, 2024

    @GRRedWings
    Owner

    I haven't spent a lot of time working on this. I know the most recent version of Python broke the build. If you look at the API26 branch, I feel that is pretty stable and you could try to build off that and see if you have any better luck.

  5. anshm-2166 commented on Feb 23, 2024

    @anshm-2166

    @GRRedWings

    Python 3.12.1 (main, Feb 23 2024, 21:00:23) [Clang 17.0.2 (https://android.googlesource.com/toolchain/llvm-project d9f89f4d1 on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    Traceback (most recent call last):
      File "/data/data/org.softbuddy.pythonx/files/usr/lib/python3.12/datetime.py", line 2, in <module>
        from _datetime import *
    ImportError: dlopen failed: cannot locate symbol "PyTuple_Type" referenced by "/data/data/org.softbuddy.pythonx/files/usr/lib/python3.12/lib-dynload/_datetime.cpython-312.so"...
    
  6. anshm-2166 commented on Feb 23, 2024

    @anshm-2166

    I kind of faced a similar error in previous time while cross compiling some python modules (namely, numpy) which i fixed later by linking the libraries with libpython.... .so which fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions