SQLite User Forum

3.49.1 cross compile static build failed in some platforms (x86_64-linux, aarch64-linux, mips-linux)
Login

3.49.1 cross compile static build failed in some platforms (x86_64-linux, aarch64-linux, mips-linux)

(1) By Feng Yu (abcfy2) on 2025-02-24 02:50:58 [link] [source]

All failed build can be found: https://github.com/abcfy2/aria2-static-build/actions/runs/13489649065/job/37685730825

aarch64 failed log:

aarch64-unknown-linux-musl-cc -o sqlite3 \
	/usr/src/sqlite-3.49.1/shell.c /usr/src/sqlite-3.49.1/sqlite3.c -Wl,-rpath,/cross_root/aarch64-unknown-linux-musl/lib    -lz   -L/cross_root/aarch64-unknown-linux-musl/lib64 -L/cross_root/aarch64-unknown-linux-musl/lib -I/cross_root/aarch64-unknown-linux-musl/include -s -static --static \
	-I. -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1 -DSQLITE_HAVE_ZLIB=1 \
	-O2    \
	-L/cross_root/aarch64-unknown-linux-musl/lib64 -L/cross_root/aarch64-unknown-linux-musl/lib -I/cross_root/aarch64-unknown-linux-musl/include -s -static --static 
aarch64-unknown-linux-musl-cc -o libsqlite3.so  sqlite3.o -shared \
	-L/cross_root/aarch64-unknown-linux-musl/lib64 -L/cross_root/aarch64-unknown-linux-musl/lib -I/cross_root/aarch64-unknown-linux-musl/include -s -static --static -Wl,-rpath,/cross_root/aarch64-unknown-linux-musl/lib    -lz   -L/cross_root/aarch64-unknown-linux-musl/lib64 -L/cross_root/aarch64-unknown-linux-musl/lib -I/cross_root/aarch64-unknown-linux-musl/include -s -static --static \
	 
aarch64-unknown-linux-musl-ar cr libsqlite3.a sqlite3.o
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(getenv.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__environ' which may bind externally can not be used when making a shared object; recompile with -fPIC
/cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(getenv.o): in function `getenv':
getenv.c:(.text.getenv+0x24): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__tzname' which may bind externally can not be used when making a shared object; recompile with -fPIC
/cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): in function `do_tzset':
__tz.c:(.text.do_tzset+0x2a8): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__timezone' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.do_tzset+0x2c0): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__daylight' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.do_tzset+0x2f0): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__tzname' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.do_tzset+0x510): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__daylight' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.do_tzset+0x518): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__timezone' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.do_tzset+0x520): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__daylight' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.do_tzset+0x60c): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__daylight' which may bind externally can not be used when making a shared object; recompile with -fPIC
/cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): in function `__secs_to_zone':
__tz.c:(.text.__secs_to_zone+0x2a4): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__timezone' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.__secs_to_zone+0x334): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__timezone' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.__secs_to_zone+0x360): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__tzname' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.__secs_to_zone+0x38c): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__timezone' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.__secs_to_zone+0x3e0): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__tzname' which may bind externally can not be used when making a shared object; recompile with -fPIC
__tz.c:(.text.__secs_to_zone+0x3f0): dangerous relocation: unsupported relocation
/cross_root/bin/../lib/gcc/aarch64-unknown-linux-musl/14.2.0/../../../../aarch64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__tzname' which may bind externally can not be used when making a shared object; recompile with -fPIC
/cross_root/bin/../aarch64-unknown-linux-musl/sysroot/usr/lib/../lib64/libc.a(__tz.o): in function `__tm_to_tzname':
__tz.c:(.text.__tm_to_tzname+0x34): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
make: *** [Makefile:149: libsqlite3.so] Error 1
make: *** Waiting for unfinished jobs....

mips failed log:

mips-unknown-linux-musl-cc -o sqlite3 \
	/usr/src/sqlite-3.49.1/shell.c /usr/src/sqlite-3.49.1/sqlite3.c -Wl,-rpath,/cross_root/mips-unknown-linux-musl/lib    -lz   -L/cross_root/mips-unknown-linux-musl/lib64 -L/cross_root/mips-unknown-linux-musl/lib -I/cross_root/mips-unknown-linux-musl/include -s -static --static \
	-I. -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1 -DSQLITE_HAVE_ZLIB=1 \
	-O2    \
	-L/cross_root/mips-unknown-linux-musl/lib64 -L/cross_root/mips-unknown-linux-musl/lib -I/cross_root/mips-unknown-linux-musl/include -s -static --static 
