tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] Fix sqlite3 on Linux with PREFER_PKGSRC=yes



sqlite3 needs uses dlopen and friends, which are in -ldl on
Linux.  Since most Linux systems link ncurses with -ldl, I guess
most people (including sqlite folks) didn't notice. So, when
preferring ncurses and readline from pkgsrc, sqlite3 fails:

./libtool --mode=link gcc  -I/usr/pkg-current/include  -O2 
-I/usr/pkg-current/include -DSQLITE_OS_UNIX=1 -I. -I./src 
-D_HAVE_SQLITE_CONFIG_H -DNDEBUG   -DSQLITE_THREADSAFE=1 
-DSQLITE_THREAD_OVERRIDE_LOCK=-1    -L/usr/pkg-current/lib 
-Wl,-R/usr/pkg-current/lib  -DHAVE_READLINE=1  \
                -o sqlite3 ./src/shell.c libsqlite3.la \
                -lreadline -lreadline  -lpthread  -rpath "/usr/pkg-current/lib"
gcc -I/usr/pkgsrc/current/databases/sqlite3/work/.buildlink/include -O2 
-DSQLITE_OS_UNIX=1 -I. -I./src -D_HAVE_SQLITE_CONFIG_H -DNDEBUG 
-DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 
-Wl,-R/usr/pkg-current/lib -DHAVE_READLINE=1 -o .libs/sqlite3 ./src/shell.c  
-L/usr/pkgsrc/current/databases/sqlite3/work/.buildlink/lib 
./.libs/libsqlite3.so 
/usr/pkgsrc/current/databases/sqlite3/work/.buildlink/lib/libreadline.so 
/usr/pkgsrc/current/databases/sqlite3/work/.buildlink/lib/libncurses.so 
-lpthread  -Wl,--rpath -Wl,/usr/pkg-current/lib -Wl,--rpath 
-Wl,/usr/pkgsrc/current/databases/sqlite3/work/.buildlink/lib
./.libs/libsqlite3.so: undefined reference to `dlsym'
./.libs/libsqlite3.so: undefined reference to `dlerror'
./.libs/libsqlite3.so: undefined reference to `dlopen'
./.libs/libsqlite3.so: undefined reference to `dlclose'
collect2: ld returned 1 exit status

This patch fixes it, and doesn't break it on NetBSD (or on Linux
with native ncurses/readline).  OK to commit?

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/databases/sqlite3/Makefile,v
retrieving revision 1.15
diff -a -u -r1.15 Makefile
--- Makefile    15 Dec 2008 09:06:11 -0000      1.15
+++ Makefile    22 Dec 2008 07:24:53 -0000
@@ -9,9 +9,12 @@
 CONFIGURE_ARGS+=       --enable-load-extension
 CONFIGURE_ARGS+=       --with-readline-inc=
 
+LIBS+=                 ${BUILDLINK_LDADD.dl}
+
 post-install:
        ${INSTALL_MAN} ${WRKSRC}/sqlite3.1 \
                ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/sqlite3.1
 
 .include "../../devel/readline/buildlink3.mk"
+.include "../../mk/dlopen.buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"


Home | Main Index | Thread Index | Old Index