Skip to content

Commit 4fc6455

Browse files
committed
configure: switch to static linking by default
Dynamic linking translates to smaller binaries, but makes it more ergonomic to quickly try the shell, so let's go with static by default.
1 parent 1b9e90e commit 4fc6455

4 files changed

Lines changed: 46 additions & 21 deletions

File tree

.github/workflows/maketestwasm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: sudo apt-get install -y tcl8.6-dev
1919

2020
- name: configure with Wasm
21-
run: ./configure --enable-wasm-runtime
21+
run: ./configure --enable-wasm-runtime-dynamic
2222

2323
- name: make the library generally available
2424
run: sudo ln -s $(pwd)/.libs/libwblibsql.so /usr/lib/libwblibsql.so && ls -lsh /usr/lib

Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,9 @@ mptest: mptester$(TEXE)
780780
libwblibsql.so: $(TOP)/src/rust/wasmtime-bindings/src/lib.rs
781781
( mkdir -p .libs && cd $(TOP)/src/rust/wasmtime-bindings/ && cargo build --release && cp target/release/libwblibsql.so $(TOP)/.libs/ )
782782

783+
libwblibsql.a: $(TOP)/src/rust/wasmtime-bindings/src/lib.rs
784+
( mkdir -p .libs && cd $(TOP)/src/rust/wasmtime-bindings/ && cargo build --release && cp target/release/libwblibsql.a $(TOP)/.libs/ )
785+
783786
sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl @OPT_WASM_RUNTIME_LIB@
784787
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS)
785788
cp tsrc/sqlite3ext.h .

configure

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ enable_load_extension
937937
enable_math
938938
enable_json
939939
enable_wasm_runtime
940+
enable_wasm_runtime_dynamic
940941
enable_all
941942
enable_memsys5
942943
enable_memsys3
@@ -1601,6 +1602,9 @@ Optional Features:
16011602
--disable-math Disable math functions
16021603
--disable-json Disable JSON functions
16031604
--enable-wasm-runtime Enable WebAssembly runtime integration
1605+
--enable-wasm-runtime-dynamic
1606+
Enable WebAssembly runtime integration (dynamic
1607+
linking)
16041608
--enable-all Enable FTS4, FTS5, Geopoly, RTree, Sessions
16051609
--enable-memsys5 Enable MEMSYS5
16061610
--enable-memsys3 Enable MEMSYS3
@@ -4463,13 +4467,13 @@ then :
44634467
else $as_nop
44644468
lt_cv_nm_interface="BSD nm"
44654469
echo "int some_variable = 0;" > conftest.$ac_ext
4466-
(eval echo "\"\$as_me:4466: $ac_compile\"" >&5)
4470+
(eval echo "\"\$as_me:4470: $ac_compile\"" >&5)
44674471
(eval "$ac_compile" 2>conftest.err)
44684472
cat conftest.err >&5
4469-
(eval echo "\"\$as_me:4469: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
4473+
(eval echo "\"\$as_me:4473: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
44704474
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
44714475
cat conftest.err >&5
4472-
(eval echo "\"\$as_me:4472: output\"" >&5)
4476+
(eval echo "\"\$as_me:4476: output\"" >&5)
44734477
cat conftest.out >&5
44744478
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
44754479
lt_cv_nm_interface="MS dumpbin"
@@ -5720,7 +5724,7 @@ ia64-*-hpux*)
57205724
;;
57215725
*-*-irix6*)
57225726
# Find out which ABI we are using.
5723-
echo '#line 5723 "configure"' > conftest.$ac_ext
5727+
echo '#line 5727 "configure"' > conftest.$ac_ext
57245728
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
57255729
(eval $ac_compile) 2>&5
57265730
ac_status=$?
@@ -7063,11 +7067,11 @@ else $as_nop
70637067
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
70647068
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
70657069
-e 's:$: $lt_compiler_flag:'`
7066-
(eval echo "\"\$as_me:7066: $lt_compile\"" >&5)
7070+
(eval echo "\"\$as_me:7070: $lt_compile\"" >&5)
70677071
(eval "$lt_compile" 2>conftest.err)
70687072
ac_status=$?
70697073
cat conftest.err >&5
7070-
echo "$as_me:7070: \$? = $ac_status" >&5
7074+
echo "$as_me:7074: \$? = $ac_status" >&5
70717075
if (exit $ac_status) && test -s "$ac_outfile"; then
70727076
# The compiler can only warn and ignore the option if not recognized
70737077
# So say no if there are warnings other than the usual output.
@@ -7403,11 +7407,11 @@ else $as_nop
74037407
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
74047408
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
74057409
-e 's:$: $lt_compiler_flag:'`
7406-
(eval echo "\"\$as_me:7406: $lt_compile\"" >&5)
7410+
(eval echo "\"\$as_me:7410: $lt_compile\"" >&5)
74077411
(eval "$lt_compile" 2>conftest.err)
74087412
ac_status=$?
74097413
cat conftest.err >&5
7410-
echo "$as_me:7410: \$? = $ac_status" >&5
7414+
echo "$as_me:7414: \$? = $ac_status" >&5
74117415
if (exit $ac_status) && test -s "$ac_outfile"; then
74127416
# The compiler can only warn and ignore the option if not recognized
74137417
# So say no if there are warnings other than the usual output.
@@ -7510,11 +7514,11 @@ else $as_nop
75107514
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
75117515
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
75127516
-e 's:$: $lt_compiler_flag:'`
7513-
(eval echo "\"\$as_me:7513: $lt_compile\"" >&5)
7517+
(eval echo "\"\$as_me:7517: $lt_compile\"" >&5)
75147518
(eval "$lt_compile" 2>out/conftest.err)
75157519
ac_status=$?
75167520
cat out/conftest.err >&5
7517-
echo "$as_me:7517: \$? = $ac_status" >&5
7521+
echo "$as_me:7521: \$? = $ac_status" >&5
75187522
if (exit $ac_status) && test -s out/conftest2.$ac_objext
75197523
then
75207524
# The compiler can only warn and ignore the option if not recognized
@@ -7566,11 +7570,11 @@ else $as_nop
75667570
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
75677571
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
75687572
-e 's:$: $lt_compiler_flag:'`
7569-
(eval echo "\"\$as_me:7569: $lt_compile\"" >&5)
7573+
(eval echo "\"\$as_me:7573: $lt_compile\"" >&5)
75707574
(eval "$lt_compile" 2>out/conftest.err)
75717575
ac_status=$?
75727576
cat out/conftest.err >&5
7573-
echo "$as_me:7573: \$? = $ac_status" >&5
7577+
echo "$as_me:7577: \$? = $ac_status" >&5
75747578
if (exit $ac_status) && test -s out/conftest2.$ac_objext
75757579
then
75767580
# The compiler can only warn and ignore the option if not recognized
@@ -9954,7 +9958,7 @@ else
99549958
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
99559959
lt_status=$lt_dlunknown
99569960
cat > conftest.$ac_ext <<_LT_EOF
9957-
#line 9957 "configure"
9961+
#line 9961 "configure"
99589962
#include "confdefs.h"
99599963
99609964
#if HAVE_DLFCN_H
@@ -10051,7 +10055,7 @@ else
1005110055
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1005210056
lt_status=$lt_dlunknown
1005310057
cat > conftest.$ac_ext <<_LT_EOF
10054-
#line 10054 "configure"
10058+
#line 10058 "configure"
1005510059
#include "confdefs.h"
1005610060
1005710061
#if HAVE_DLFCN_H
@@ -12060,9 +12064,15 @@ then :
1206012064
enableval=$enable_wasm_runtime;
1206112065
fi
1206212066

