Hi,

I was trying to disable thread safety to get rid of the pthread
dependency with an explicit './configure --disable-threadsafe' on
sqlite-autoconf-3280000.tar.gz. However, this leads to linker errors:

          CCLD     libsqlite3.la
          CCLD     sqlite3
        ld: ./.libs/libsqlite3.so: undefined reference to 
`pthread_mutexattr_settype'
        ld: ./.libs/libsqlite3.so: undefined reference to 
`pthread_mutex_trylock'
        ld: ./.libs/libsqlite3.so: undefined reference to `pthread_join'
        ld: ./.libs/libsqlite3.so: undefined reference to `pthread_create'
        ld: ./.libs/libsqlite3.so: undefined reference to 
`pthread_mutexattr_init'
        ld: ./.libs/libsqlite3.so: undefined reference to 
`pthread_mutexattr_destroy'

The reason is apparently that configure sets -DSQLITE_THREADSAFE=1 and
checks for pthread availability when given --enable-threadsafe, but does
nothing with --disable-threadsafe. But SQLITE_THREADSAFE is defined to 1
in sqlite3.c whenever it is undefined (which is the case here), so the
code calling pthread_create() etc. is compiled nevertheless, even when
no pthread library is found on the system.

I solved this by explicitely adding a -DSQLITE_THREADSAFE=0 to
BUILD_CFLAGS in configure.ac when $enable_threadsafe is "no", and it now
builds fine even without pthreads.

Cheers,
-- 
Roland Hieber                     | r.hie...@pengutronix.de     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to