mips-unknown-linux-musl-cc -o libsqlite3.so  sqlite3.o -shared \
	-L/cross_root/mips-unknown-linux-musl/lib64 -L/cross_root/mips-unknown-linux-musl/lib -I/cross_root/mips-unknown-linux-musl/include -s -static --static -Wl,-rpath,/cross_root/mips-unknown-linux-musl/lib    -lz   -L/cross_root/mips-unknown-linux-musl/lib64 -L/cross_root/mips-unknown-linux-musl/lib -I/cross_root/mips-unknown-linux-musl/include -s -static --static \
	 
mips-unknown-linux-musl-ar cr libsqlite3.a sqlite3.o
/cross_root/bin/../lib/gcc/mips-unknown-linux-musl/14.2.0/crtbeginT.o: in function `deregister_tm_clones':
crtstuff.c:(.text+0x0): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x4): relocation R_MIPS_HI16 against `__TMC_END__' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x14): relocation R_MIPS_HI16 against `__gnu_local_gp' cannot be used when making a shared object; recompile with -fPIC
/cross_root/bin/../lib/gcc/mips-unknown-linux-musl/14.2.0/crtbeginT.o: in function `register_tm_clones':
crtstuff.c:(.text+0x3c): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x40): relocation R_MIPS_HI16 against `__TMC_END__' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x64): relocation R_MIPS_HI16 against `__gnu_local_gp' cannot be used when making a shared object; recompile with -fPIC
/cross_root/bin/../lib/gcc/mips-unknown-linux-musl/14.2.0/crtbeginT.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x94): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x98): relocation R_MIPS_HI16 against `__gnu_local_gp' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0xb0): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0xd4): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
/cross_root/bin/../lib/gcc/mips-unknown-linux-musl/14.2.0/crtbeginT.o: in function `frame_dummy':
crtstuff.c:(.text+0xf8): relocation R_MIPS_HI16 against `__gnu_local_gp' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x118): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x11c): relocation R_MIPS_HI16 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
crtstuff.c:(.text+0x134): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
collect2: error: ld returned 1 exit status
make: *** [Makefile:149: libsqlite3.so] Error 1
make: *** Waiting for unfinished jobs....
Error: Process completed with exit code 2.

x86_64 failed log:

x86_64-unknown-linux-musl-cc -c /usr/src/sqlite-3.49.1/sqlite3.c -o sqlite3.o -O2  -I. -fPIC  -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1
x86_64-unknown-linux-musl-cc -o sqlite3 \
	/usr/src/sqlite-3.49.1/shell.c /usr/src/sqlite-3.49.1/sqlite3.c -Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib    -lz   -L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static \
	-I. -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1 -DSQLITE_HAVE_ZLIB=1 \
	-O2    \
	-L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static 
x86_64-unknown-linux-musl-cc -o libsqlite3.so  sqlite3.o -shared \
	-L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static -Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib    -lz   -L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static \
	 
x86_64-unknown-linux-musl-ar cr libsqlite3.a sqlite3.o
/cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/../../../../x86_64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/../../../../x86_64-unknown-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:149: libsqlite3.so] Error 1
make: *** Waiting for unfinished jobs....
Error: Process completed with exit code 2.

(2) By Stephan Beal (stephan) on 2025-02-24 03:10:56 in reply to 1 [source]

3.49.1 cross compile static build failed in some platforms

i will look into these over the next couple of days but can make no promises. Cross-compiling between arbitrary environments is not something we have the bandwidth to actively support.

Many of these errors are clearly from the environment, not our build tools, e.g.:

crtbeginT.o: relocation R_X86_64_32 against hidden symbol `TMC_END' can not be used when making a shared object

That's not one of our object files.

Regarding the PIC warnings: our build unconditionally uses PIC if the compiler claims to support it. You can try working around those by passing -fPIC to your CFLAGS, we can't add it to the build if the toolchain claims not to support it.

(3) By Feng Yu (abcfy2) on 2025-02-24 03:26:28 in reply to 2 [link] [source]

Thank you very much. But all of them successed in 3.49.0: https://github.com/abcfy2/aria2-static-build/actions/runs/13217382189/job/36898244086

It would be great if these problems could be solved. Anyway, thank you for your hard work.

