From f3d279595ed866ca6d787e39e11d1b5fdde26374 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 4 Nov 2024 08:29:02 +0000 Subject: [PATCH] When installing the shared lib, re-activate the accommodation of legacy-style .so links (removed in [80584e165e4]) based on two reports that not having those will cause all clients linked against the legacy naming convention to fail to dynamically link (which would preclude an update of a system-level libsqlite3 package). Set up the infrastructure needed for adding an SONAME to the library but do not yet activate it. See discussion in/around [forum:046133a7da|forum post 046133a7da]. FossilOrigin-Name: 1586eaceb1716fbeafc4af691d0f80206cd5390388b099d4939e6be5d3eb975b --- Makefile.in | 2 +- auto.def | 8 +++++++- autosetup/proj.tcl | 17 ++++++++++++++++ main.mk | 49 ++++++++++++++++++++++++++++++++++++++++++++-- manifest | 18 ++++++++--------- manifest.uuid | 2 +- 6 files changed, 82 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6995ff945e..0e7887f377 100644 --- a/Makefile.in +++ b/Makefile.in @@ -150,7 +150,7 @@ LDFLAGS.dlopen = @LDFLAGS_DLOPEN@ LDFLAGS.readline = @LDFLAGS_READLINE@ CFLAGS.readline = @CFLAGS_READLINE@ LDFLAGS.icu = @LDFLAGS_ICU@ - +LDFLAGS.soname.libsqlite3 = @LDFLAGS_SONAME_LIBSQLITE3@ ENABLE_SHARED = @ENABLE_SHARED@ ENABLE_STATIC = @ENABLE_STATIC@ HAVE_WASI_SDK = @HAVE_WASI_SDK@ diff --git a/auto.def b/auto.def index a11560fb56..77db2d41a7 100644 --- a/auto.def +++ b/auto.def @@ -412,7 +412,13 @@ if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} { define LDFLAGS_ZLIB "" } -proj-check-rpath; # Determine proper rpath-handling flags. +proj-check-rpath ; # Determine proper rpath-handling flag +if {0 && [proj-check-soname]} { + # It's not yet clear whether we gain anything from setting -soname + define LDFLAGS_SONAME_LIBSQLITE3 [get-define LDFLAGS_SONAME_PREFIX]libsqlite3.so.3 +} else { + define LDFLAGS_SONAME_LIBSQLITE3 "" +} proj-define-if-opt-truthy shared ENABLE_SHARED "Build shared library?" diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 8f621e23da..c5f057c2d4 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -825,6 +825,23 @@ proc proj-check-rpath {} { return $rc } +######################################################################## +# Checks whether CC supports the -Wl,soname,lib... flag. If so, it +# returns 1 and defines LDFLAGS_SONAME_PREFIX to the flag's prefix, +# which the client would need to append "libwhatever.N" to. If not, it +# returns 0 and defines LDFLAGS_SONAME_PREFIX to an empty string. +proc proj-check-soname {} { + cc-with {} { + if {[cc-check-flags "-Wl,-soname,libfoo.so.0"]} { + define LDFLAGS_SONAME_PREFIX "-Wl,-soname," + return 1 + } else { + define LDFLAGS_SONAME_PREFIX "" + return 0 + } + } +} + ######################################################################## # Internal helper for proj-dump-defs-json. Expects to be passed a # [define] name and the variadic $args which are passed to diff --git a/main.mk b/main.mk index 74617e3a8f..99366ea26b 100644 --- a/main.mk +++ b/main.mk @@ -162,6 +162,7 @@ LDFLAGS.pthread ?= -lpthread LDFLAGS.dlopen ?= -ldl LDFLAGS.shobj ?= -shared LDFLAGS.icu ?= # -licui18n -licuuc -licudata +LDFLAGS.soname.libsqlite3 ?= # libreadline (or a workalike): # To activate readline in the shell: SHELL_OPT = -DHAVE_READLINE=1 LDFLAGS.readline ?= -lreadline # these vary wildly across platforms @@ -1351,7 +1352,7 @@ all: lib # Dynamic libsqlite3 # $(libsqlite3.SO): $(LIBOBJ) - $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.libsqlite3) + $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.soname.libsqlite3) $(LDFLAGS.libsqlite3) $(libsqlite3.SO)-1: $(libsqlite3.SO) $(libsqlite3.SO)-0 $(libsqlite3.SO)-: so: $(libsqlite3.SO)-$(ENABLE_SHARED) @@ -1365,6 +1366,37 @@ all: so # - libsqlite3.so.3 =symlink-> libsqlite3.so.$(PACKAGE_VERSION) # - libsqlite3.so =symlink-> libsqlite3.so.3 # +# Regarding the historcal installation name of libsqlite3.so.0.8.6: +# +# Historically libtool installed the library like so: +# +# libsqlite3.so -> libsqlite3.so.0.8.6 +# libsqlite3.so.0 -> libsqlite3.so.0.8.6 +# libsqlite3.so.0.8.6 +# +# The historical SQLite build always used a version number of 0.8.6 +# for reasons lost to history but having something to do with libtool +# (which is no longer used in this tree). In order to retain filename +# compatibility for systems which have libraries installed using those +# conventions: +# +# 1) If libsqlite3.so.0 is found in the target installation directory +# then it is re-linked to point to the newer-style names. We cannot +# retain both the old and new installation because they both share +# the high-level name $(libsqlite3.SO). The down-side of this is +# that it may well upset packaging tools when we replace +# libsqlite3.so (from a legacy package) with a new symlink. +# +# 2) If INSTALL_SO_086_LINKS=1 and point (1) does not apply then links +# to the legacy-style names are created. The primary intent of this +# is to enable chains of operations such as the hypothetical (apt +# remove sqlite3-3.47.0 && apt install sqlite3-3.48.0). In such +# cases, condition (1) would never trigger but applications might +# still expect to see the legacy file names. +# +# In either case, libsqlite3.la, if found, is deleted because it would +# contain stale state, refering to non-libtool-generated libraries. +# install-so-1: $(install-dir.lib) $(libsqlite3.SO) $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" @echo "Setting up SO symlinks..."; \ @@ -1373,7 +1405,20 @@ install-so-1: $(install-dir.lib) $(libsqlite3.SO) mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).3 || exit $$?; \ ln -s $(libsqlite3.SO).3 $(libsqlite3.SO) || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).3* + ls -la $(libsqlite3.SO) $(libsqlite3.SO).3*; \ + if [ -e $(libsqlite3.SO).0 ]; then \ + echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ + rm -f libsqlite3.la $(libsqlite3.SO).0* || exit $$?; \ + ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ + ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.SO).0*; \ + elif [ x1 = "x$(INSTALL_SO_086_LINKS)" ]; then \ + echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINKS=1"; \ + rm -f libsqlite3.la $(libsqlite3.SO).0* || exit $$?; \ + ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ + ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.SO).0*; \ + fi install-so-0 install-so-: install-so: install-so-$(ENABLE_SHARED) install: install-so diff --git a/manifest b/manifest index 079355a6d6..3c38464b73 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Minor\sinternal\sdoc\sadditions. -D 2024-11-04T06:38:44.954 +C When\sinstalling\sthe\sshared\slib,\sre-activate\sthe\saccommodation\sof\slegacy-style\s.so\slinks\s(removed\sin\s[80584e165e4])\sbased\son\stwo\sreports\sthat\snot\shaving\sthose\swill\scause\sall\sclients\slinked\sagainst\sthe\slegacy\snaming\sconvention\sto\sfail\sto\sdynamically\slink\s(which\swould\spreclude\san\supdate\sof\sa\ssystem-level\slibsqlite3\spackage).\sSet\sup\sthe\sinfrastructure\sneeded\sfor\sadding\san\sSONAME\sto\sthe\slibrary\sbut\sdo\snot\syet\sactivate\sit.\sSee\sdiscussion\sin/around\s[forum:046133a7da|forum\spost\s046133a7da]. +D 2024-11-04T08:29:02.129 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28 -F Makefile.in b490c1230b030da8d597688c09ec395340eb834cc858437d5c3a3ce45e8aaf3e +F Makefile.in 5f7d14ad4b7a2e150efaffdef6b0351fb2f7a58e2f5dfc24a06064bf779a4ed7 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def 19b5df445fab703133f430b1169968d702cf421d752199ee77d11626062f7755 +F auto.def df0c81945586931dad81173d1c997deeecfa1a422db4bcd5ff4c9b425ed8aa44 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -49,7 +49,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 F autosetup/jimsh0.c d40e381ea4526a067590e7b91bd4b2efa6d4980d286f908054c647b3df4aee14 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 9e053edf844bb21eecf11ae895fdcc8a8faa53b62bd3590e987fac47e81f112f +F autosetup/proj.tcl 40e3a4ffd4677ddd98426ef1b398a45eba51038c295f6ea95eff207b79401669 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9 @@ -697,7 +697,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk f8b82b2422ad161e2f8b463a57db1fd0f4419b82834d722a1ae956945aaa2eb5 +F main.mk 548b0263d0bfa7f9219c340a48f1b8be3d51244942d7afbf55633c6a5e9574a6 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 307349bf91df2935efeaeb5617f43c2223aa7523e55034fb532cc4386a29d74c -R e7a94327d3f12fe81bcdebfd3b5f54d7 +P 9edc8582c97f40f546699e6d1fb075773d5476df81b6c3f8900d1f2716549295 +R 8cf84e7f7765f04ea61c293658e080de U stephan -Z 8ef48fb18c43937b2bb7608e93f04fd4 +Z 73922ef92d5fe4d287303f5a200f92b0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9b032d7655..fe22ef1b69 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9edc8582c97f40f546699e6d1fb075773d5476df81b6c3f8900d1f2716549295 +1586eaceb1716fbeafc4af691d0f80206cd5390388b099d4939e6be5d3eb975b