Subject: | Problems building 1.31 with system SQLite |
A couple of issues came up whilst trying to build DBD-SQLite with an
existing SQLite installation (after patching the "if (0)" to "if (1)" in
Makefile.PL of course):
1. The addition of "-I." to the compiler flags in Makefile.PL means that
the bundled "sqlite3.h" is used even when building with the system
SQLite version. This may cause some strange behaviour where the system
version is only slightly different, or it may cause complete failure of
the module if for instance the system version is older than 3.6.23, when
this happens in the test suite:
# Failed test 'use DBD::SQLite;'
# at t/01_compile.t line 15.
# Tried to use 'DBD::SQLite'.
# Error: Can't load
'/builddir/build/BUILD/DBD-SQLite-1.31/blib/arch/auto/DBD/SQLite/SQLite.so'
for module DBD::SQLite:
/builddir/build/BUILD/DBD-SQLite-1.31/blib/arch/auto/DBD/SQLite/SQLite.so:
undefined symbol: sqlite3_compileoption_get at
/usr/lib64/perl5/DynaLoader.pm line 200.
# at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
# $DBI::VERSION=1.613
Use of inherited AUTOLOAD for non-method DBD::SQLite::compile_options()
is deprecated at t/01_compile.t line 20.
Can't locate auto/DBD/SQLite/compile_opt.al in @INC (@INC contains: inc
/builddir/build/BUILD/DBD-SQLite-1.31/blib/lib
/builddir/build/BUILD/DBD-SQLite-1.31/blib/arch /usr/local/lib64/perl5
/usr/local/share/perl5 /usr/local/share/perl5 /usr/lib64/perl5
/usr/share/perl5 /usr/share/perl5 /usr/lib64/perl5 /usr/share/perl5
/usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl .) at t/01_compile.t
line 20
# Looks like you failed 1 test of 3.
# Looks like your test exited with 2 just after 3.
t/01_compile.t ...........................
Dubious, test returned 2 (wstat 512, 0x200)
Failed 1/3 subtests
This is because the bundled sqlite3.h says that SQLITE_VERSION_NUMBER is
3007002 and hence sqlite3_compileoption_get should be available but it's
not present in the actual library so module loading fails.
I worked around this by deleting the bundled sqlite3.c, sqlite3.h and
sqlite3ext.h before running Makefile.PL.
2. If the existing SQLite wasn't built with the ENABLE_FTS3_PARENTHESIS
option enabled, the test suite fails:
# Failed test 'moutons NOT lait (unicode is 0)'
# at t/43_fts3.t line 98.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = '2'
# Failed test '(il OR elle) AND un* (unicode is 0)'
# at t/43_fts3.t line 98.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = '1'
# Failed test 'moutons NOT lait (unicode is 1)'
# at t/43_fts3.t line 98.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = '2'
# Failed test '(il OR elle) AND un* (unicode is 1)'
# at t/43_fts3.t line 98.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = '1'
# Looks like you failed 4 tests of 19.
t/43_fts3.t ..............................
Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/19 subtests
The SQLite in Fedora is affected by this issue for instance.
Attached patch resolves that problem.
Subject: | DBD-SQLite-1.31-FTS3.patch |
--- DBD-SQLite-1.31/t/43_fts3.t 2010-09-15 08:16:43.000000000 +0100
+++ DBD-SQLite-1.31/t/43_fts3.t 2010-09-15 14:50:58.529161202 +0100
@@ -90,6 +90,11 @@
}
# queries
+SKIP: {
+ skip "These tests require SQLite compiled with ENABLE_FTS3_PARENTHESIS option", scalar @tests
+ unless DBD::SQLite->can('compile_options') &&
+ grep /ENABLE_FTS3_PARENTHESIS/, DBD::SQLite::compile_options();
+
my $sql = "SELECT docid FROM try_fts3 WHERE content MATCH ?";
for my $t (@tests) {
my ($query, @expected) = @$t;
@@ -97,6 +102,9 @@
my $results = $dbh->selectcol_arrayref($sql, undef, $query);
is_deeply($results, \@expected, "$query (unicode is $use_unicode)");
}
+
+}
+
}