12067+
# Check whether --enable-wasm_runtime_dynamic was given.
12068+
if test ${enable_wasm_runtime_dynamic+y}
12069+
then :
12070+
enableval=$enable_wasm_runtime_dynamic;
12071+
fi
12072+
1206312073
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to support WebAssembly integration" >&5
1206412074
printf %s "checking whether to support WebAssembly integration... " >&6; }
12065-
if test "$enable_wasm_runtime" = "yes"; then
12075+
if test "$enable_wasm_runtime" = "yes" -o "$enable_wasm_runtime_dynamic" = "yes"; then
1206612076
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1206712077
printf "%s\n" "yes" >&6; }
1206812078
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DLIBSQL_ENABLE_WASM_RUNTIME"
@@ -12108,8 +12118,13 @@ printf "%s\n" "no" >&6; }
1210812118
fi
1210912119

1211012120

12111-
TARGET_OPT_WASM_RUNTIME_LINK='-L$(TOP)/.libs -lwblibsql'
12112-
OPT_WASM_RUNTIME_LIB="libwblibsql.so"
12121+
if test "$enable_wasm_runtime" = "yes"; then
12122+
TARGET_OPT_WASM_RUNTIME_LINK='$(TOP)/.libs/libwblibsql.a'
12123+
OPT_WASM_RUNTIME_LIB="libwblibsql.a"
12124+
else
12125+
TARGET_OPT_WASM_RUNTIME_LINK='-L$(TOP)/.libs/ -lwblibsql'
12126+
OPT_WASM_RUNTIME_LIB="libwblibsql.so"
12127+
fi
1211312128
else
1211412129
TARGET_OPT_WASM_RUNTIME_LINK=""
1211512130
OPT_WASM_RUNTIME_LIB=""

configure.ac

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,20 @@ fi
632632
#
633633
AC_ARG_ENABLE(wasm_runtime,
634634
AS_HELP_STRING([--enable-wasm-runtime],[Enable WebAssembly runtime integration]))
635+
AC_ARG_ENABLE(wasm_runtime_dynamic,
636+
AS_HELP_STRING([--enable-wasm-runtime-dynamic],[Enable WebAssembly runtime integration (dynamic linking)]))
635637
AC_MSG_CHECKING([whether to support WebAssembly integration])
636-
if test "$enable_wasm_runtime" = "yes"; then
638+
if test "$enable_wasm_runtime" = "yes" -o "$enable_wasm_runtime_dynamic" = "yes"; then
637639
AC_MSG_RESULT([yes])
638640
OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DLIBSQL_ENABLE_WASM_RUNTIME"
639641
AC_CHECK_PROG(CARGO_BIN, cargo)
640-
TARGET_OPT_WASM_RUNTIME_LINK='-L$(TOP)/.libs -lwblibsql'
641-
OPT_WASM_RUNTIME_LIB="libwblibsql.so"
642+
if test "$enable_wasm_runtime" = "yes"; then
643+
TARGET_OPT_WASM_RUNTIME_LINK='$(TOP)/.libs/libwblibsql.a'
644+
OPT_WASM_RUNTIME_LIB="libwblibsql.a"
645+
else
646+
TARGET_OPT_WASM_RUNTIME_LINK='-L$(TOP)/.libs/ -lwblibsql'
647+
OPT_WASM_RUNTIME_LIB="libwblibsql.so"
648+
fi
642649
else
643650
TARGET_OPT_WASM_RUNTIME_LINK=""
644651
OPT_WASM_RUNTIME_LIB=""

0 commit comments

Comments
 (0)