Skip to content

Conversation

@abhinavkumar1203
Copy link

@abhinavkumar1203 abhinavkumar1203 commented Jun 13, 2025

This PR updates the lib-sqlite Unikraft library to SQLite version 3.50.1

Major changes:
Upgraded source to SQLite 3.50.1
Updated SHA256 hash accordingly for upstream zip
Patch 0001 disables math.h usage to ensure compatibility with Unikraft nolibc/libc
Patch 0002 stubs out unsupported POSIX syscalls (close, access, getcwd, ftruncate, read, pread)
Added wrapper header sqlite_syswrap.h and source sqlite_syswrap.c

Notes

Initially targeted 3.45.3 when latest release was unavailable
Version 3.50.1 became stable after work had started — now upgraded
math.h dependency removed and syscalls stubbed via patches

Tested with app-helloworld on qemu-x86_64.

@abhinavkumar1203 abhinavkumar1203 changed the title Update SQLite to version 3450300 and ensure Unikraft compatibility Update SQLite to version 3.50.1 and ensure Unikraft compatibility Jun 16, 2025
Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments from my side

name := "sqlite"
description := "A C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine."
name := "libsqlite"
description := "A C-language library that implements a small, fast, self-contained SQL database engine"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove some of the adjectives describing it? 😅

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the name to match the convention.
Screenshot 2025-06-23 at 1 44 41 AM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks the same to me

Comment on lines +61 to +66
LIBSQLITE_FLAGS = -D_HAVE_SQLITE_CONFIG_H \
-DSQLITE_OMIT_LOAD_EXTENSION \
-DSQLITE_OMIT_LOCALTIME \
-DSQLITE_OS_UNIX=0 \
-DSQLITE_OS_OTHER=1 \
-DSQLITE_THREADSAFE=0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to try this out and I'll report back if ok

LIBSQLITE_SRCS-y += $(LIBSQLITE_SRC)/sqlite3.c
LIBSQLITE_OBJS-y := $(LIBSQLITE_SRCS-y:.c=.o)
$(eval $(call addlibobjs,libsqlite,$(LIBSQLITE_OBJS-y)))
$(eval $(call addlib_s,libsqlite,$(CONFIG_LIBSQLITE)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be placed up top? I'm looking at Nginx https://github.com/unikraft/lib-nginx/blob/staging/Makefile.uk#L37-L40

Copy link
Author

@abhinavkumar1203 abhinavkumar1203 Jun 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the addlibobjs and addlib_s logic up top for consistency with other Unikraft libraries

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but they are in the same place?

Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some more comments, looks like you didn't commit some stuff? Also please test it and try running a simple query inside it

Comment on lines +1 to +4
imply LIBUKMMAP
select LIBPOSIX_SYSINFO
depends on HAVE_LIBC
select LIBPTHREAD_EMBEDDED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to sit inside the menuconfig option. Did kraft menuconfig even work?

name := "sqlite"
description := "A C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine."
name := "libsqlite"
description := "A C-language library that implements a small, fast, self-contained SQL database engine"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks the same to me

Comment on lines +44 to +46
LIBSQLITE_URL = https://www.sqlite.org/2025/$(LIBSQLITE_BASENAME).zip
LIBSQLITE_PATCHDIR = $(LIBSQLITE_BASE)/patches
LIBSQLITE_SRC = $(LIBSQLITE_ORIGIN)/$(LIBSQLITE_BASENAME)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say either align all, or align none in these cases

LIBSQLITE_SRCS-y += $(LIBSQLITE_SRC)/sqlite3.c
LIBSQLITE_OBJS-y := $(LIBSQLITE_SRCS-y:.c=.o)
$(eval $(call addlibobjs,libsqlite,$(LIBSQLITE_OBJS-y)))
$(eval $(call addlib_s,libsqlite,$(CONFIG_LIBSQLITE)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but they are in the same place?

@craciunoiuc craciunoiuc self-requested a review June 23, 2025 07:41
Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong click sorry

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants