Re: [sqlite] [3070601] Makefile to cross-compile?

2011-04-15 Thread Gilles Ganault
On Fri, 15 Apr 2011 09:23:10 +0200, Gilles Ganault
 wrote:
>I need to write a Makefile to cross-compile amalgamation-3070601 to
>generate the static and shared libraries.

For the benefit of other newbies who might need this:

BASE=/opt/toolchain
CC=bfin-linux-uclibc-gcc
AR=bfin-linux-uclibc-ar rcu
RANLIB=bfin-linux-uclibc-ranlib

CFLAGS=-O2 -Wall -DSQLITE_THREADSAFE=0 -I.
-I$(BASE)/uClinux-dist/linux-2.6.x/include
LDFLAGS=-Wl,-E -L$(BASE)/uClinux-dist/root/lib -L.

all:
@echo "No target specified."

object:
$(CC) $(CFLAGS) -c sqlite3.c -o sqlite.o

static:
$(CC) $(CFLAGS) -c sqlite3.c -o sqlite3.o
$(AR) libsqlite3.a sqlite3.o
$(RANLIB) libsqlite3.a

shared:
$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,libsqlite3.so
-o libsqlite3.so sqlite3.c

cli: static
$(CC) -static $(CFLAGS) $(LDFLAGS) -o sqlite3 shell.c
-lsqlite3 -ldl

clean:
-rm -rf *\.a *\.o *\.so sqlite3

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


[sqlite] 3.7.6.1 build error on platforms without pread/pwrite

2011-04-15 Thread Brad House
It appears there is a bad check when setting up the
pread (and pwrite) callback:

#if defined(USE_PREAD) || defined(SQLITE_ENABLE_LOCKING_STYLE)
   { "pread",(sqlite3_syscall_ptr)pread,  0  },
#else
   { "pread",(sqlite3_syscall_ptr)0,  0  },
#endif


SQLite forces SQLITE_ENABLE_LOCKING_STYLE to _always_ be defined:

#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
#  if defined(__APPLE__)
#define SQLITE_ENABLE_LOCKING_STYLE 1
#  else
#define SQLITE_ENABLE_LOCKING_STYLE 0
#  endif
#endif


So locking style is defined as '0', so I'm thinking the check
_should_ have been:

#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE


There are 2 other instances of checks for
   defined(SQLITE_ENABLE_LOCKING_STYLE)
that should also be changed in the code.

If you want, I can provide a patch against trunk to fix the build
issue.  I've currently, though, only modified the amalgamation 3.7.6.1
build in my local repo.

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


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Thomas Klausner
On Fri, Apr 15, 2011 at 07:45:58AM -0400, Richard Hipp wrote:
> Can you recompile with all optimization turned off and let us know if that
> changes anything.  If you are still crashing, perhaps the backtrace will
> provide better information.

I've added -O0 to the flags and removed -O2.
Now, sqlite3 just exits after the first entered line without creating the db.

#  
/scratch/databases/sqlite3-3.7.6.1/work/sqlite-autoconf-3070601/.libs/sqlite3  
new
SQLite version 3.7.6.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma user_version = 1;
# 

In gdb started in /tmp, this looks like this:
(gdb) c
Continuing.
SQLite version 3.7.6.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> pragma user_version = 1;

