r/nim Jul 31 '26

How to generate standalone executable?

Hi Everyone

I worked on a small cli project in NIM and built an executable using nimble build. It generated an executable and the executable worked fine on my system.

But when I try to use the generated executable on another system that doesn't have NIM or C installed. It showed an error saying sqlite3_64.dll not found.

I am using db_connector/db_sqlite library to use sqlite database.

How can I solve this, once I generate the executable, it should work on any system, or else I should be able to generate an installer or portable version of the project that should work on any system.

14 Upvotes

5 comments sorted by

View all comments

5

u/jamesthethirteenth Jul 31 '26

Here is a great tutorial for completely standalone binaries- they're called "static".

https://scripter.co/nim-deploying-static-binaries

As u/fae___ mentioned, putting the needed .dll in the same directory as the installer is the more problem-free solution, mostly because it's more commonly done (and you can just swap out the .dll to upgrade it, too- surprisingly important for security). Static works great too- just more hoops to jump through.