gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > DBMS : SQLite on my DS

#160485 - ferrand.d - Wed Jul 16, 2008 8:32 pm

Hi all !

I decided to continue the project LMP-ng (the iPod clone) and add some new features. I'm trying to add SQLite to my project to manage my playlist, but I couldn't. In fact, I don't know how to add a library to my project, how to put the files...

I tried to add those three files (http://www.sqlite.org/sqlite-amalgamation-3_6_0.zip) directly in my source directory, but I got these errors :
Quote:
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14010: error: expected specifier-qualifier-list before 'pthread_mutex_t'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'pthreadMutexAlloc':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: 'PTHREAD_MUTEX_INITIALIZER' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: (Each undeclared identifier is reported only once
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: for each function it appears in.)
cc1: warnings being treated as errors
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: excess elements in struct initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: excess elements in struct initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: excess elements in struct initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: 'pthread_t' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: excess elements in struct initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: expected '}' before numeric constant
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: excess elements in struct initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14098: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14099: error: extra brace group at end of initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14099: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14099: error: expected '}' before numeric constant
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14100: error: extra brace group at end of initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14100: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14100: error: expected '}' before numeric constant
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14101: error: extra brace group at end of initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14101: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14101: error: expected '}' before numeric constant
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14102: error: extra brace group at end of initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14102: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14102: error: expected '}' before numeric constant
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14103: error: extra brace group at end of initializer
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14103: error: (near initialization for 'staticMutexes[0]')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14103: error: expected '}' before numeric constant
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14116: error: 'pthread_mutexattr_t' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14116: error: expected ';' before 'recursiveAttr'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14117: error: 'recursiveAttr' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14118: error: 'PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14119: error: 'sqlite3_mutex' has no member named 'mutex'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14122: error: 'sqlite3_mutex' has no member named 'id'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14129: error: 'sqlite3_mutex' has no member named 'id'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14130: error: 'sqlite3_mutex' has no member named 'mutex'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14138: error: 'sqlite3_mutex' has no member named 'id'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'pthreadMutexFree':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14154: error: 'sqlite3_mutex' has no member named 'mutex'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'pthreadMutexEnter':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14197: error: 'sqlite3_mutex' has no member named 'mutex'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14198: error: 'sqlite3_mutex' has no member named 'owner'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14199: error: 'sqlite3_mutex' has no member named 'nRef'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14199: error: lvalue required as increment operand
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'pthreadMutexTry':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14240: error: 'sqlite3_mutex' has no member named 'mutex'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14241: error: 'sqlite3_mutex' has no member named 'owner'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14242: error: 'sqlite3_mutex' has no member named 'nRef'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14242: error: lvalue required as increment operand
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'pthreadMutexLeave':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14265: error: 'sqlite3_mutex' has no member named 'nRef'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14265: error: lvalue required as decrement operand
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:14273: error: 'sqlite3_mutex' has no member named 'mutex'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:17281:3: error: #error SQLite will not work correctly with the -ffast-math option of GCC.
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: At top level:
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:20216: error: expected specifier-qualifier-list before 'pthread_t'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:20615: error: expected specifier-qualifier-list before 'pthread_t'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'testThreadLockingBehavior':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:20817: error: 'pthread_t' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:20817: error: expected ';' before 't'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:20829: error: 't' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'findLockInfo':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:20980: error: 'struct lockKey' has no member named 'tid'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'transferOwnership':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:21075: error: 'pthread_t' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:21075: error: expected ';' before 'hSelf'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:21080: error: 'hSelf' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:21081: error: 'unixFile' has no member named 'tid'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:21092: error: 'unixFile' has no member named 'tid'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'unixUnlock':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:21679: error: 'unixFile' has no member named 'tid'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'fillInUnixFile':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22411: error: 'unixFile' has no member named 'tid'
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22828:19: error: dlfcn.h: No such file or directory
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'unixDlOpen':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22830: error: 'RTLD_NOW' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22830: error: 'RTLD_GLOBAL' undeclared (first use in this function)
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22830: error: invalid operands to binary | (have 'struct sqlite3_mutex *' and 'struct sqlite3_mutex *')
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22830: error: return makes pointer from integer without a cast
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'unixDlError':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22843: error: assignment makes pointer from integer without a cast
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c: In function 'unixDlSym':
/home/nios/Documents/autres_fichiers/projets/programmation/ds/lmp-ng/arm9/source/sqlite3.c:22850: error: return makes pointer from integer without a cast


How can I do ?
Thanks for your help !

#160493 - silent_code - Wed Jul 16, 2008 8:49 pm

That translates to: Lots of missing posix / unix libraries (and thus headers).
So, unless you port them over, too, there's nothing you can do. Also, I doubt you want to have full threads (pthreads) running on the little NDS.

Sorry. :^(

Try a different implementation or create some offline (PC / Mac) converter, that outputs some data you can parse with custom routines (which you would have to write.)

Good luck.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#160494 - ferrand.d - Wed Jul 16, 2008 8:51 pm

Okay thanks for you reply
That's unfortunately what I thought...

I'm gonna find another solution ;)

#160497 - naleksiev - Wed Jul 16, 2008 9:07 pm

Try adding

Code:
#define SQLITE_THREADSAFE 0
#define OS_OTHER


In my case I just added them in the make file like this:

Code:
-DSQLITE_THREADSAFE=0 -DOS_OTHER


And I end up with just a few warnings!

#160509 - ferrand.d - Wed Jul 16, 2008 11:03 pm

Thanks very much naleksiev, I added
Code:
#define SQLITE_THREADSAFE 0
#define SQLITE_OMIT_LOAD_EXTENSION
#define OS_OTHER

in the top of the file, and there are much less errors, but I still cannot compile :
Quote:
sqlite3.o: In function `unixSleep':
sqlite3.c:(.text+0x56c0): undefined reference to `sleep'
sqlite3.o: In function `unixSync':
sqlite3.c:(.text+0x57b8): undefined reference to `fsync'
sqlite3.c:(.text+0x57d8): undefined reference to `fsync'
sqlite3.o: In function `unixTruncate':
sqlite3.c:(.text+0x5ca8): undefined reference to `ftruncate'
sqlite3.o: In function `unixDelete':
sqlite3.c:(.text+0x14790): undefined reference to `fsync'


I think I must replace these Unix functions, but what are the equivalent in libnds ?

#160510 - Lazy1 - Wed Jul 16, 2008 11:20 pm

I'm actually looking for ftruncate as well since it's required by libsndfile.

#160512 - naleksiev - Thu Jul 17, 2008 12:08 am

I actually downloaded by mistake a little older version and that's why it's working for me :)

Try building it with 2.5.9 instead of 2.6.0

#160549 - ferrand.d - Thu Jul 17, 2008 5:25 pm

I tried with 2.5.9 and I added
Code:
#define SQLITE_THREADSAFE 0
#define OS_OTHER 1

in the top of the file (without the 1 there were again errors)

... and now it works fine ! Thanks very much to all and especially naleksiev
;)