Breakpoint 9, robust_open (z=0x7f7ff7b68e28 "/tmp/new", f=514, m=420) at 
sqlite3.c:24590
24590 do{ rc = osOpen(z,f,m); }while( rc<0 && errno==EINTR );
(gdb) l
24585   /*
24586   ** Retry open() calls that fail due to EINTR
24587   */
24588   static int robust_open(const char *z, int f, int m){
24589 int rc;
24590 do{ rc = osOpen(z,f,m); }while( rc<0 && errno==EINTR );
24591 return rc;
24592   }
24593   
24594   /*
(gdb) s
open (path=0x7f7ff7b68e28 "/tmp/new", flags=514) at 
/archive/cvs/src/lib/libpthread/pthread_cancelstub.c:367
367 /archive/cvs/src/lib/libpthread/pthread_cancelstub.c: No such file or 
directory.
in /archive/cvs/src/lib/libpthread/pthread_cancelstub.c
(gdb) n
write (d=6295368, buf=0x7f7ff7b68e28, nbytes=) at 
/archive/cvs/src/lib/libpthread/pthread_cancelstub.c:566
566 in /archive/cvs/src/lib/libpthread/pthread_cancelstub.c
(gdb) n

Program exited normally.

/archive/cvs/src/lib/libpthread/pthread_cancelstub.c:367 is

int
open(const char *path, int flags, ...)
{
int retval;
pthread_t self;
va_list ap;

self = pthread__self();
TESTCANCEL(self);
va_start(ap, flags);
retval = _sys_open(path, flags, va_arg(ap, mode_t));
va_end(ap);
TESTCANCEL(self);

return retval;
}

/archive/cvs/src/lib/libpthread/pthread_cancelstub.c:566 is the second
TESTCANCEL in:

ssize_t
write(int d, const void *buf, size_t nbytes)
{
ssize_t retval;
pthread_t self;

self = pthread__self();
TESTCANCEL(self);
retval = _sys_write(d, buf, nbytes);
TESTCANCEL(self);

return retval;
}

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


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Richard Hipp
On Fri, Apr 15, 2011 at 5:08 AM, Thomas Klausner  wrote:

> On Fri, Apr 15, 2011 at 01:42:00PM +0700, Dan Kennedy wrote:
> > Are there any other threads in the process?
>
> My program is not using threads.
> sqlite3 is linked against libpthread. I don't think it's using threads
> (you probably know that better) but the c library behaves differently
> when libpthread is linked.
>
> > Try attaching [gdb] to the running process:
> >
> >gdb  
> >
> > Then run the [bt] command again.
>
> I recompiled with -g and ran it again, now sqlite3 is consistenly
> dumping core.
> I stepped through it line by line, but:
> open_db (p=) at shell.c:1389
>

Can you recompile with all optimization turned off and let us know if that
changes anything.  If you are still crashing, perhaps the backtrace will
provide better information.



> 1389sqlite3_enable_load_extension(p->db, 1);
> (gdb)
> 0x00401d20 in sqlite3_enable_load_extension@plt ()
> (gdb)
> Single stepping until exit from function
> sqlite3_enable_load_extension@plt,
> which has no line number information.
> 0x00401ba0 in ?? ()
> (gdb)
> Cannot find bounds of current function
> (gdb) c
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> __pollts50 (fds=0x4, nfds=4152832323, ts=0x7f7ff7873143,
> sigmask=) at
> /archive/cvs/src/lib/libpthread/pthread_cancelstub.c:424
> 424 /archive/cvs/src/lib/libpthread/pthread_cancelstub.c: No such
> file or directory.
>in /archive/cvs/src/lib/libpthread/pthread_cancelstub.c
> (gdb) Quit
> (gdb) bt
> #0  __pollts50 (fds=0x4, nfds=4152832323, ts=0x7f7ff7873143,
> sigmask=) at
> /archive/cvs/src/lib/libpthread/pthread_cancelstub.c:424
> #1  0x7f7ff7ffba00 in ?? ()
> #2  0x in ?? ()
>
> I'm not sure how to get more debugging info :(
>
> Suggestions where I shall add printfs? :)
>  Thomas
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] (UML) Visualisation of a SQLite schema ?

2011-04-15 Thread Gary_Gabriel
Hi Fredrik,
> I'm looking for a tool that would generate a visualisation (UML?) of
> the SQLite database schema I'm using, with table constraints and
> references between tables if possible. Is there such a tool (for Mac)?
>   
If you are interested in doing something yourself- then this might be a
gentle reminder of a thread on the mailing list.
Subject: [sqlite] Creating directed graphs and simple examples To:
sqlite-users@sqlite.org From: Gary Briggs  Date: 15,
Mar 2011

Archive:  http://www.mail-archive.com/sqlite-users@sqlite.org/msg59602.html

Graphviz: http://www.graphviz.org/

As you probably know Graphviz integrates into Tcl/Tk with TclDot which
is available for Posix.

Good luck with your search- Gary Gabriel






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


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Thomas Klausner
On Fri, Apr 15, 2011 at 04:32:08PM +0700, Dan Kennedy wrote:
> How are you building sqlite3? Using configure/make from the
> sqlite-autoconf-3070601.tar.gz package on the website?

Yes, using pkgsrc.

> Some
> other method? Can you post the output of the build process?

# make
=> Bootstrap dependency digest>=20010302: found digest-20080510
=> Checksum SHA1 OK for sqlite-autoconf-3070601.tar.gz
=> Checksum RMD160 OK for sqlite-autoconf-3070601.tar.gz
work -> /scratch/databases/sqlite3-3.7.6.1/work
===> Installing dependencies for sqlite3-3.7.6.1
==
The supported build options for sqlite3 are:

fts rtree

You can select which build options to use by setting PKG_DEFAULT_OPTIONS
or the following variable.  Its current value is shown:

PKG_OPTIONS.sqlite3 (not defined)

==
=> Build dependency libtool-base>=2.2.6bnb3: found libtool-base-2.2.6bnb4
=> Build dependency gmake>=3.81: found gmake-3.82nb1
=> Build dependency checkperms>=1.1: found checkperms-1.11
===> Overriding tools for sqlite3-3.7.6.1
===> Extracting for sqlite3-3.7.6.1
===> Patching for sqlite3-3.7.6.1
===> Creating toolchain wrappers for sqlite3-3.7.6.1
===> Configuring for sqlite3-3.7.6.1
=> Modifying GNU configure scripts to avoid --recheck
=> Replacing config-guess with pkgsrc versions
=> Replacing config-sub with pkgsrc versions
=> Replacing install-sh with pkgsrc version
=> Adding run-time search paths to pkg-config files.
=> Checking for portability problems in extracted files
checking for a BSD-compatible install... /usr/bin/install -c -o root -g wheel
checking whether build environment is sane... yes
checking for gawk... /usr/bin/awk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for x86_64--netbsd-gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking dependency style of cc... gcc3
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for x86_64--netbsd-gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking dependency style of cc... (cached) gcc3
checking for x86_64--netbsd-ranlib... no
checking for ranlib... ranlib
checking build system type... x86_64--netbsd
checking host system type... x86_64--netbsd
checking for a sed that does not truncate output... 
/scratch/databases/sqlite3-3.7.6.1/work/.tools/bin/sed
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/egrep
checking for ld used by cc... 
/scratch/databases/sqlite3-3.7.6.1/work/.wrapper/bin/ld
checking if the linker 
(/scratch/databases/sqlite3-3.7.6.1/work/.wrapper/bin/ld) is GNU ld... yes
checking for /scratch/databases/sqlite3-3.7.6.1/work/.wrapper/bin/ld option to 
reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... match_pattern 
/lib[^/]+(\.so|_pic\.a)$
checking how to run the C preprocessor... cc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... no
checking whether c++ accepts -g... no
checking dependency style of c++... none
checking how to run the C++ preprocessor... cpp
checking for x86_64--netbsd-g77... f77
checking whether we are using the GNU Fortran 77 compiler... no
checking whether f77 accepts -g... no
checking the maximum length of command line arguments... (cached) 262144
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for x86_64--netbsd-ar... no
checking for ar... ar
checking for x86_64--netbsd-ranlib... ranlib
checking for x86_64--netbsd-strip... no
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker 

Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Dan Kennedy
On 04/15/2011 04:08 PM, Thomas Klausner wrote:
> On Fri, Apr 15, 2011 at 01:42:00PM +0700, Dan Kennedy wrote:
>> Are there any other threads in the process?
>
> My program is not using threads.
> sqlite3 is linked against libpthread. I don't think it's using threads
> (you probably know that better) but the c library behaves differently
> when libpthread is linked.
>
>> Try attaching [gdb] to the running process:
>>
>> gdb  
>>
>> Then run the [bt] command again.
>
> I recompiled with -g and ran it again, now sqlite3 is consistenly
> dumping core.
> I stepped through it line by line, but:
> open_db (p=) at shell.c:1389
> 1389sqlite3_enable_load_extension(p->db, 1);
> (gdb)
> 0x00401d20 in sqlite3_enable_load_extension@plt ()
> (gdb)
> Single stepping until exit from function
> sqlite3_enable_load_extension@plt,
> which has no line number information.
> 0x00401ba0 in ?? ()
> (gdb)
> Cannot find bounds of current function
> (gdb) c
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> __pollts50 (fds=0x4, nfds=4152832323, ts=0x7f7ff7873143,
> sigmask=) at
> /archive/cvs/src/lib/libpthread/pthread_cancelstub.c:424
> 424 /archive/cvs/src/lib/libpthread/pthread_cancelstub.c: No such
> file or directory.
>  in /archive/cvs/src/lib/libpthread/pthread_cancelstub.c
> (gdb) Quit
> (gdb) bt
> #0  __pollts50 (fds=0x4, nfds=4152832323, ts=0x7f7ff7873143,
> sigmask=) at
> /archive/cvs/src/lib/libpthread/pthread_cancelstub.c:424
> #1  0x7f7ff7ffba00 in ?? ()
> #2  0x in ?? ()

How are you building sqlite3? Using configure/make from the
sqlite-autoconf-3070601.tar.gz package on the website? Some
other method? Can you post the output of the build process?

Also, what is the output if you set a breakpoint in
sqlite3_enable_load_extension() in the shell, then execute the
following gdb commands?

   (gdb) p *db
   (gdb) p sqlite3Config

Dan.






>
> I'm not sure how to get more debugging info :(
>
> Suggestions where I shall add printfs? :)
>   Thomas
> ___
> 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


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Thomas Klausner
On Fri, Apr 15, 2011 at 01:42:00PM +0700, Dan Kennedy wrote:
> Are there any other threads in the process?

My program is not using threads.
sqlite3 is linked against libpthread. I don't think it's using threads
(you probably know that better) but the c library behaves differently
when libpthread is linked.

> Try attaching [gdb] to the running process:
> 
>gdb  
> 
> Then run the [bt] command again.

I recompiled with -g and ran it again, now sqlite3 is consistenly
dumping core.
I stepped through it line by line, but:
open_db (p=) at shell.c:1389 
1389sqlite3_enable_load_extension(p->db, 1);
(gdb)
0x00401d20 in sqlite3_enable_load_extension@plt ()
(gdb)
Single stepping until exit from function
sqlite3_enable_load_extension@plt,
which has no line number information.
0x00401ba0 in ?? ()
(gdb)
Cannot find bounds of current function
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
__pollts50 (fds=0x4, nfds=4152832323, ts=0x7f7ff7873143,
sigmask=) at
/archive/cvs/src/lib/libpthread/pthread_cancelstub.c:424
424 /archive/cvs/src/lib/libpthread/pthread_cancelstub.c: No such
file or directory.
in /archive/cvs/src/lib/libpthread/pthread_cancelstub.c
(gdb) Quit
(gdb) bt
#0  __pollts50 (fds=0x4, nfds=4152832323, ts=0x7f7ff7873143,
sigmask=) at
/archive/cvs/src/lib/libpthread/pthread_cancelstub.c:424
#1  0x7f7ff7ffba00 in ?? ()
#2  0x in ?? ()

I'm not sure how to get more debugging info :(

Suggestions where I shall add printfs? :)
 Thomas
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] (UML) Visualisation of a SQLite schema ?

2011-04-15 Thread Fredrik Karlsson
Hi,

I'm looking for a tool that would generate a visualisation (UML?) of
the SQLite database schema I'm using, with table constraints and
references between tables if possible. Is there such a tool (for Mac)?

I've looked into SQL::Translator (produces reasonable output, but does
not cover the entire SQLite syntax) and SchemaSpy (the javasqlite has
pointer problems on my mac).

Any suggestion would be very helpful.

/Fredrik

-- 
"Life is like a trumpet - if you don't put anything into it, you don't
get anything out of it."
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] [3070601] Makefile to cross-compile?

2011-04-15 Thread Gilles Ganault
Hello

I need to write a Makefile to cross-compile amalgamation-3070601 to
generate the static and shared libraries.

Is this the right way?

==
#Path added to PATH
CC=bfin-linux-uclibc-gcc
AR=bfin-linux-uclibc-ar rcu
CFLAGS=-O2 -Wall -I/usr/src/baps/uClinux-dist/linux-2.6.x/include
LDFLAGS=-L/usr/src/baps/uClinux-dist/lib

libsqlite3:
#static
$(CC) $(CFLAGS) -static $(LDFLAGS) -c sqlite3.c -o sqlite.o
$(AR) $@.a sqlite.o

#shared
$(CC) $(CFLAGS) -shared -Wl,-soname,$@.so $(LDFLAGS) -o $@.so
sqlite3.c

clean:
-rm *\.o *\.so
==

Thank you.

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


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Dan Kennedy
On 04/15/2011 01:32 PM, Thomas Klausner wrote:
> On Fri, Apr 15, 2011 at 01:20:11PM +0700, Dan Kennedy wrote:
>> Can you post the stack-trace from the core file? With debugging
>> symbols if possible.
>
> Sorry, the backtrace is unusable:
> (gdb) bt
> #0  __nanosleep50 (rqtp=0x7f7fc1b0, rmtp=0x0)
>  at /archive/cvs/src/lib/libpthread/pthread_cancelstub.c:389
> #1  0x7f7ff7708008 in ?? ()
> #2  0x01a4 in ?? ()
> #3  0x0202 in ?? ()
> #4  0x in ?? ()

Are there any other threads in the process?

>
> Is there a way to get more useful output from the sqlite3 executable
> (that hangs?)?

Try attaching [gdb] to the running process:

   gdb  

Then run the [bt] command again.

Thanks,
Dan.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Thomas Klausner
On Fri, Apr 15, 2011 at 01:20:11PM +0700, Dan Kennedy wrote:
> Can you post the stack-trace from the core file? With debugging
> symbols if possible.

Sorry, the backtrace is unusable:
(gdb) bt
#0  __nanosleep50 (rqtp=0x7f7fc1b0, rmtp=0x0)
at /archive/cvs/src/lib/libpthread/pthread_cancelstub.c:389
#1  0x7f7ff7708008 in ?? ()
#2  0x01a4 in ?? ()
#3  0x0202 in ?? ()
#4  0x in ?? ()

Is there a way to get more useful output from the sqlite3 executable
(that hangs?)?

> > Perhaps non-standard options used during compilation are
> > -DUSE_PREAD
> > -DSQLITE_ENABLE_UNLOCK_NOTIFY=1
> 
> Could easily be the ENABLE_UNLOCK_NOTIFY.

I disabled both of these options but still see the problem.
 Thomas
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite-3.7.6.1 coredump/hang

2011-04-15 Thread Dan Kennedy
On 04/15/2011 12:27 PM, Thomas Klausner wrote:
> Hi!
>
> With 3.7.6 and 3.7.6.1 on NetBSD-5.99.49/amd64, a program I'm using
> started dumping core.

Can you post the stack-trace from the core file? With debugging
symbols if possible.

> Perhaps non-standard options used during compilation are
> -DUSE_PREAD
> -DSQLITE_ENABLE_UNLOCK_NOTIFY=1

Could easily be the ENABLE_UNLOCK_NOTIFY.

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