(4) By Stephan Beal (stephan) on 2025-02-24 04:38:52 in reply to 3 [link] [source]

But all of them successed in 3.49.0:

i'm at a complete loss to explain how the errors you've shown us could appear in 3.49.1 but not 3.49.0, and i'm wondering whether you are still suffering from the "release" tag problem. We made many build-related changes between those versions, but the errors you're reporting cannot be explained by those differences.

Your build log:

https://github.com/abcfy2/aria2-static-build/actions/runs/13217382189/job/36898244086

initially showed me many errors but is now showing up 100% "green", with no errors, so i'm going to assume for the time being that the errors were related to the release tag problem.

(5) By Feng Yu (abcfy2) on 2025-02-24 09:44:59 in reply to 4 [link] [source]

Hi stephan.

This is another github CI for release: https://github.com/abcfy2/aria2-static-build/releases/tag/1.37.0

sqlite: Version: 3.49.0, source: https://github.com/sqlite/sqlite/archive/release.tar.gz

The Version in this line is grep from sqlite3.pc file.

And I have other discoveries:

When I download source code from github tags, like https://github.com/sqlite/sqlite/archive/refs/tags/version-3.49.1.tar.gz, the build is working:

renamed '/build/downloads/sqlite-3.49.1.tar.gz.part' -> '/build/downloads/sqlite-3.49.1.tar.gz'
Host System...x86_64-unknown-linux-musl
Build System...x86_64-pc-linux-gnu
C compiler... x86_64-unknown-linux-musl-cc  
C++ compiler... x86_64-unknown-linux-musl-c++  
Build C compiler...cc
Checking for stdlib.h...ok
Source dir = /usr/src/sqlite-3.49.1
Build dir  = /usr/src/sqlite-3.49.1
Configuring SQLite version 3.49.1
Looking for install ... /usr/bin/install
Checking for int8_t...ok
Checking for int16_t...ok
Checking for int32_t...ok
Checking for int64_t...ok
Checking for intptr_t...ok
Checking for uint8_t...ok
Checking for uint16_t...ok
Checking for uint32_t...ok
Checking for uint64_t...ok
Checking for uintptr_t...ok
Checking for gmtime_r...ok
Checking for isnan...not found
Checking for localtime_r...ok
Checking for localtime_s...not found
Checking for malloc_usable_size...ok
Checking for strchrnul...ok
Checking for usleep...ok
Checking for utime...ok
Checking for pread...ok
Checking for pread64...not found
Checking for pwrite...ok
Checking for pwrite64...not found
Checking libs for fdatasync...none needed
Checking libs for nanosleep...none needed
Checking for sys/types.h...ok
Checking for sys/stat.h...ok
Checking for dlfcn.h...ok
Checking for unistd.h...ok
Checking for stdlib.h...ok
Checking for malloc.h...ok
Checking for memory.h...ok
Checking for string.h...ok
Checking for strings.h...ok
Checking for inttypes.h...ok
Checking for zlib.h...ok
Checking libs for deflate...-lz
Checking for sys/types.h...(cached) ok
Checking if -D_FILE_OFFSET_BITS=64 is needed...no
Build shared library? no
Build static library? yes
Use amalgamation for builds? yes
Use gcov? no
test-runner flags: no
Use #line macros in the amalgamation: no
Checking whether the C compiler accepts -rpath /cross_root/x86_64-unknown-linux-musl/lib...no
Checking whether the C compiler accepts -Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib...yes
SQLITE_DEBUG build? no
Checking for a suitable tcl... 
Checking for tclsh9.0...no
Checking for tclsh8.6.../usr/bin/tclsh8.6
WARNING: /usr/bin/tclsh8.6 is unable to recommend a tclConfig.sh
Using tclsh: /usr/bin/tclsh8.6
WARNING: Found tclsh but no tclConfig.sh.

    WARNING: Cannot find a usable tclConfig.sh file.  Use
    --with-tcl=DIR to specify a directory where tclConfig.sh can be
    found.  SQLite does not use TCL internally, but some optional
    components require TCL, including tests and sqlite3_analyzer.

