TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

SQLite is easy to compile

192 点作者 nikbackm超过 5 年前

13 条评论

pjc50超过 5 年前
&gt; But then I tried to run it on a build server I was using (Netlify), and I got this extremely strange error message: “File not found”. I straced it, and sure enough execve was returning the error code ENOENT, which means “File not found”. This was kind of maddening because the file was DEFINITELY there and it had the correct permissions and everything.<p>This is an infuriating property of the runtime linkers on both Linux and Windows: if you&#x27;re trying to load file A, and dependency B of file A does not exist, you just get &quot;file not found&quot; with no indication of which file it was, and it&#x27;s extremely hard to debug. At least on linux the &quot;show dependencies&quot; tool is built in.
评论 #21379002 未加载
评论 #21381770 未加载
评论 #21380606 未加载
评论 #21383143 未加载
评论 #21379799 未加载
thomascgalvin超过 5 年前
&gt; All the code is in one file (sqlite.c), and there are no weird dependencies! It’s amazing.<p>This is because the author of SQLite publishes it this way as a convenience to integrators; the actual day-to-day coding is <i>not</i> done in a single C file.<p>In fact, the README[1] calls out twelve &quot;key files&quot;, and explicitly warns that SQLite &quot;will not be the easiest library in the world to hack.&quot;<p><a href="https:&#x2F;&#x2F;sqlite.org&#x2F;src&#x2F;doc&#x2F;trunk&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;src&#x2F;doc&#x2F;trunk&#x2F;README.md</a>
评论 #21379917 未加载
评论 #21378677 未加载
评论 #21380229 未加载
评论 #21380258 未加载
评论 #21378616 未加载
chubot超过 5 年前
Short Tcl script that combines everything into one file:<p><a href="https:&#x2F;&#x2F;www.sqlite.org&#x2F;src&#x2F;artifact&#x2F;5fed3d75069d8f66" rel="nofollow">https:&#x2F;&#x2F;www.sqlite.org&#x2F;src&#x2F;artifact&#x2F;5fed3d75069d8f66</a><p>Some other details &#x2F; rationale:<p><a href="https:&#x2F;&#x2F;www.sqlite.org&#x2F;amalgamation.html" rel="nofollow">https:&#x2F;&#x2F;www.sqlite.org&#x2F;amalgamation.html</a><p><i>Combining all the code for SQLite into one big file makes SQLite easier to deploy — there is just one file to keep track of. And because all code is in a single translation unit, compilers can do better inter-procedure optimization resulting in machine code that is between 5% and 10% faster.</i>
bobochan超过 5 年前
One of the benefits of this is Alon Zakai&#x27;s wonderful compilation of the SQLite C code with Emscripten to generate sql.js, which I have found very useful for teaching SQL.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;kripken&#x2F;sql.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kripken&#x2F;sql.js</a>
评论 #21380540 未加载
dpcan超过 5 年前
Yeah, so, this just blew my mind. I compiled it with an older version of gcc that I had on my Windows machine and it worked just as easily (without threading, or -ldl)<p>But there it is, a fully featured SQL engine in an EXE file that I can use with any application I want.<p>In a world that requires a million SDK&#x27;s, DLL&#x27;s, dependencies, etc, this is the most refreshing thing in the world.
enitihas超过 5 年前
Being easy to compile is a very nice thing to have about any software. Redis for example, is also too easy to compile, and quickly too. I think a lot of software using autotools is easy to compile (atleast on the POSIX compliant systems). Even postgresql is easy to compile, although not very quickly.
MuffinFlavored超过 5 年前
&gt; run .&#x2F;configure &gt; realize i’m missing a dependency<p>If only there was like, a tool, to help you manage compile-time dependencies.<p>I wish there was a `yarn` equivalent for C projects.
评论 #21378752 未加载
评论 #21378876 未加载
评论 #21379391 未加载
评论 #21380170 未加载
评论 #21378700 未加载
评论 #21378761 未加载
评论 #21380367 未加载
giovannibajo1超过 5 年前
Another good example is the Go compiler. Assuming you have any version of Go in your PATH, it&#x27;s:<p><pre><code> git clone https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go cd go&#x2F;src .&#x2F;make.bash # or make.bat for Windows </code></pre> And that&#x27;s it. You can then use &quot;bin&#x2F;go&quot; to compile your projects.
评论 #21380011 未加载
评论 #21381284 未加载
mikece超过 5 年前
The amalgamation file is a really interesting idea -- is this common in the world of C applications? The documentation is quite clear, however, that the amalgamation file and the source files are not the same thing. The source code (1,848 files in 40 folders) can be pulled down here -- <a href="https:&#x2F;&#x2F;www.sqlite.org&#x2F;cgi&#x2F;src&#x2F;doc&#x2F;trunk&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;www.sqlite.org&#x2F;cgi&#x2F;src&#x2F;doc&#x2F;trunk&#x2F;README.md</a> -- but more assembly will be required if you&#x27;re planning to build the project.<p>UPDATE: maybe not so much assembly is required... just running &quot;make&quot; built the project without any drama (I&#x27;m on macOS with XCode and tooling for Xamarin already installed - YMMV in terms whether you might need to install something to compile from source).
评论 #21380095 未加载
amyjess超过 5 年前
Every time an article about SQLite hits the front page here, I find myself stunned at how well-designed it is.
setheron超过 5 年前
I haven&#x27;t checked yet but was curious if it post processes the file into a single source file or that&#x27;s how it&#x27;s developed. The former sounds useful for build (as her blog suggests) whereas the latter sounds frightening to audit. (Unless it&#x27;s written literate?)
评论 #21378560 未加载
评论 #21378694 未加载
z92超过 5 年前
It&#x27;s far more easier. I had some sqlite2 database on an old system but nothing to convert it or even dump it. Had to download sqlite2 source and delete all <i>tcl</i>.c files. Then ran<p><pre><code> gcc *.c -o sqlite2 </code></pre> and it was done. That much simple.
MrZongle2超过 5 年前
I love a happy ending!<p>(Especially when many of <i>my</i> compiling-from-source experiences resemble what the author was anticipating)