Compiling Sqlite 3

Hi!

So I'm trying to get my build system all automated. What this would mean is that, once set up, anyone can checkout my graphics engine project, run a setup script (setup.py), and then compile! A quick 1, 2, 3!

So far, it's working for Linux (64 bit) and Windows (32 bit). No Mac yet, since I don't own one.

Now, I want to get this same setup working for my game project. I then needed to get Angelscript, Thread Pool 11, and Sqlite 3 all pre-compiled and ready to go.

The one snag was Sqlite 3 - it didn't seem to have an easily downloadable binary.

So I downloaded the 'amalgamated' source...which had only the .c and .h files. Crap, no build system for me! So, I had to learn some gcc commands on the command line, yay!

So, to compile Sqlite 3 as a shared library (with full optimizations), I did this:

gcc -O3 -c -shared sqlite3.c -o sqlite3.so

And for static, I did this:

gcc -O3  -static -c sqlite3.c -o sqlite3.a -pthread -ldl

Note the -pthread and -ldl for the static build. We need the linux thread library pthread and the dl library (not sure what this does, but we need it!) for a bunch of stuff. You might notice the lack of l before pthread. Apparently:

Using "-lpthread" is a bit different than using "-pthread", "-lpthread" means link against the pthread-library whereas "-pthread" means that g++ will choose the appropriate threading library with an pthread interface for you.

Okay then! -pthread it is.

That's it for now - happy coding!

Cheers

Jarrett