Skip to content

Recompiling native libraries

Ricky Curtice edited this page Oct 16, 2015 · 1 revision

Recompiling included native libraries

In the bin folder you'll see several DLL and .so native libraries included for ease of installation. On rare occasions these libraries need to be recompiled, and some have not so accurate instructions. Below you can find some simple instructions on how to proceed for these.

sqlite3.dll (Windows)

Read the online instructions for an overview and how to get the amalgamation source, but follow the below to get a 64bit dll.

  • Start Developer Command Prompt for VS2015

  • Execute the following commands:

    ```dos
    cd "\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
    vcvarsall amd64
    ```
    
  • Then change directory to where you have the amalgamation C file.

  • Execute the following:

    ```dos
    cl sqlite3.c -DSQLITE_API=__declspec(dllexport) -link -dll -out:sqlite3.dll
    ```
    

(Many, many thanks to Mario at Protyposis - after much searching it was indeed found.)

To see that it is in fact a 64bit DLL, run the following:

dumpbin /headers sqlite3.dll

Look for the following near the top of the listing:

FILE HEADER VALUES
            8664 machine (x64)

If you see that, you're good. If you instead see 14C machine (x86) you missed a step.

You can also verify that your DLL has exported functions by running the following:

dumpbin /exports sqlite3.dll

If you don't see a long list of functions, you missed the -DSQLITE_API=__declspec(dllexport) part above.

sqlite.so.x.x.x (Linux)

I've been lazy and just copied it over from my system lib folder on a pure 64bit install...

System.Data.SQLite

This one's special too. Compile this one using Linux under Mono so that it's nearly guaranteed that it will work everywhere. Here's how. These instructions are adapted from excellent work by GNUForensics. Ignore where he talks about Windows: we aren't using the Interop process, which is why this has to be built this way.

  • Download the Source Code and extract somewhere useful on your disk. You're looking for sqlite-netFx-source-X.X.X.X.zip where the X's represent some numbers.
  • Do not attempt to build ANY of the projects in the downloaded source.
  • In the folder System.Data.SQLite you will find the various versions of System.Data.SQLite.20XX.csproj.
    In the next couple of steps we are going to use the 2012 edition, System.Data.SQLite.2012.csproj. You will not be building any other project.
  • Open a terminal if you aren't already in one, and cd to the System.Data.SQLite directory.
  • Execute the following:
xbuild /p:Configuration=Release /p:UseInteropDll=false /p:UseSqliteStandard=true System.Data.SQLite.2010.csproj
  • If all went well your wanted dll assembly should be hiding in ../bin/2012/Release/bin/. Simply copy and paste over to the bin folder in your working copy of Halcyon.