Checking for TCL to use for code generation... 
Checking for dirent.h...ok
Checking for sys/time.h...ok
Checking for realpath...ok
TCL for code generation: jimsh
Support threadsafe operation? Checking for libs...
Checking libs for pthread_create...none needed
Checking libs for pthread_mutexattr_init...none needed
Checking for line-editing capability...
Line-editing support for the sqlite3 shell: none
WARNING: Skipping check for readline.h because we're cross-compiling.
Checking libs for dlopen...none needed
Loadable extension support enabled.
Checking libs for ceil...none needed
Enabling math SQL functions 
ICU support is disabled.
Emscripten SDK? not found
Feature flags...
  - fts4
  - fts5
  - geopoly
  - rtree
  - session
  - update-limit
  - memsys5
  - memsys3
  - scanstatus
  + json
Library feature flags: -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1
Shell options: -DSQLITE_HAVE_ZLIB=1
Created Makefile from Makefile.in
Created sqlite3.pc from sqlite3.pc.in
Created sqlite_cfg.h
cc -g -o jimsh -O1 -DHAVE_REALPATH /usr/src/sqlite-3.49.1/autosetup/jimsh0.c
cc -g -o mkkeywordhash -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1   /usr/src/sqlite-3.49.1/tool/mkkeywordhash.c
cc -g -o src-verify /usr/src/sqlite-3.49.1/tool/src-verify.c
touch .main.mk.checks
cc -g -o mksourceid /usr/src/sqlite-3.49.1/tool/mksourceid.c
cc -g -o lemon /usr/src/sqlite-3.49.1/tool/lemon.c
./mkkeywordhash > keywordhash.h
cp /usr/src/sqlite-3.49.1/tool/lempar.c .
cp /usr/src/sqlite-3.49.1/src/parse.y .
cp /usr/src/sqlite-3.49.1/ext/fts5/fts5parse.y .
./lemon -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1   -S parse.y
rm -f fts5parse.h
./lemon  -S fts5parse.y
./jimsh /usr/src/sqlite-3.49.1/tool/mksqlite3h.tcl /usr/src/sqlite-3.49.1 -o sqlite3.h
cat parse.h /usr/src/sqlite-3.49.1/src/vdbe.c | ./jimsh /usr/src/sqlite-3.49.1/tool/mkopcodeh.tcl >opcodes.h
./jimsh /usr/src/sqlite-3.49.1/tool/mkshellc.tcl shell.c
./jimsh /usr/src/sqlite-3.49.1/ext/fts5/tool/mkfts5c.tcl
./jimsh /usr/src/sqlite-3.49.1/tool/mkopcodec.tcl opcodes.h >opcodes.c
cp /usr/src/sqlite-3.49.1/ext/fts5/fts5.h .
rm -rf tsrc
mkdir tsrc
cp -f /usr/src/sqlite-3.49.1/src/alter.c /usr/src/sqlite-3.49.1/src/analyze.c /usr/src/sqlite-3.49.1/src/attach.c /usr/src/sqlite-3.49.1/src/auth.c /usr/src/sqlite-3.49.1/src/backup.c /usr/src/sqlite-3.49.1/src/bitvec.c /usr/src/sqlite-3.49.1/src/btmutex.c /usr/src/sqlite-3.49.1/src/btree.c /usr/src/sqlite-3.49.1/src/btree.h /usr/src/sqlite-3.49.1/src/btreeInt.h /usr/src/sqlite-3.49.1/src/build.c /usr/src/sqlite-3.49.1/src/callback.c /usr/src/sqlite-3.49.1/src/complete.c /usr/src/sqlite-3.49.1/src/ctime.c /usr/src/sqlite-3.49.1/src/date.c /usr/src/sqlite-3.49.1/src/dbpage.c /usr/src/sqlite-3.49.1/src/dbstat.c /usr/src/sqlite-3.49.1/src/delete.c /usr/src/sqlite-3.49.1/src/expr.c /usr/src/sqlite-3.49.1/src/fault.c /usr/src/sqlite-3.49.1/src/fkey.c /usr/src/sqlite-3.49.1/src/func.c /usr/src/sqlite-3.49.1/src/global.c /usr/src/sqlite-3.49.1/src/hash.c /usr/src/sqlite-3.49.1/src/hash.h /usr/src/sqlite-3.49.1/src/hwtime.h /usr/src/sqlite-3.49.1/src/insert.c /usr/src/sqlite-3.49.1/src/json.c /usr/src/sqlite-3.49.1/src/legacy.c /usr/src/sqlite-3.49.1/src/loadext.c /usr/src/sqlite-3.49.1/src/main.c /usr/src/sqlite-3.49.1/src/malloc.c /usr/src/sqlite-3.49.1/src/mem0.c /usr/src/sqlite-3.49.1/src/mem1.c /usr/src/sqlite-3.49.1/src/mem2.c /usr/src/sqlite-3.49.1/src/mem3.c /usr/src/sqlite-3.49.1/src/mem5.c /usr/src/sqlite-3.49.1/src/memdb.c /usr/src/sqlite-3.49.1/src/memjournal.c /usr/src/sqlite-3.49.1/src/msvc.h /usr/src/sqlite-3.49.1/src/mutex.c /usr/src/sqlite-3.49.1/src/mutex.h /usr/src/sqlite-3.49.1/src/mutex_noop.c /usr/src/sqlite-3.49.1/src/mutex_unix.c /usr/src/sqlite-3.49.1/src/mutex_w32.c /usr/src/sqlite-3.49.1/src/notify.c /usr/src/sqlite-3.49.1/src/os.c /usr/src/sqlite-3.49.1/src/os.h /usr/src/sqlite-3.49.1/src/os_common.h /usr/src/sqlite-3.49.1/src/os_setup.h /usr/src/sqlite-3.49.1/src/os_kv.c /usr/src/sqlite-3.49.1/src/os_unix.c /usr/src/sqlite-3.49.1/src/os_win.c /usr/src/sqlite-3.49.1/src/os_win.h /usr/src/sqlite-3.49.1/src/pager.c /usr/src/sqlite-3.49.1/src/pager.h /usr/src/sqlite-3.49.1/src/parse.y /usr/src/sqlite-3.49.1/src/pcache.c /usr/src/sqlite-3.49.1/src/pcache.h /usr/src/sqlite-3.49.1/src/pcache1.c /usr/src/sqlite-3.49.1/src/pragma.c /usr/src/sqlite-3.49.1/src/pragma.h /usr/src/sqlite-3.49.1/src/prepare.c /usr/src/sqlite-3.49.1/src/printf.c /usr/src/sqlite-3.49.1/src/random.c /usr/src/sqlite-3.49.1/src/resolve.c /usr/src/sqlite-3.49.1/src/rowset.c /usr/src/sqlite-3.49.1/src/select.c /usr/src/sqlite-3.49.1/src/status.c /usr/src/sqlite-3.49.1/src/shell.c.in /usr/src/sqlite-3.49.1/src/sqlite.h.in /usr/src/sqlite-3.49.1/src/sqlite3ext.h /usr/src/sqlite-3.49.1/src/sqliteInt.h /usr/src/sqlite-3.49.1/src/sqliteLimit.h /usr/src/sqlite-3.49.1/src/table.c /usr/src/sqlite-3.49.1/src/tclsqlite.c /usr/src/sqlite-3.49.1/src/threads.c /usr/src/sqlite-3.49.1/src/tokenize.c /usr/src/sqlite-3.49.1/src/treeview.c /usr/src/sqlite-3.49.1/src/trigger.c /usr/src/sqlite-3.49.1/src/utf.c /usr/src/sqlite-3.49.1/src/update.c /usr/src/sqlite-3.49.1/src/upsert.c /usr/src/sqlite-3.49.1/src/util.c /usr/src/sqlite-3.49.1/src/vacuum.c /usr/src/sqlite-3.49.1/src/vdbe.c /usr/src/sqlite-3.49.1/src/vdbe.h /usr/src/sqlite-3.49.1/src/vdbeapi.c /usr/src/sqlite-3.49.1/src/vdbeaux.c /usr/src/sqlite-3.49.1/src/vdbeblob.c /usr/src/sqlite-3.49.1/src/vdbemem.c /usr/src/sqlite-3.49.1/src/vdbesort.c /usr/src/sqlite-3.49.1/src/vdbetrace.c /usr/src/sqlite-3.49.1/src/vdbevtab.c /usr/src/sqlite-3.49.1/src/vdbeInt.h /usr/src/sqlite-3.49.1/src/vtab.c /usr/src/sqlite-3.49.1/src/vxworks.h /usr/src/sqlite-3.49.1/src/wal.c /usr/src/sqlite-3.49.1/src/wal.h /usr/src/sqlite-3.49.1/src/walker.c /usr/src/sqlite-3.49.1/src/where.c /usr/src/sqlite-3.49.1/src/wherecode.c /usr/src/sqlite-3.49.1/src/whereexpr.c /usr/src/sqlite-3.49.1/src/whereInt.h /usr/src/sqlite-3.49.1/src/window.c /usr/src/sqlite-3.49.1/ext/fts3/fts3.c /usr/src/sqlite-3.49.1/ext/fts3/fts3.h /usr/src/sqlite-3.49.1/ext/fts3/fts3Int.h /usr/src/sqlite-3.49.1/ext/fts3/fts3_aux.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_expr.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_hash.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_hash.h /usr/src/sqlite-3.49.1/ext/fts3/fts3_icu.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_porter.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_snippet.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_tokenizer.h /usr/src/sqlite-3.49.1/ext/fts3/fts3_tokenizer.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_tokenizer1.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_tokenize_vtab.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_unicode.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_unicode2.c /usr/src/sqlite-3.49.1/ext/fts3/fts3_write.c /usr/src/sqlite-3.49.1/ext/icu/sqliteicu.h /usr/src/sqlite-3.49.1/ext/icu/icu.c /usr/src/sqlite-3.49.1/ext/rtree/rtree.h /usr/src/sqlite-3.49.1/ext/rtree/rtree.c /usr/src/sqlite-3.49.1/ext/rtree/geopoly.c /usr/src/sqlite-3.49.1/ext/session/sqlite3session.c /usr/src/sqlite-3.49.1/ext/session/sqlite3session.h /usr/src/sqlite-3.49.1/ext/rbu/sqlite3rbu.h /usr/src/sqlite-3.49.1/ext/rbu/sqlite3rbu.c /usr/src/sqlite-3.49.1/ext/misc/stmt.c keywordhash.h opcodes.c opcodes.h parse.c parse.h sqlite_cfg.h shell.c sqlite3.h tsrc
rm -f tsrc/sqlite.h.in tsrc/parse.y
./jimsh /usr/src/sqlite-3.49.1/tool/vdbe-compress.tcl  <tsrc/vdbe.c >vdbe.new
mv -f vdbe.new tsrc/vdbe.c
cp fts5.c fts5.h tsrc
touch .target_source
./jimsh /usr/src/sqlite-3.49.1/tool/mksqlite3c.tcl --linemacros=0 
cp tsrc/sqlite3ext.h .
cp /usr/src/sqlite-3.49.1/ext/session/sqlite3session.h .
x86_64-unknown-linux-musl-cc -fPIC -O2  -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1   -DNDEBUG -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -I. -I/usr/src/sqlite-3.49.1/src -I/usr/src/sqlite-3.49.1/ext/rtree -I/usr/src/sqlite-3.49.1/ext/icu -I/usr/src/sqlite-3.49.1/ext/fts3 -I/usr/src/sqlite-3.49.1/ext/session -I/usr/src/sqlite-3.49.1/ext/misc -c sqlite3.c
x86_64-unknown-linux-musl-cc -fPIC -O2  -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1   -DNDEBUG -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -I. -I/usr/src/sqlite-3.49.1/src -I/usr/src/sqlite-3.49.1/ext/rtree -I/usr/src/sqlite-3.49.1/ext/icu -I/usr/src/sqlite-3.49.1/ext/fts3 -I/usr/src/sqlite-3.49.1/ext/session -I/usr/src/sqlite-3.49.1/ext/misc  -o sqlite3 \
	shell.c sqlite3.c \
	 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_DQS=0 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_BYTECODE_VTAB -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_STRICT_SUBTYPE=1  \
	-Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib    -lz   -L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static 
