SQLite User Forum

Build in subdirectory fails with 3.49.0
Login

Build in subdirectory fails with 3.49.0

(1) By Rudi Heitbaum (heitbaum) on 2025-02-07 05:44:07 [source]

When building in subdirectory (like we did with 3.48.0) we fail the build with:

Executing (target): make 
make: *** No rule to make target 'sqlite3.h', needed by 'sqlite3.o'.  Stop.
…

The diff to allow the build to complete is:

--- a/Makefile.in   2025-02-06 13:59:25.000000000 +0000
+++ b/Makefile.in 2025-02-07 05:29:19.583787963 +0000
@@ -123,8 +123,8 @@
 LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@
 CFLAGS.libsqlite3 = -I. $(CFLAGS.core) $(CFLAGS.icu) $(OPT_FEATURE_FLAGS)
 
-sqlite3.o:     sqlite3.h sqlite3.c
-       $(CC) -c sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3)
+sqlite3.o:     $(TOP)/sqlite3.h $(TOP)/sqlite3.c
+       $(CC) -c $(TOP)/sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3)
 
 libsqlite3.LIB = libsqlite3$(T.lib)
 libsqlite3.SO = libsqlite3$(T.dll)
@@ -169,9 +169,9 @@
 install: install-lib
 
 
-sqlite3$(T.exe):       shell.c sqlite3.c
+sqlite3$(T.exe):       $(TOP)/shell.c $(TOP)/sqlite3.c
        $(CC) -o $@ \
-               shell.c sqlite3.c \
+               $(TOP)/shell.c $(TOP)/sqlite3.c \
                -I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \
                $(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \
                $(LDFLAGS) $(LDFLAGS.libsqlite3) $(LDFLAGS.readline)
@@ -181,16 +181,16 @@
        $(INSTALL.strip) sqlite3$(T.exe) "$(install-dir.bin)"
 install: install-shell
 
-install-headers: sqlite3.h $(install-dir.include)
-       $(INSTALL.noexec) sqlite3.h sqlite3ext.h "$(install-dir.include)"
+install-headers: $(TOP)/sqlite3.h $(install-dir.include)
+       $(INSTALL.noexec) $(TOP)/sqlite3.h $(TOP)/sqlite3ext.h "$(install-dir.include)"
 install: install-headers
 
 install-pc: sqlite3.pc $(install-dir.pkgconfig)
        $(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)"
 install: install-pc
 
-install-man1: sqlite3.1 $(install-dir.man1)
-       $(INSTALL.noexec) sqlite3.1 "$(install-dir.man1)"
+install-man1: $(TOP)/sqlite3.1 $(install-dir.man1)
+       $(INSTALL.noexec) $(TOP)/sqlite3.1 "$(install-dir.man1)"
 install: install-man1
 
 clean:

(2.1) By Stephan Beal (stephan) on 2025-02-07 11:21:57 edited from 2.0 in reply to 1 [link] [source]

When building in subdirectory (like we did with 3.48.0) we fail the build with:

An out-of-tree build apparently does not work on the recently-reworked "autoconf" bundle (my fault!). We'll get that fixed asap, but if you need to do this again without patching your copy, the canonical source tree ("sqlite-src-VERSION.zip" on the downloads page) will build properly out-of-tree.

Edit: that's now fixed in the trunk and the 3.48 branch. Thank you for the report!