<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Invoke_SqlCipher_using_Flutter_ffi</id>
	<title>Invoke SqlCipher using Flutter ffi - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Invoke_SqlCipher_using_Flutter_ffi"/>
	<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;action=history"/>
	<updated>2026-06-02T19:17:19Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=5048&amp;oldid=prev</id>
		<title>Riguz：​/* 源码编译 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=5048&amp;oldid=prev"/>
		<updated>2025-07-17T14:32:04Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;源码编译&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2025年7月17日 (四) 14:32的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot;&gt;第19行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第19行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;cd sqlcipher/build&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;./configure \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;./configure &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;--enable-tempstore=no &lt;/del&gt;\&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	&lt;/ins&gt;CFLAGS=&quot;-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DSQLITE_HAS_CODEC &lt;/ins&gt;-DSQLITE_TEMP_STORE=&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2 &lt;/ins&gt;-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown &lt;/ins&gt;-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DSQLCIPHER_TEST&lt;/ins&gt;&quot; \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  --with-crypto-lib=none \&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	&lt;/ins&gt;LDFLAGS=&quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-lcrypto&lt;/ins&gt;&quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  --enable-fts5 \&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  &lt;/del&gt;CFLAGS=&quot;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DSQLCIPHER_CRYPTO_OPENSSL &lt;/del&gt;-DSQLITE_TEMP_STORE=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;3 &lt;/del&gt;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DSQLITE_HAS_CODEC &lt;/del&gt;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;I/usr/local/opt/openssl/include/&lt;/del&gt;&quot; \&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  &lt;/del&gt;LDFLAGS=&quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/usr/local/opt/openssl/lib/libcrypto.a&lt;/del&gt;&quot;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3737&amp;oldid=prev</id>
		<title>2023年12月18日 (一) 15:47 Riguz</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3737&amp;oldid=prev"/>
		<updated>2023-12-18T15:47:18Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月18日 (一) 15:47的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{DISPLAYTITLE:Flutter中使用ffi调用SqlCipher}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;目前在flutter中调用sqlite有成熟的插件例如sqflite，而我需要sqlcipher，并同时加载fts5扩展，现有的插件并不能直接支持。因此需要创建一个插件来做这个事情。在以前平台集成相当麻烦，而现在有了ffi之后，可以直接调用原生代码，虽然还在试验阶段但终究是大势所趋。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;目前在flutter中调用sqlite有成熟的插件例如sqflite，而我需要sqlcipher，并同时加载fts5扩展，现有的插件并不能直接支持。因此需要创建一个插件来做这个事情。在以前平台集成相当麻烦，而现在有了ffi之后，可以直接调用原生代码，虽然还在试验阶段但终究是大势所趋。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3736&amp;oldid=prev</id>
		<title>Riguz：​Riguz移动页面Flutter中使用ffi调用SqlCipher至Invoke SqlCipher using Flutter ffi，不留重定向</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3736&amp;oldid=prev"/>
		<updated>2023-12-18T15:46:50Z</updated>

		<summary type="html">&lt;p&gt;Riguz移动页面&lt;a href=&quot;/index.php?title=Flutter%E4%B8%AD%E4%BD%BF%E7%94%A8ffi%E8%B0%83%E7%94%A8SqlCipher&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Flutter中使用ffi调用SqlCipher（页面不存在）&quot;&gt;Flutter中使用ffi调用SqlCipher&lt;/a&gt;至&lt;a href=&quot;/Invoke_SqlCipher_using_Flutter_ffi&quot; title=&quot;Invoke SqlCipher using Flutter ffi&quot;&gt;Invoke SqlCipher using Flutter ffi&lt;/a&gt;，不留重定向&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月18日 (一) 15:46的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3717&amp;oldid=prev</id>
		<title>Riguz：​Riguz移动页面Blog:Flutter中使用ffi调用SqlCipher至Flutter中使用ffi调用SqlCipher，不留重定向</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3717&amp;oldid=prev"/>
		<updated>2023-12-18T15:24:57Z</updated>

		<summary type="html">&lt;p&gt;Riguz移动页面&lt;a href=&quot;/index.php?title=Blog:Flutter%E4%B8%AD%E4%BD%BF%E7%94%A8ffi%E8%B0%83%E7%94%A8SqlCipher&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Blog:Flutter中使用ffi调用SqlCipher（页面不存在）&quot;&gt;Blog:Flutter中使用ffi调用SqlCipher&lt;/a&gt;至&lt;a href=&quot;/index.php?title=Flutter%E4%B8%AD%E4%BD%BF%E7%94%A8ffi%E8%B0%83%E7%94%A8SqlCipher&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Flutter中使用ffi调用SqlCipher（页面不存在）&quot;&gt;Flutter中使用ffi调用SqlCipher&lt;/a&gt;，不留重定向&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月18日 (一) 15:24的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3716&amp;oldid=prev</id>
		<title>Riguz：​/* 兼容性 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=3716&amp;oldid=prev"/>
		<updated>2023-12-18T15:24:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;兼容性&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月18日 (一) 15:24的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l128&quot;&gt;第128行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第128行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://github.com/sqlcipher/sqlcipher/issues/132#issuecomment-122912569 error: Library crypto not found. Install openssl!]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://github.com/sqlcipher/sqlcipher/issues/132#issuecomment-122912569 error: Library crypto not found. Install openssl!]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://github.com/openssl/openssl/issues/3902 shared library without version suffix for android (feature request)]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://github.com/openssl/openssl/issues/3902 shared library without version suffix for android (feature request)]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Flutter]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=2644&amp;oldid=prev</id>
		<title>imported&gt;Riguz：​目前在flutter中调用sqlite有成熟的插件例如sqflite，而我需要sqlcipher，并同时加载fts5扩展，现有的插件并不能直接支持。因此需要创建一个插件来做这个事情。在以前平台集成相当麻烦，而现在有了ffi之后，可以直接调用原生代码，虽然还在试验阶段但终究是大势所趋。</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Invoke_SqlCipher_using_Flutter_ffi&amp;diff=2644&amp;oldid=prev"/>
		<updated>2020-11-04T00:00:00Z</updated>

		<summary type="html">&lt;p&gt;目前在flutter中调用sqlite有成熟的插件例如sqflite，而我需要sqlcipher，并同时加载fts5扩展，现有的插件并不能直接支持。因此需要创建一个插件来做这个事情。在以前平台集成相当麻烦，而现在有了ffi之后，可以直接调用原生代码，虽然还在试验阶段但终究是大势所趋。&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;目前在flutter中调用sqlite有成熟的插件例如sqflite，而我需要sqlcipher，并同时加载fts5扩展，现有的插件并不能直接支持。因此需要创建一个插件来做这个事情。在以前平台集成相当麻烦，而现在有了ffi之后，可以直接调用原生代码，虽然还在试验阶段但终究是大势所趋。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= 源码编译=&lt;br /&gt;
sqlite源码编译比较简单，但是如果要运行其测试，在mac上还是有些折腾。sqlite3运行测试需要tcl8.6，自带的无法使用（/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/）&lt;br /&gt;
下载[https://www.tcl.tk/software/tcltk/download.html Tcl8.6]并编译安装：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd tcl8.6.10/unix&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
sudo make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
然后可以跑sqlite的测试`make test`。&lt;br /&gt;
&lt;br /&gt;
而要编译sqlcipher，也有一些选项需要设置，&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd sqlcipher/build&lt;br /&gt;
./configure --enable-tempstore=no \&lt;br /&gt;
  --with-crypto-lib=none \&lt;br /&gt;
  --enable-fts5 \&lt;br /&gt;
  CFLAGS=&amp;quot;-DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_TEMP_STORE=3 -DSQLITE_HAS_CODEC -I/usr/local/opt/openssl/include/&amp;quot; \&lt;br /&gt;
  LDFLAGS=&amp;quot;/usr/local/opt/openssl/lib/libcrypto.a&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= 在flutter中集成=&lt;br /&gt;
== 创建插件==&lt;br /&gt;
&lt;br /&gt;
首先需要创建一个插件：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
flutter create \&lt;br /&gt;
  --platforms=android,ios \&lt;br /&gt;
  --org=com.riguz \&lt;br /&gt;
  --template=plugin \&lt;br /&gt;
  -i swift \&lt;br /&gt;
  -a java \&lt;br /&gt;
  native_sqlcipher&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
flutter升级之后，必须指定`--platforms=android,ios`才会生成ios和android的响应工程。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== 平台集成==&lt;br /&gt;
&lt;br /&gt;
=== 生成整合的代码===&lt;br /&gt;
最直接的方式是将sqlcipher（其中已经包含了sqlite的代码）整合到一个文件中（称之为“amalgamation”版本，运行速度会更快一些）&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://github.com/sqlcipher/sqlcipher.git&lt;br /&gt;
cd sqlcipher&lt;br /&gt;
mkdir build&lt;br /&gt;
../configure --with-crypto-lib=none --enable-fts5&lt;br /&gt;
make sqlite3.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
生成完之后，会得到一个sqlite3.c和sqlite3.h。如果希望在mac上也编译出来，可以&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
./configure --enable-tempstore=no \&lt;br /&gt;
  --with-crypto-lib=none \&lt;br /&gt;
  --enable-fts5 \&lt;br /&gt;
  CFLAGS=&amp;quot;-DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_TEMP_STORE=3 -DSQLITE_HAS_CODEC -I/usr/local/opt/openssl/include/&amp;quot; \&lt;br /&gt;
  LDFLAGS=&amp;quot;/usr/local/opt/openssl/lib/libcrypto.a&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ios集成===&lt;br /&gt;
&lt;br /&gt;
将sqlite3.c和sqlite3.h代码拷贝到插件的ios/Classes目录中，然后需要修改插件的podspec文件（单纯在xcode里面修改无法保存，每次pod install之后就会丢失），需要将一些参数加进去：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
Pod::Spec.new do |s|&lt;br /&gt;
  s.name             = &amp;#039;native_sqlcipher&amp;#039;&lt;br /&gt;
  # ...&lt;br /&gt;
&lt;br /&gt;
  # 尽管之前configure的时候已经指定了SQLITE_ENABLE_FTS5，但是这里还需要再设置一次才能将fts5扩展编译进去&lt;br /&gt;
  s.frameworks = &amp;#039;Security&amp;#039;&lt;br /&gt;
  s.xcconfig = { &amp;#039;OTHER_CFLAGS&amp;#039; =&amp;gt; &amp;#039;-DSQLITE_ENABLE_FTS5 -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=3 -DSQLCIPHER_CRYPTO_CC -DNDEBUG&amp;#039; }&lt;br /&gt;
  # ...&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 安卓集成==&lt;br /&gt;
&lt;br /&gt;
=== 编译OpenSSL===&lt;br /&gt;
下载openssl，当前最新为1.1.1h。其编译说明可以参照NOTES.ANDROID文档。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export ANDROID_NDK_HOME=/Users/hfli/Library/Android/sdk/ndk/21.3.6528147&lt;br /&gt;
	PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin:$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin:$PATH&lt;br /&gt;
  ./Configure android-arm64 -D__ANDROID_API__=29&lt;br /&gt;
	make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
对于其他平台需要重新configure然后编译：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#./Configure android-arm -D__ANDROID_API__=29&lt;br /&gt;
#./Configure android-arm64 -D__ANDROID_API__=29&lt;br /&gt;
#./Configure android-x86 -D__ANDROID_API__=29&lt;br /&gt;
./Configure android-x86_64 -D__ANDROID_API__=29&lt;br /&gt;
make clean&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
默认生成的so是带有后缀的，（类似*.so.1.1)，因为安卓打包的时候不支持，解决办法是在make的时候覆盖掉参数：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
make SHLIB_VERSION_NUMBER= SHLIB_EXT=.so&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 集成sqlcipher===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- tbd --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 调用==&lt;br /&gt;
&lt;br /&gt;
参见[https://flutter.dev/docs/development/platform-integration/c-interop Binding to native code using dart:ffi]。&lt;br /&gt;
&lt;br /&gt;
= 兼容性=&lt;br /&gt;
SqlCipher依赖一个非标准的选项，但是这个选项[https://discuss.zetetic.net/t/removal-of-sqlite-has-codec-compile-time-option-from-public-sqlite-code/4262 最近已经被移除]了，SqlCipher目前包含的sqlite的版本为3.31.0，而sqlite最新为3.33.0。目前尚不知道后续的支持计划。&lt;br /&gt;
&lt;br /&gt;
参考：&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/petasis/tkdnd/issues/16 configure: error: Can&amp;#039;t find Tcl configuration definitions MacOS]&lt;br /&gt;
* [https://www.zetetic.net/sqlcipher/ios-tutorial/ Adding SQLCipher to Xcode Projects]&lt;br /&gt;
* [https://github.com/dart-lang/sdk/blob/master/samples/ffi/sqlite/ Dart ffi sqlite example]&lt;br /&gt;
* [https://github.com/sqlcipher/sqlcipher/issues/132#issuecomment-122912569 error: Library crypto not found. Install openssl!]&lt;br /&gt;
* [https://github.com/openssl/openssl/issues/3902 shared library without version suffix for android (feature request)]&lt;/div&gt;</summary>
		<author><name>imported&gt;Riguz</name></author>
	</entry>
</feed>