x86_64-unknown-linux-musl-ar cr  libsqlite3.a sqlite3.o
/usr/bin/install -m 0644 sqlite3.pc "/cross_root/x86_64-unknown-linux-musl/lib/pkgconfig"
/usr/bin/install -m 0644 libsqlite3.a "/cross_root/x86_64-unknown-linux-musl/lib"
/usr/bin/install -m 0644 sqlite3.h "/usr/src/sqlite-3.49.1/src/sqlite3ext.h" "/cross_root/x86_64-unknown-linux-musl/include"
TCL support disabled, so not installing libtclsqlite3.so
/usr/bin/install sqlite3 "/cross_root/x86_64-unknown-linux-musl/bin"
/usr/bin/install -m 0644 "/usr/src/sqlite-3.49.1/sqlite3.1" "/cross_root/x86_64-unknown-linux-musl/share/man/man1"

But download from https://www.sqlite.org/download.html is not, like: https://www.sqlite.org/2025/sqlite-autoconf-3490100.tar.gz

renamed '/build/downloads/sqlite-3.49.1.tar.gz.part' -> '/build/downloads/sqlite-3.49.1.tar.gz'
Host System...x86_64-unknown-linux-musl
Build System...x86_64-pc-linux-gnu
C compiler... x86_64-unknown-linux-musl-cc  
C++ compiler... x86_64-unknown-linux-musl-c++  
Build C compiler...cc
Checking for stdlib.h...ok
Source dir = /usr/src/sqlite-3.49.1
Build dir  = /usr/src/sqlite-3.49.1
Configuring SQLite version 3.49.1
Looking for install ... /usr/bin/install
Checking for int8_t...ok
Checking for int16_t...ok
Checking for int32_t...ok
Checking for int64_t...ok
Checking for intptr_t...ok
Checking for uint8_t...ok
Checking for uint16_t...ok
Checking for uint32_t...ok
Checking for uint64_t...ok
Checking for uintptr_t...ok
Checking for gmtime_r...ok
Checking for isnan...not found
Checking for localtime_r...ok
Checking for localtime_s...not found
Checking for malloc_usable_size...ok
Checking for strchrnul...ok
Checking for usleep...ok
Checking for utime...ok
Checking for pread...ok
Checking for pread64...not found
Checking for pwrite...ok
Checking for pwrite64...not found
Checking libs for fdatasync...none needed
Checking libs for nanosleep...none needed
Checking for sys/types.h...ok
Checking for sys/stat.h...ok
Checking for dlfcn.h...ok
Checking for unistd.h...ok
Checking for stdlib.h...(cached) ok
Checking for malloc.h...ok
Checking for memory.h...ok
Checking for string.h...ok
Checking for strings.h...ok
Checking for inttypes.h...ok
Checking for zlib.h...ok
Checking libs for deflate...-lz
Checking whether the C compiler accepts -rpath /cross_root/x86_64-unknown-linux-musl/lib...no
Checking whether the C compiler accepts -Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib...yes
SQLITE_DEBUG build? no
Support threadsafe operation? Checking for libs...
Checking libs for pthread_create...none needed
Checking libs for pthread_mutexattr_init...none needed
Checking for line-editing capability...
Line-editing support for the sqlite3 shell: none
WARNING: Skipping check for readline.h because we're cross-compiling.
Checking libs for dlopen...none needed
Loadable extension support enabled.
Checking libs for ceil...none needed
Enabling math SQL functions 
ICU support is disabled.
Feature flags...
  - fts4
  - fts5
  - geopoly
  - rtree
  - session
  - update-limit
  - memsys5
  - memsys3
  - scanstatus
  + json
