View previous topic :: View next topic |
Author |
Message |
Lloydz n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/15769328585d820d3965178.png)
Joined: 31 Aug 2019 Posts: 38 Location: Germany
|
Posted: Sun Jan 01, 2023 4:17 pm Post subject: Eigenes ebuild zu sqlite: warning SQLITE_THREADSAFE redef |
|
|
Ich habe mir für sqlite ein eigenes ebuild gebastelt - nach Vorgabe des Originalen. Dazu habe ich 2 weitere
cpp-flags hinzugefügt in multilib_src_configure(). Das sieht dann so aus:
Code: | multilib_src_configure() {
local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}"
local options=()
options+=(
--enable-load-extension
--enable-threadsafe
)
# My
# URL: https://www.sqlite.org/inmemorydb.html
# 0 Temporary files are always stored on disk regardless of the setting of the temp_store pragma.
# 1 Temporary files are stored on disk by default but this can be overridden by the temp_store pragma.
# 2 Temporary files are stored in memory by default but this can be overridden by the temp_store pragma.
# 3 Temporary files are always stored in memory regardless of the setting of the temp_store pragma.
append-cppflags -DSQLITE_TEMP_STORE=2
# My
# URL: https://www.sqlite.org/compile.html#threadsafe
# When SQLite has been compiled with SQLITE_THREADSAFE=1 or SQLITE_THREADSAFE=2 then
# the threading mode can be altered at run-time using the sqlite3_config() interface
append-cppflags -DSQLITE_THREADSAFE=2
# Support detection of misuse of SQLite API.
# https://sqlite.org/compile.html#enable_api_armor
append-cppflags -DSQLITE_ENABLE_API_ARMOR |
Dazu bekomme ich zwei Warnungen während des compile und ich bin mir am Ende nicht sicher was maßgeblich ist:
Code: | <command-line>: warning: "SQLITE_TEMP_STORE" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "SQLITE_THREADSAFE" redefined
<command-line>: note: this is the location of the previous definition |
Ich habe herausgefunden, dass im Makefile Default-Werte - zusätzlich zu den CFlags - angehängt werden, und hab das als
Ursache fest gemacht; aus dem Makefile: TEMP_STORE und TCC, den hier werden beide compile-flags per default noch einmal gesetzt.
Mit der ebuild-Programmierung stehe ich noch recht weit am Anfang und verstehe nicht, wie ich jetzt auf das Makefile Einfluss nehmen kann,
so dass meine Werte übernommen werden. Vielleicht hat jemand einen Tipp für mich? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
firefly Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
Joined: 31 Oct 2002 Posts: 5329
|
Posted: Mon Jan 02, 2023 5:59 am Post subject: |
|
|
zu mindestens temp store support ist via autotools (configure) konfigurierbar:
Quote: | --enable-tempstore Use an in-ram database for temporary tables
(never,no,yes,always) |
also nicht via "append-cppflags" sondern via "options+="
für SQLITE_THREADSAFE gibt es nur den schalter "--disable-threadsafe" um "SQLITE_THREADSAFE=0" zu setzen statt default "SQLITE_THREADSAFE=1"
Wieso möchtest du SQLITE_THREADSAFE=2 setzen?
Laut Doku verändert das nur den default "threading mode" und kann via sqlite3_config zur laufzeit verändert werden.
Da sollte eher das Programm, welches sqlite verwendet, sqlite3_config verweden um den threading mode auf "SQLITE_CONFIG_MULTITHREAD" zu ändern.
Das gleiche gilt auch für SQLITE_TEMP_STORE. Bei default ist es auf "no" aka "1" gesetzt und lässt sich via dem "PRAGMA temp_store" befehl zur laufzeit ändern. https://sqlite.org/pragma.html#pragma_temp_store
Daher verstehe ich nicht wieso du die defaults hier ändern möchtest? Und zwar für die version, welche im system installiert wird! _________________ Ein Ring, sie zu knechten, sie alle zu finden,
Ins Dunkel zu treiben und ewig zu binden
Im Lande Mordor, wo die Schatten drohn. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Lloydz n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/15769328585d820d3965178.png)
Joined: 31 Aug 2019 Posts: 38 Location: Germany
|
Posted: Mon Jan 02, 2023 12:11 pm Post subject: |
|
|
Ich hab ein wenig getüftelt und jetzt funktioniert es. Es ist sicherlich nicht die eleganteste Lösung, aber gut..
Code: | multilib_src_configure() {
local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}"
local options=()
options+=(
--enable-load-extension
#--enable-threadsafe=2
--enable-tempstore=yes
)
# My
# URL: https://www.sqlite.org/inmemorydb.html
# 0 Temporary files are always stored on disk regardless of the setting of the temp_store pragma.
# 1 Temporary files are stored on disk by default but this can be overridden by the temp_store pragma.
# 2 Temporary files are stored in memory by default but this can be overridden by the temp_store pragma.
# 3 Temporary files are always stored in memory regardless of the setting of the temp_store pragma.
#append-cppflags -DSQLITE_TEMP_STORE=2
#sed -e "s/^TEMP_STORE = -DSQLITE_TEMP_STORE=@TEMP_STORE@/TEMP_STORE = -DSQLITE_TEMP_STORE=2/" -i Makefile.in || die "sed -DSQLITE_TEMP_STORE=2 failed"
# My
# URL: https://www.sqlite.org/compile.html#threadsafe
# When SQLite has been compiled with SQLITE_THREADSAFE=1 or SQLITE_THREADSAFE=2 then
# the threading mode can be altered at run-time using the sqlite3_config() interface
##append-cppflags -DSQLITE_THREADSAFE=2
sed -e "s/^TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@/TCC += -DSQLITE_THREADSAFE=2/" -i Makefile.in || die "sed -DSQLITE_THREADSAFE=2 failed"
# Support detection of misuse of SQLite API.
# https://sqlite.org/compile.html#enable_api_armor
append-cppflags -DSQLITE_ENABLE_API_ARMOR |
Der hauptsächliche Hintergrund ist der Lerneffekt mit dem ebuild-Skript, wenn auch bescheiden. Bisher hab ich mir GitHub hierzu gezogen, jetzt sind die Gentoo-Eigenen dran ;-)
Der Unterschied muss aus meiner Sicht ein sehr philosophischer sein, da mir dass nötige Hintergrundwissen und die Praxis fehlt.
Nach der Dokumentation hier:https://www.sqlite.org/threadsafe.html -
[...]Use the SQLITE_THREADSAFE compile-time parameter to select the threading mode. If no SQLITE_THREADSAFE compile-time parameter is present, then serialized mode is used. This can be made explicit with -DSQLITE_THREADSAFE=1. With -DSQLITE_THREADSAFE=0 the threading mode is single-thread. With -DSQLITE_THREADSAFE=2 the threading mode is multi-thread.[...]
schaltet der Wert: 2 den threading mode multithread per default ein; das kann zur Laufzeit geändert werden. Dies gibt erst mal den Default Zustand an und was es im Zusammenhang mit -DSQLITE_ENABLE_DESERIALIZE bewirkt bin ich mir unschlüssig. BTW: This option was formerly used to enable the sqlite3_serialize() and sqlite3_deserialize() interfaces. However, as of SQLite 3.36.0 (2021-06-18) those interfaces are enabled by default and a new compile-time option SQLITE_OMIT_DESERIALIZE is added to omit them. Der Schalter kommt aus dem Original-ebuild.
Mit -DSQLITE_TEMP_STORE=2 will ich den in-memory Typ mehr forcieren - er kann ja weiterhin zur Laufzeit geändert werden. Hintergrund ist klar, weniger Festplattenaktivität und schnellere Zugriffe per RAM, vor allem bei temporären Tabellen. Der Rechner ist ein Laptop, da habe ich mehrere Stunden Zeit zum runter fahren bei einem Stromausfall. Bei anderen Situationen wird auch das zwischenspeichern auf Festplatte nicht helfen, denke ich.
Wie gesagt, der Weg ist das Ziel, es geht ums lernen mit den ebuild-Skripten. Vielen Dank für die Tipps. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|