On Fri, Jun 13, 2008 at 4:31 AM, Alexey Pechnikov <[EMAIL PROTECTED]> wrote: >> The extension-functions file doesn't actually implement any of the >> math functinos, it simply acts as a glue layer between SQLite and the >> system math library. In this case, it looks like the run-time linker >> that loads the extension can't resolve the call for log() from the >> extension into the math library, resulting in an unresolved link. >> >> On many systems the math library is part of the standard set of libs >> that are imported by the linker for all applications. There are a >> few systems, however, where the math library is not part of the >> standard lib set. On those systems, you need to explicitly tell the >> linker you want the math library made avaliable. You can do that >> by compiling the lib with -lm to import the math library. The math >> lib won't be pulled into the .so, but it will be noted that if the >> run-time linker pulls in the extension, it will also need to pull in >> the math library before it attepts to resolve all the symbols. >> >> At least, in theory. > > Thanks for coherent explanation. I am compiling library with switch -lm and > now it's work. > > $ gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so > $ sqlite3 :memory: > sqlite> SELECT load_extension('./libsqlitefunctions.so'); > > sqlite> select sqrt(16); > 4.0 > sqlite> > >> >> What OS are you trying this on? > > Linux Debian Etch (sqlite pakage backported from Debian Lenny). >
Interesting; I tried it on Debian sid (unstable) and it worked as well. I guess the statement in http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions that the extensions loading mechanism being turned off by default doesn't apply to Debian. I've revised the instructions to include -lm for Linux and to indicate the possibility that the program as compiled by some distributions will work. Does anyone know if -lm is need on Mac OS X as well? Liam _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users