Library feature flags: -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1
Shell options: -DSQLITE_HAVE_ZLIB=1
Created Makefile from Makefile.in
Created sqlite3.pc from sqlite3.pc.in
Created sqlite_cfg.h
x86_64-unknown-linux-musl-cc -c /usr/src/sqlite-3.49.1/sqlite3.c -o sqlite3.o -O2  -I. -fPIC  -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1
x86_64-unknown-linux-musl-cc -o sqlite3 \
	/usr/src/sqlite-3.49.1/shell.c /usr/src/sqlite-3.49.1/sqlite3.c -Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib    -lz   -L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static \
	-I. -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_THREADSAFE=1 -DSQLITE_HAVE_ZLIB=1 \
	-O2    \
	-L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static 
x86_64-unknown-linux-musl-cc -o libsqlite3.so  sqlite3.o -shared \
	-L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static -Wl,-rpath,/cross_root/x86_64-unknown-linux-musl/lib    -lz   -L/cross_root/x86_64-unknown-linux-musl/lib64 -L/cross_root/x86_64-unknown-linux-musl/lib -I/cross_root/x86_64-unknown-linux-musl/include -s -static --static \
	 
x86_64-unknown-linux-musl-ar cr libsqlite3.a sqlite3.o
/cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/../../../../x86_64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/../../../../x86_64-unknown-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:149: libsqlite3.so] Error 1
make: *** Waiting for unfinished jobs....

