On Thu, 2 Dec 2010 08:06:13 -0600, "Black, Michael (IS)"
<michael.bla...@ngc.com> wrote:
>You're linking your two .o into the shared library instead of sqlite3.o
>
>        src/$(LIBNAME): $(OBJS)
>                $(CC) $(CFLAGS) $(LIB_OPTION) $(DRIVER_LIBS) -o $@ sqlite3.o

Thanks a bunch, problem solved :-) I can now access SQLite from Lua
through LuaSQL on the Blackfin + uClinux device.

However, to get things working, I had to...

1. Recompile SQLite with "-DSQLITE_THREADSAFE=0",or get the following
error:

=================
> ./lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require "luasql.sqlite3"
./lua: can't resolve symbol '_pthread_mutexattr_init'
=================

For those interested, here's the command I used:

cd /usr/src/sqlite-3.7.3

#Unpacked the Blackfin toolchain in /opt
/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/bin/gcc
-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -v -O2 -Wall -fpic
-c -o libsqlite3.o sqlite3.c

2. LuaSQL's Makefile had to include the two LuaSQL object files and
the SQLite object file:

=================
src/$(LIBNAME): $(OBJS)
        $(CC) $(CFLAGS) $(LIB_OPTION) -o $@ $(OBJS)
/usr/src/sqlite-3.7.3/preprocessed/libsqlite3.o

$(OBJS):
        $(CC) $(CFLAGS) $(INCS) $(DRIVER_INCS) -c $*.c -o $@
=================

Just out of curiosity, I was wondering...

1. Why does GAS display "/../../../" when compiling SQLite?

=================
...
Compiler executable checksum: ca267839d6237ba3b9dd06cf21e83f67

/opt/uClinux/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.1/../../../../bfin-linux-uclibc/bin/as
-v -mfdpic -o libsqlite3.o /tmp/ccdSXIe3.s
GNU assembler version 2.17 (bfin-linux-uclibc) using BFD version 2.17
=================

Is it because I'm not using a Makefile, and GCC has to look around to
located the assembler?

2. I'm confused about the difference between .o and .a: Why do I need
to use a .a when compiling a static library into an executable, while
I had to use the .o to compile SQLite into the LuaSQL shared library?

Thanks again.

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

Reply via email to