Thank you.  Those changes (modified slightly for 3.7.2) allowed me to 
create a DKM project that compiles sqlite3.c to libSQLite3.a.

However, when I link my main VIP project, I get the following unresolved 
errors:
dld: warning: Undefined symbol 'rtpVerifyAndLock' in file 'partialImage.o'
dld: warning: Undefined symbol 'pgMgrPageFree' in file 'partialImage.o'
dld: warning: Undefined symbol 'pgMgrPageAllocAt' in file 'partialImage.o'

Those are not directly used by SQLite.  But I have a feeling that one or 
more of the file I/O, semaphore, locking, or memory library system calls 
are...

-Scott

sqlite-users-boun...@sqlite.org wrote on 10/08/2010 07:38:45 AM:

> Hello Scott,
> 
>     Below is my patch on the latest SQLite 3.7.3. Please notice that I 
only
> verify it with GCC 4.1.2 compiler in VxWorks 6.6/6.7/6.8(I have not 
verify
> it with my real target machine yet).
> 
> *** sqlite3.c.orig    2010-10-08 10:42:22.000000000 +0800
> --- sqlite3.c    2010-10-08 19:24:18.390625000 +0800
> ***************
> *** 17,22 ****
> --- 17,26 ----
>   ** language. The code for the "sqlite3" command-line shell is also in 
a
>   ** separate file. This file contains only code for the core SQLite
> library.
>   */
> + #if defined(OS_VXWORKS)
> + #include <vxWorks.h>
> + #endif /* OS_VXWORKS */
> +
>   #define SQLITE_CORE 1
>   #define SQLITE_AMALGAMATION 1
>   #ifndef SQLITE_PRIVATE
> ***************
> *** 22795,22801 ****
> --- 22799,22811 ----
>   #include <sys/stat.h>
>   #include <fcntl.h>
>   #include <unistd.h>
> +
> + #if defined(OS_VXWORKS) && defined(_WRS_KERNEL)
> + #include <sys/times.h>
> + #else
>   #include <sys/time.h>
> + #endif /* OS_VXWORKS */
> +
>   #include <errno.h>
>   #include <sys/mman.h>
> 
> ***************
> *** 24945,24951 ****
> --- 24955,24965 ----
>   /*
>    ** Close a file.
>    */
> + #if (OS_VXWORKS < 600)
>   static int semClose(sqlite3_file *id) {
> + #else
> + static int semClose_native(sqlite3_file *id) {
> + #endif
>     if( id ){
>       unixFile *pFile = (unixFile*)id;
>       semUnlock(id, NO_LOCK);
> ***************
> *** 25581,25587 ****
> --- 25595,25607 ----
>       }
>       return -1;
>     }
> +
> + #if defined(OS_VXWORKS) && defined(_WRS_KERNEL)
> +   got = write(id->h, (char *)pBuf, cnt);
> + #else
>     got = write(id->h, pBuf, cnt);
> + #endif /* OS_VXWORKS */
> +
>   #endif
>     TIMER_END;
>     if( got<0 ){
> ***************
> *** 26762,26768 ****
> --- 26782,26792 ----
>     semIoFinder,              /* Finder function name */
>     semIoMethods,             /* sqlite3_io_methods object name */
>     1,                        /* shared memory is disabled */
> + #if (OS_VXWORKS < 600)
>     semClose,                 /* xClose method */
> + #else
> +   semClose_native,          /* xClose method */
> + #endif
>     semLock,                  /* xLock method */
>     semUnlock,                /* xUnlock method */
>     semCheckReservedLock      /* xCheckReservedLock method */
> ***************
> *** 27517,27523 ****
>     noLock = eType!=SQLITE_OPEN_MAIN_DB;
> 
> 
> ! #if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
>     struct statfs fsInfo;
>     if( fstatfs(fd, &fsInfo) == -1 ){
>       ((unixFile*)pFile)->lastErrno = errno;
> --- 27541,27547 ----
>     noLock = eType!=SQLITE_OPEN_MAIN_DB;
> 
> 
> ! #if (defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE) &&
> !defined(OS_VXWORKS)
>     struct statfs fsInfo;
>     if( fstatfs(fd, &fsInfo) == -1 ){
>       ((unixFile*)pFile)->lastErrno = errno;
> ***************
> *** 27530,27536 ****
>     }
>   #endif
> 
> ! #if SQLITE_ENABLE_LOCKING_STYLE
>   #if SQLITE_PREFER_PROXY_LOCKING
>     isAutoProxy = 1;
>   #endif
> --- 27554,27560 ----
>     }
>   #endif
> 
> ! #if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS
>   #if SQLITE_PREFER_PROXY_LOCKING
>     isAutoProxy = 1;
>   #endif
> ***************
> *** 27793,27799 ****
>     ** tests repeatable.
>     */
>     memset(zBuf, 0, nBuf);
> ! #if !defined(SQLITE_TEST)
>     {
>       int pid, fd;
>       fd = open("/dev/urandom", O_RDONLY);
> --- 27817,27823 ----
>     ** tests repeatable.
>     */
>     memset(zBuf, 0, nBuf);
> ! #if !defined(SQLITE_TEST) && !defined(OS_VXWORKS)
>     {
>       int pid, fd;
>       fd = open("/dev/urandom", O_RDONLY);
> 
>     I'v used definitions as below:
> 
> EXTRA_DEFINE    +=    -DOS_VXWORKS_660=660
> EXTRA_DEFINE    +=    -DOS_VXWORKS_670=670
> EXTRA_DEFINE    +=    -DOS_VXWORKS_680=680
> EXTRA_DEFINE    +=    -DOS_VXWORKS=OS_VXWORKS_670
> EXTRA_DEFINE    +=    -DSQLITE_HOMEGROWN_RECURSIVE_MUTEX
> EXTRA_DEFINE    +=    -DSQLITE_ENABLE_LOCKING_STYLE=1
> EXTRA_DEFINE    +=    -DSQLITE_OMIT_LOAD_EXTENSION
> 
> 
> Best Regards,
> 
> Huang Zhihua
> 
> 2010/10/8 Scott A Mintz <sami...@ra.rockwell.com>
> 
> > I searched through all the mail archives to see if I could find 
someone
> > that has ported SQLite to vxWorks in kernel mode.  Apparently, there 
are a
> > few folks attempting it.  And fewer succeeding at it.
> >
> > I found an article published by ZhiHua Huang where he describes the 
mods
> > he made to port SQLite 3.6.23.1 to vxWorks 6.5
> > http://www.mail-archive.com/sqlite-users@sqlite.org/msg51531.html
> >
> > Using that as a starting point, I modified my files but I get the
> > following errors:
> > "C:/CCViews/Mintz_NetlinxUCS_L7x/NetLinxUCS/SQLite3_LIB/sqlite3.c", 
line
> > 27262: error (dcc:1633): parse error  near 'struct'
> > "C:/CCViews/Mintz_NetlinxUCS_L7x/NetLinxUCS/SQLite3_LIB/sqlite3.c", 
line
> > 27262: error (dcc:1206): syntax error
> > "C:/CCViews/Mintz_NetlinxUCS_L7x/NetLinxUCS/SQLite3_LIB/sqlite3.c", 
line
> > 27262: fatal error (dcc:1340): can't recover from earlier errors
> >
> > This is the code it's complaining about.  The "struct statfs fsInfo;" 
line
> > is line 27262.
> >
> > #ifdef FD_CLOEXEC
> >  fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
> > #endif
> >
> >  noLock = eType!=SQLITE_OPEN_MAIN_DB;
> >
> >
> > #if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
> >  struct statfs fsInfo;
> >  if( fstatfs(fd, &fsInfo) == -1 ){
> >    ((unixFile*)pFile)->lastErrno = errno;
> >    if( dirfd>=0 ) close(dirfd); /* silently leak if fail, in error */
> >    close(fd); /* silently leak if fail, in error */
> >    return SQLITE_IOERR_ACCESS;
> >  }
> >  if (0 == strncmp("msdos", fsInfo.f_fstypename, 5)) {
> >    ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;
> >  }
> > #endif
> >
> > Any ideas?
> >
> > -Scott
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to