I try to change sqlite download url to github tag url

   sqlite_tag="$(retry wget -qO- --compression=auto https://www.sqlite.org/index.html \| sed -nr "'s/.*>Version (.+)<.*/\1/p'")"
-  sqlite_filepath="$(retry wget -qO- --compression=auto https://sqlite.org/download.html \| grep "'${sqlite_tag}.*sqlite-autoconf-.*\.tar\.gz'" \| awk -F "','" "'{print \$3}'")"
-  sqlite_latest_url="https://sqlite.org/${sqlite_filepath}"
+  sqlite_latest_url="https://github.com/sqlite/sqlite/archive/refs/tags/version-${sqlite_tag}.tar.gz"

and all build passed: https://github.com/abcfy2/aria2-static-build/actions/runs/13494843195

Would you please help troubleshoot this? Why github tag is working, but download page is not.

Thanks.

(6.1) By Stephan Beal (stephan) on 2025-02-24 10:18:24 edited from 6.0 in reply to 5 [link] [source]

When I download source code from github tags, like https://github.com/sqlite/sqlite/archive/refs/tags/version-3.49.1.tar.gz, the build is working:

Great, thank you for the confirmation!

But download from https://www.sqlite.org/download.html is not, like: https://www.sqlite.org/2025/sqlite-autoconf-3490100.tar.gz

