Compiling SQLite lazarus / 16-Databases ---------------------------------------------------------------------- Pascaluvr · 2013-05-09 02:46 Can anyone give me the commandline (windows) for compiling SQLite3 (amalgamated) with gcc. I have searched the web for examples but the few references I find are from people that get  the same problems as me - compile errors.  I can list them, but I am sure its more that I don't know what options I need on the commandline to produce a DLL. On a previous occasion someone created a dll with the options I needed turned on - but I  would really like to know how to do it myself and not need to rely on others to produce the dll i need. Thanks in advance ---------------------------------------------------------------------- ludob · 2013-05-09 06:59 The problem is getting all the correct libraries and include files when compiling with gcc on windows. My advice: install an IDE such as wxDev-C++. That will make things much easier. It took me 5 minutes to build sqlite.dll with it. Step by step with wxDev-c++ from http://wxdsgn.sourceforge.net/?q=node/4 : -Create New Project, Select DLL and check 'C Project', save the project in the dir containing sqlite3.c -Remove the 2 auto created files from the project -Add sqlite3.c (this will take a while to parse the huge file) -Rebuild all That's it, your dll will be in the Output\MingW subdir. I have attached the Makefile.win created by the IDE. ---------------------------------------------------------------------- Pascaluvr · 2013-05-09 08:08 Thanks ludob - i was extremely optimistic as this was a newer version of Dev-c than i used - but still tyhe same problem. Initially i get a problem with a malloc (forget the actual message) but something about converting a null to a integer i think. I tried changing a few options and get : C:\MinGW\bin\Makefile.win [Build Error]  [Objects/MingW/sqlite3.o] Error 1 Basically the same errors i get with the old Dev-c, lcc-Win and gcc commandline. I am sure it is something basic i am doing wrong - its just frustrating. Anyways, i have downloaded the latest sqlite and done some testing to find that the option i needed to turn on is now turned on by default - so i dont have a need just now, but I am sure it will arise in the future. Thank you for your time and effort ---------------------------------------------------------------------- Leledumbo · 2013-05-09 08:35 Just download the amalgamated version, and you don't need any other option but: gcc -mdll -o sqlite3.dll sqlite3.c ---------------------------------------------------------------------- Pascaluvr · 2013-05-09 11:11 thank you thank you - that worked perfectly ---------------------------------------------------------------------- Pascaluvr · 2013-05-11 07:01 Actually I still have a problem. While the compile works without error, I get the dreaded SIGSEGV error when its used. This is the command line I used: gcc -mdll -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -o sqlite3.dll sqlite3.c The additional switches are described in: http://www.sqlite.org/fts3.html While I accept its probably something basically stupid that I am doing  wrong, my knowledge of C is non existent (and i guess it will stay that way) Thanks again for any help ---------------------------------------------------------------------- ludob · 2013-05-11 10:10 Here it works with your defines. My little test program runs with the dll. I obviously don't know what you are trying to do;) Add -g3 to the command line to produce debug info. gcc debug info can be used by gdb and you can simply step into the C code. ---------------------------------------------------------------------- Leledumbo · 2013-05-11 10:12 QuoteWhile the compile works without error, I get the dreaded SIGSEGV error when its used.How do you use it? ---------------------------------------------------------------------- Pascaluvr · 2013-05-11 13:52 Quote from: Leledumbo on May 11, 2013, 12:12:50 pmQuoteWhile the compile works without error, I get the dreaded SIGSEGV error when its used.How do you use it? Basically just a skeleton program at this stage with the usual sqlite3connection, transaction, datasource query and dbgrid. Its not the program at fault - i found a sqlite3.dll version that has been compiled with these  switches and it works fine.  So while this problem isn't holding me up at this stage - it would still be useful to know for possible future requirements. Thanks ludob, i will try the debug option tomorrow when i have more time to play with it. Thanks for the replies. ---------------------------------------------------------------------- Pascaluvr · 2013-05-12 02:15 Just an update: I have Win7 64bit, but i use fpc/laz 32 bit.  is it possible i have create a 64 bit dll (that would explain a SigSegV) does gcc have a commandline switch to produce a 32 bit dll? ---------------------------------------------------------------------- Leledumbo · 2013-05-12 05:20 Quoteis it possible i have create a 64 bit dll (that would explain a SigSegV)only if your gcc is 64-bit... Quotedoes gcc have a commandline switch to produce a 32 bit dll?-m32 ---------------------------------------------------------------------- Pascaluvr · 2013-05-12 16:19 mmmmhhhhhh that wasn't the problem. ooohhhh well - hopefully i wont need other options of sqlite that need a recompile Thanks for the help guys. ---------------------------------------------------------------------- bambamns · 2013-05-12 19:49 Hi, Do you know switch to compile it for WinCE ? Thx