Re: [sqlite] Building for vxWorks
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Eduardo Morras > Sent: 08 July 2014 10:19 > On Mon, 7 Jul 2014 12:44:54 + > Andy Lingwrote: > > > Building the original file with the flags. > > > > -DHAVE_UTIME -DSQLITE_OMIT_LOAD_EXTENSION > > -DSQLITE_ENABLE_LOCKING_STYLE > > > > I get the following errors. > > > > sqlite3.c: In function 'posixFchown': > > sqlite3.c:24249: warning: implicit declaration of function 'geteuid' > > sqlite3.c:24249: warning: implicit declaration of function 'fchown' > > sqlite3.c: At top level: > > sqlite3.c:24306: error: 'pread' undeclared here (not in a function) > > > Are you trying to use -DSQLITE_OMIT* with the amalgamation sqlite3.c or > with the full sqlite3 src? Most of -DSQLITE_OMIT* won't work if you use the > amalgamation. > I'm using the amalgamation. I seemed to need the SQLITE_OMIT_LOAD_EXTENSION to get close to a build that works. I've just tried removing all compile options and with the patched amalgamation I get.. sqlite3.c: In function 'posixFchown': sqlite3.c:24249: warning: implicit declaration of function 'geteuid' sqlite3.c:24249: warning: implicit declaration of function 'fchown' sqlite3.c: At top level: sqlite3.c:24996: error: expected specifier-qualifier-list before 'sem_t' sqlite3.c: In function 'semCheckReservedLock': sqlite3.c:26377: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26377: error: (Each undeclared identifier is reported only once sqlite3.c:26377: error: for each function it appears in.) sqlite3.c:26377: error: 'pSem' undeclared (first use in this function) sqlite3.c:26377: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:26379: warning: implicit declaration of function 'sem_trywait' sqlite3.c:26390: warning: implicit declaration of function 'sem_post' sqlite3.c: In function 'semLock': sqlite3.c:26430: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26430: error: 'pSem' undeclared (first use in this function) sqlite3.c:26430: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c: In function 'semUnlock': sqlite3.c:26463: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26463: error: 'pSem' undeclared (first use in this function) sqlite3.c:26463: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c: In function 'fillInUnixFile': sqlite3.c:29263: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29264: error: 'unixInodeInfo' has no member named 'aSemName' sqlite3.c:29270: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29270: warning: implicit declaration of function 'sem_open' sqlite3.c:29271: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29271: error: 'SEM_FAILED' undeclared (first use in this function) sqlite3.c:29273: error: 'unixInodeInfo' has no member named 'aSemName' It may be I needed the OMIT to get the link to work, once the above has been fixed I'll let you know. Most of this can be fixed by adding a #include . So by making the change.. #if SQLITE_ENABLE_LOCKING_STYLE # include # if OS_VXWORKS # include # include # else # include # include # endif #else # if OS_VXWORKS # include # endif #endif /* SQLITE_ENABLE_LOCKING_STYLE */ I now just get sqlite3.c: In function 'posixFchown': sqlite3.c:24253: warning: implicit declaration of function 'geteuid' sqlite3.c:24253: warning: implicit declaration of function 'fchown' Trying to link this I get the following unresolved symbols... In function `posixFchown': undefined reference to `geteuid' In function `dotlockLock': undefined reference to `utimes' In function `unixDlError': undefined reference to `dlerror' In function `unixDlSym': undefined reference to `dlsym' In function `posixFchown': undefined reference to `fchown' In function `unixDlClose': undefined reference to `dlclose' In function `unixDlOpen': undefined reference to `dlopen' Adding the -DHAVE_UTIME option fixes the utimes reference Adding the -DSQLITE_OMIT_LOAD_EXTENSION fixes the dl* references, which just leaves geteuid & fchown. Regards Andy Ling ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
On Mon, 7 Jul 2014 12:44:54 + Andy Lingwrote: > Building the original file with the flags. > > -DHAVE_UTIME -DSQLITE_OMIT_LOAD_EXTENSION > -DSQLITE_ENABLE_LOCKING_STYLE > > I get the following errors. > > sqlite3.c: In function 'posixFchown': > sqlite3.c:24249: warning: implicit declaration of function 'geteuid' > sqlite3.c:24249: warning: implicit declaration of function 'fchown' > sqlite3.c: At top level: > sqlite3.c:24306: error: 'pread' undeclared here (not in a function) Are you trying to use -DSQLITE_OMIT* with the amalgamation sqlite3.c or with the full sqlite3 src? Most of -DSQLITE_OMIT* won't work if you use the amalgamation. --- --- Eduardo Morras ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Jan Nijtmans > Sent: 07 July 2014 20:14 > 2014-07-07 14:44 GMT+02:00 Andy Ling: > > Removing the SQLITE_ENABLE_LOCKING_STYLE I get > ... > > sqlite3.c: In function 'fileHasMoved': > > sqlite3.c:25236: error: 'struct unixFileId' has no member named 'ino' > > sqlite3.c: In function 'semCheckReservedLock': > ... > > sqlite3.c:26372: warning: unused variable 'statBuf' > > sqlite3.c: In function 'semLock': > ... > > sqlite3.c:26425: warning: unused variable 'fd' > > Below my suggested patch (derived from todays trunk) > which should solve the above 2 warnings and the > error. All other warnings/errors seems > to derive from the missing and maybe > other header files ( ???) > OK, I've made those changes and with -DHAVE_UTIME -DSQLITE_OMIT_LOAD_EXTENSION I get sqlite3.c: In function 'posixFchown': sqlite3.c:24249: warning: implicit declaration of function 'geteuid' sqlite3.c:24249: warning: implicit declaration of function 'fchown' sqlite3.c: At top level: sqlite3.c:24996: error: expected specifier-qualifier-list before 'sem_t' sqlite3.c: In function 'semCheckReservedLock': sqlite3.c:26377: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26377: error: (Each undeclared identifier is reported only once sqlite3.c:26377: error: for each function it appears in.) sqlite3.c:26377: error: 'pSem' undeclared (first use in this function) sqlite3.c:26377: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:26379: warning: implicit declaration of function 'sem_trywait' sqlite3.c:26390: warning: implicit declaration of function 'sem_post' sqlite3.c: In function 'semLock': sqlite3.c:26430: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26430: error: 'pSem' undeclared (first use in this function) sqlite3.c:26430: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c: In function 'semUnlock': sqlite3.c:26463: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26463: error: 'pSem' undeclared (first use in this function) sqlite3.c:26463: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c: In function 'fillInUnixFile': sqlite3.c:29263: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29264: error: 'unixInodeInfo' has no member named 'aSemName' sqlite3.c:29270: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29270: warning: implicit declaration of function 'sem_open' sqlite3.c:29271: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29271: error: 'SEM_FAILED' undeclared (first use in this function) sqlite3.c:29273: error: 'unixInodeInfo' has no member named 'aSemName' If I add -DSQLITE_ENABLE_LOCKING_STYLE I get sqlite3.c: In function 'posixFchown': sqlite3.c:24249: warning: implicit declaration of function 'geteuid' sqlite3.c:24249: warning: implicit declaration of function 'fchown' sqlite3.c: At top level: sqlite3.c:24306: error: 'pread' undeclared here (not in a function) sqlite3.c:24323: error: 'pwrite' undeclared here (not in a function) sqlite3.c: In function 'unixOpen': sqlite3.c:29561: error: storage size of 'fsInfo' isn't known sqlite3.c:29721: warning: implicit declaration of function 'fstatfs' sqlite3.c:29726: error: request for member 'f_fstypename' in something not a structure or union sqlite3.c:29726: warning: passing argument 2 of 'strncmp' from incompatible pointer type sqlite3.c:29751: warning: implicit declaration of function 'statfs' sqlite3.c:29764: error: request for member 'f_flags' in something not a structure or union sqlite3.c:29764: error: 'MNT_LOCAL' undeclared (first use in this function) sqlite3.c:29764: error: (Each undeclared identifier is reported only once sqlite3.c:29764: error: for each function it appears in.) sqlite3.c:29764: error: invalid operands to binary & (have 'struct unix_syscall *' and 'struct unix_syscall *') sqlite3.c:29769: warning: implicit declaration of function 'proxyTransformUnixFile' sqlite3.c:29561: warning: unused variable 'fsInfo' This is only the compile. Once this is sorted there is linking to fix. > I don't have VxWorks, just tested this on Linux using > -DOS_VXWORKS=1, as suggested here: > > I'm happy to try any patches. I obviously do have vxWorks. As a slight aside. Some of the compile options seem necessary to get a basic build. I wonder if these should be set by default for vxWorks. Regards Andy Ling ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
2014-07-07 14:44 GMT+02:00 Andy Ling: > Removing the SQLITE_ENABLE_LOCKING_STYLE I get ... > sqlite3.c: In function 'fileHasMoved': > sqlite3.c:25236: error: 'struct unixFileId' has no member named 'ino' > sqlite3.c: In function 'semCheckReservedLock': ... > sqlite3.c:26372: warning: unused variable 'statBuf' > sqlite3.c: In function 'semLock': ... > sqlite3.c:26425: warning: unused variable 'fd' Below my suggested patch (derived from todays trunk) which should solve the above 2 warnings and the error. All other warnings/errors seems to derive from the missing and maybe other header files ( ???) I don't have VxWorks, just tested this on Linux using -DOS_VXWORKS=1, as suggested here: Apparently the function fileHasMoved (new in SQLite 3.8.3) was never tested on VxWorks, otherwise it would have been discovered that 'struct unixFileId' has different fields on VxWorks compared to other UNIX platforms. I hope this brings it a little bit closer to fully working on VxWorks. Regards, Jan Nijtmans Index: src/os_unix.c == --- src/os_unix.c +++ src/os_unix.c @@ -1301,13 +1301,19 @@ /* ** Return TRUE if pFile has been renamed or unlinked since it was first opened. */ static int fileHasMoved(unixFile *pFile){ +#if OS_VXWORKS + return pFile->pInode!=0 && + (pFile->pId!=pFile->pInode->fileId.pId); + +#else struct stat buf; return pFile->pInode!=0 && (osStat(pFile->zPath, )!=0 || buf.st_ino!=pFile->pInode->fileId.ino); +#endif } /* ** Check a unixFile that is a database. Verify the following: @@ -2446,11 +2452,10 @@ } /* Otherwise see if some other process holds it. */ if( !reserved ){ sem_t *pSem = pFile->pInode->pSem; -struct stat statBuf; if( sem_trywait(pSem)==-1 ){ int tErrno = errno; if( EAGAIN != tErrno ){ rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_CHECKRESERVEDLOCK); @@ -2499,11 +2504,10 @@ ** This routine will only increase a lock. Use the sqlite3OsUnlock() ** routine to lower a locking level. */ static int semLock(sqlite3_file *id, int eFileLock) { unixFile *pFile = (unixFile*)id; - int fd; sem_t *pSem = pFile->pInode->pSem; int rc = SQLITE_OK; /* if we already have a lock, it is exclusive. ** Just adjust level and punt on outta here. */ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Jan Nijtmans > Sent: 07 July 2014 12:24 > To: General Discussion of SQLite Database > Subject: Re: [sqlite] Building for vxWorks > > 2014-07-04 11:52 GMT+02:00 Andy Ling <andy.l...@quantel.com>: > > I now have sqlite running under vxWorks. As nobody offered any > suggestions, I thought I would share my experience in the hope it will help > others and maybe feed some changes back into the main code. > > > semaphone.h is included if SQLITE_ENABLE_LOCKING_STYLE is defined, but > I > > couldn't get it to build with that set. > > The first logical question is: Why you couldn't get it to build with > that set? What exact error-message did you get? I think that's > the first thing that should be fixed before trying other > refinements. > Building the original file with the flags. -DHAVE_UTIME -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE I get the following errors. sqlite3.c: In function 'posixFchown': sqlite3.c:24249: warning: implicit declaration of function 'geteuid' sqlite3.c:24249: warning: implicit declaration of function 'fchown' sqlite3.c: At top level: sqlite3.c:24306: error: 'pread' undeclared here (not in a function) sqlite3.c:24323: error: 'pwrite' undeclared here (not in a function) sqlite3.c: In function 'fileHasMoved': sqlite3.c:25236: error: 'struct unixFileId' has no member named 'ino' sqlite3.c:25236: warning: comparison between pointer and integer sqlite3.c: In function 'semCheckReservedLock': sqlite3.c:26372: warning: unused variable 'statBuf' sqlite3.c: In function 'semLock': sqlite3.c:26425: warning: unused variable 'fd' sqlite3.c: In function 'unixOpen': sqlite3.c:29557: error: storage size of 'fsInfo' isn't known sqlite3.c:29717: warning: implicit declaration of function 'fstatfs' sqlite3.c:29722: error: request for member 'f_fstypename' in something not a structure or union sqlite3.c:29722: warning: passing argument 2 of 'strncmp' from incompatible pointer type sqlite3.c:29747: warning: implicit declaration of function 'statfs' sqlite3.c:29760: error: request for member 'f_flags' in something not a structure or union sqlite3.c:29760: error: 'MNT_LOCAL' undeclared (first use in this function) sqlite3.c:29760: error: (Each undeclared identifier is reported only once sqlite3.c:29760: error: for each function it appears in.) sqlite3.c:29760: error: invalid operands to binary & (have 'struct unix_syscall *' and 'struct unix_syscall *') sqlite3.c:29765: warning: implicit declaration of function 'proxyTransformUnixFile' sqlite3.c:29557: warning: unused variable 'fsInfo' Removing the SQLITE_ENABLE_LOCKING_STYLE I get sqlite3.c: In function 'posixFchown': sqlite3.c:24249: warning: implicit declaration of function 'geteuid' sqlite3.c:24249: warning: implicit declaration of function 'fchown' sqlite3.c: At top level: sqlite3.c:24996: error: expected specifier-qualifier-list before 'sem_t' sqlite3.c: In function 'fileHasMoved': sqlite3.c:25236: error: 'struct unixFileId' has no member named 'ino' sqlite3.c: In function 'semCheckReservedLock': sqlite3.c:26371: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26371: error: (Each undeclared identifier is reported only once sqlite3.c:26371: error: for each function it appears in.) sqlite3.c:26371: error: 'pSem' undeclared (first use in this function) sqlite3.c:26371: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:26374: warning: implicit declaration of function 'sem_trywait' sqlite3.c:26385: warning: implicit declaration of function 'sem_post' sqlite3.c:26372: warning: unused variable 'statBuf' sqlite3.c: In function 'semLock': sqlite3.c:26426: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26426: error: 'pSem' undeclared (first use in this function) sqlite3.c:26426: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:26425: warning: unused variable 'fd' sqlite3.c: In function 'semUnlock': sqlite3.c:26459: error: 'sem_t' undeclared (first use in this function) sqlite3.c:26459: error: 'pSem' undeclared (first use in this function) sqlite3.c:26459: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c: In function 'fillInUnixFile': sqlite3.c:29259: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29260: error: 'unixInodeInfo' has no member named 'aSemName' sqlite3.c:29266: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29266: warning: implicit declaration of function 'sem_open' sqlite3.c:29267: error: 'unixInodeInfo' has no member named 'pSem' sqlite3.c:29267: error: 'SEM_FAILED' undeclared (first use in this function) sqlite3.c:29269: error: 'unixInodeInfo' has no member named 'aSemName' Regards Andy Ling ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
2014-07-04 11:52 GMT+02:00 Andy Ling: > I now have sqlite running under vxWorks. As nobody offered any suggestions, I > thought I would share my experience in the hope it will help others and maybe > feed some changes back into the main code. > semaphone.h is included if SQLITE_ENABLE_LOCKING_STYLE is defined, but I > couldn't get it to build with that set. The first logical question is: Why you couldn't get it to build with that set? What exact error-message did you get? I think that's the first thing that should be fixed before trying other refinements. Regards, Jan Nijtmans ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
On Fri, 4 Jul 2014 09:52:00 + Andy Lingwrote: > #if OS_VXWORKS && USING_DOSFS > if ( errno == S_dosFsLib_FILE_NOT_FOUND ) > #else > if( errno==ENOENT ) > #endif If I might suggest, unless ENOENT is defined: #if OS_VXWORKS && USING_DOSFS # define ENOENT S_dosFsLib_FILE_NOT_FOUND #endif If ENOENT is defined, modify osUnlink to set errno to ENOENT when S_dosFsLib_FILE_NOT_FOUND is returned by the OS. The idea behind functions like osUnlink() is surely to isolate the SQLite logic from the idiosyncracies of the OS, to make "unlink", in whatever form, behave posixly. You don't want DOSFS codes to escape in to the main body of SQLite. You want to trap them in the portability layer. --jkl ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Building for vxWorks
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Andy Ling > Sent: 27 June 2014 10:27 > To: 'sqlite-users@sqlite.org' > Subject: [sqlite] Building for vxWorks > I now have sqlite running under vxWorks. As nobody offered any suggestions, I thought I would share my experience in the hope it will help others and maybe feed some changes back into the main code. > I am trying to build sqlite 3.8.5 for vxWorks 6.9 and I'm after a bit of help. > > To be more precise, I'm building an RTP for 64bit NEHALEM on vxWorks 6.9.3 > > Straight out of the box it won't build, I get the following errors > > sqlite3.c:24997: error: expected specifier-qualifier-list before 'sem_t' > sqlite3.c: In function 'fileHasMoved': > sqlite3.c:25237: error: 'struct unixFileId' has no member named 'ino' > sqlite3.c: In function 'semCheckReservedLock': > > The first I have fixed by adding a #include semaphone.h is included if SQLITE_ENABLE_LOCKING_STYLE is defined, but I couldn't get it to build with that set and it is required for the unixInodeInfo structure so just before this structure definition I added #if OS_VXWORKS # include #endif > and the second > I've fixed by bodging fileHasMoved to always return false. I'm not sure what the "right" way is to fix this, but in our particular system I don't think any files will get moved. So I have changed the function to look like static int fileHasMoved(unixFile *pFile){ #ifdef OS_VXWORKS return 0 ; #else struct stat buf; return pFile->pInode!=0 && (osStat(pFile->zPath, )!=0 || buf.st_ino!=pFile->pInode->fileId.ino); #endif } > It then builds, but has a few unresolved symbols. These I have fixed by > adding the compile options > > -DHAVE_UTIME > -DSQLITE_OMIT_LOAD_EXTENSION > I also had to bodge posixFchown. vxWorks doesn't support geteuid so I changed this function to.. static int posixFchown(int fd, uid_t uid, gid_t gid){ #if OS_VXWORKS return 0 ; #else return geteuid() ? 0 : fchown(fd,uid,gid); #endif } > It now runs, but anything that tries to modify a database file generates a > Disk > I/O error. > After a bit of faffing I eventually found this was a problem with unlink. Sqlite was trying to delete a temporary file using unlink. If the error from unlink was ENOENT it ignored it assuming the file had been deleted (or not created). vxWorks only supports the POSIX error codes if you are using a POSIX compliant filing system. We're using dosFs, which isn't. So the error returned by unlink wasn't ENOENT. I have fixed this by adding a new compile option "USING_DOSFS" and changed delete to.. static int unixDelete( sqlite3_vfs *NotUsed, /* VFS containing this as the xDelete method */ const char *zPath,/* Name of file to be deleted */ int dirSync /* If true, fsync() directory after deleting file */ ){ int rc = SQLITE_OK; UNUSED_PARAMETER(NotUsed); SimulateIOError(return SQLITE_IOERR_DELETE); if( osUnlink(zPath)==(-1) ){ #if OS_VXWORKS && USING_DOSFS if ( errno == S_dosFsLib_FILE_NOT_FOUND ) #else if( errno==ENOENT ) #endif { rc = SQLITE_IOERR_DELETE_NOENT; }else{ This also requires the dosFsLib.h file being included and there seems to be some incompatibilities somewhere which mean it didn't quite work. I didn't have the time to investigate properly so added this bodge.. #if OS_VXWORKS && USING_DOSFS /* copied from vwModNum.h */ # define M_dosFsLib (56 << 16) # define IMPORT extern # include #endif My compile options are now -DHAVE_UTIME -DSQLITE_OMIT_LOAD_EXTENSION -DUSING_DOSFS The next problem I encountered was running sqlite commands from the vxWorks shell. Invariably they crashed in some way. This was because the stack is too small in the shell. So making the commands spawn a thread with a bigger stack (64K was enough) fixed this. So I now have enough running to start doing some real work. Regards Andy Ling ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users