When you build from the version-3.49.1 tag you are building from the so-called "canonical" tree. sqlite-autoconf-3490100.tar.gz is the so-called "autoconf" tree. They are not the same thing. The autoconf tree is a pre-processed copy of the tree which contains only the amalgamation sources, the CLI shell source code, and the TCL TEA extension. The canonical tree contains everything - hundreds of source files. Those two trees have the same version of sqlite but how they build them is very different.

i cannot see which flags you have passed to the configure script, but assume you passed either --disable-shared or --disable-static. Those flags were broken (ignored) in the 3.49.1 autoconf build but not the in canonical build. Perhaps that's the source of the build error (but i'm just guessing).

/cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/../../../../x86_64-unknown-linux-musl/bin/ld.bfd: /cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/cross_root/bin/../lib/gcc/x86_64-unknown-linux-musl/14.2.0/../../../../x86_64-unknown-linux-musl/bin/ld.bfd: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

i truly have no clue what what particular error is about. __TMC_END__ is not used anywhere in our source tree, nor does the error mention any of our sources. Looking up that error on Google is also not giving me a better idea of what it's complaining about.

In any case, 3.49.1 is now "obsolete," but the build-related changes and fixes made since the 3.49.1 release are not yet in the 3.49 branch. The current plan is to merge those on Feb. 25th.

Would you please help troubleshoot this? Why github tag is working, but download page is not.

i unfortunately can't help you with that. As a devout user of the Fossil SCM i actively avoid git, and know almost nothing about github beyond how to clone repositories and post bug reports there.

Edit: however, i believe the source of your confusion here is caused by 2 things:

  1. Assuming that the version tags and the sqlite-autoconf-... tarball resolve to the same thing, which they're don't.
  2. The 3.49.1 "autoconf" build has broken --disable-static and --disable-shared flags, which might be what's leading to that "bad value" error.

(7.1) By Feng Yu (abcfy2) on 2025-02-24 13:33:48 edited from 7.0 in reply to 6.1 [link] [source]

Thanks. Here's the my configure arguments:

./configure --build="${BUILD_ARCH}" --host="${CROSS_HOST}" --prefix="${CROSS_PREFIX}" --enable-static --disable-shared ${SQLITE_EXT_CONF}
# value from gcc -dumpmachine
BUILD_ARCH=x86_64-pc-linux-gnu
CROSS_HOST=x86_64-unknown-linux-musl
CROSS_PREFIX=/cross_root/x86_64-unknown-linux-musl

export LDFLAGS="-L${CROSS_PREFIX}/lib64 -L${CROSS_PREFIX}/lib -I${CROSS_PREFIX}/include -s -static --static"

Which works for canonical tree.

Thanks.

(8) By Stephan Beal (stephan) on 2025-02-24 17:58:44 in reply to 7.1 [link] [source]

--enable-static --disable-shared

An oversight on my part led to the --disable-shared/static flags being ignored in the "autoconf" distribution of 3.49.0 and 3.49.1 releases. That's fixed in the 3.49 branch so will be part of 3.49.2 (if such a release is ever made) and 3.50.0.

One workaround for that is to selectively tell it not to build the shared library:

$ make libsqlite3.a sqlite3
$ make install-lib install-shell install-pc install-man1 install-headers

That will (or should) avoid running any targets which depend on the DLL being built.

-static --static

Ah, that explains where the -static flags were coming from, as we don't use those anywhere.